[Scummvm-git-logs] scummvm master -> 5b262b47b1ab147e7f892ce93dbeef4cf28773c6

mduggan noreply at scummvm.org
Wed Sep 3 11:24:22 UTC 2025


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

Summary:
6e2d4d1288 ACCESS: Small cleanups
342c9ad00f ACCESS: Fix rendering of initial MM notes after credits
3dba04cf4d ACCESS: Correct overlapping MM variable initialization
680349d51a ACCESS: Improve const correctness for sprite render operations
cb672f79a1 ACCESS: Fix drawBox function
be6cac3119 ACCESS: Add loading for MM's 8x8 mono font
f9940856cc ACCESS: Fix rendering of MM dialogs
b2907a14d8 ACCESS: Cache icons, fix icon bar position in MM
159a64b7fb ACCESS: Reduce game-specific code slightly
05426ac1cd ACCESS: Remove MM-specific code from Amazon engine
cef8a20a3b ACCESS: Rename game enum vals to match ScummVM style
a2e5b92177 ACCESS: Ensure nullptr always at end of inventory
3839333672 ACCESS: Fix rendering of MM inventory
77990dec09 ACCESS: Clean up unnecessary export
7d0f71d303 ACCESS: Remove some magic numbers
51613a54b0 ACCESS: Fix watch rendering in MM
d0835f9ad8 ACCESS: Small const correctness fixes
9538b81fff ACCESS: Fix first cutscene in MM
a8da0b6885 ACCESS: Add some MM-specific data to saves
d896d83141 ACCESS: Filter MM inventory list to unused items only
a793a62505 ACCESS: Fix scrolling around with the camera in MM
392a25f83a ACCESS: Convert loops to C++11 style for slightly cleaner code
23643333c9 ACCESS: Correctly check when sfx is playing in MM scripts
27260c8f61 ACCESS: Implement cmdBlock for MM
4f318593f0 ACCESS: Avoid left shift of negative numbers
b31cfefcb7 ACCESS: Fix font color before showing list box
4c89f8a01e ACCESS: Add debug statements to all the scripts cmd functions
5751e233e5 ACCESS: Enhance debugging of branching ops
9139a042c6 ACCESS: Add some more debugger commands
f95e2a9d90 ACCESS: Fix script variable comparison to match originals
bbf28f6c1e ACCESS: Fix uninitialized variable
1a3a7d959d ACCESS: Remove redundant variable assignment (PVS-Studio V1048)
224593eb1c ACCESS: Fix potential undefined behavior PVS-Studio V567
640bd43747 ACCESS: Fix shonky box type logic (PVS-Studio V590)
9aa1da0dd6 ACCESS: Remove redundant initializer (PVS-Studio V519)
baed230f09 ACCESS: Remove redundant assignment (PVS-Studio V1048)
ad8ea47924 ACCESS: Remove unused variable
4908744b8e ACCESS: Add support for dropped shadow on text
0f3271f2d5 ACCESS: Complete special1 implementation
a884280e19 ACCESS: Add a stub midi parser for MM
2c65459429 ACCESS: Add footstep sounds for MM
43b2e6e689 ACCESS: Add Open operation for MM
d8df21547d ACCESS: Refactor slightly to share room init code
a16115f8c0 ACCESS: Fix MM establishing shots
4bfe985f47 ACCESS: Fix palette loading for MM videos
56b224c628 ACCESS: Restore footstep noises in Amazon too
4194288e45 ACCESS: Fix variable name
34c14e20a7 ACCESS: Fix rendering of camera scene in MM
29d8433aa4 ACCESS: Add debugger commands for travel table
4c9f2cb6fb ACCESS: Use common string reading code
6966144e77 ACCESS: Fix MM room num in convo-only rooms
9676eb2157 ACCESS: Add debug commands to control ask table
3ab11f9a4b ACCESS: Small cleanups
a1510567a9 ACCESS: Fix 'ask about' box lists
c2f5731c38 ACCESS: Fix pushLocation opcode for MM
612bf79f37 ACCESS: Fix MM select box with many items
0ab83c339b ACCESS: Improve and simplify debugger commands
45c22b1170 ACCESS: Remove redundant variable for MM
d9db7e25c4 ACCESS: Fix photo taking in MM
c4590d660e ACCESS: Fix MM can't travel dialog
a2752515ab ACCESS: Allow mouse wheel to scroll long dialogs
beced1886d ACCESS: Fix MM transitions and death screens a bit
4b31731354 ACCESS: Allow cross-planet travel in MM cheat mode
de19d80918 ACCESS: Add hack to skip unskippable MM videos
61b7273745 ACCESS: Fix placement of default messages in MM
1f6d3b5610 ACCESS: Fix possible crash after death in MM
ce5206b8c2 ACCESS: Fix scroll when jumping rocks in MM
5f1ad33cdb ACCESS: Hide cursor during special cutscene in MM
df8c32b9ba ACCESS: Fix MM restarts a little
5c0053bef0 ACCESS: Add missing rooms in MM data
86c6720045 ACCESS: Fixes for MM hoverboard scene
1f3f1864dc ACCESS: Add Jetpack special case and stub tunnel code
1c5f75c7f9 ACCESS: Fixes for MM endgame sequence
14b2a2506e ACCESS: Remove duplicate variables
bf34b0b660 ACCESS: Allow arrows to navigate list boxes
573b5f5229 ACCESS: Update keymapper config for MM actions
790dc5859f ACCESS: Add support for MM midi format
3cb81720f9 ACCESS: Fix Tex Y offset in various MM scenes
9dce3991c4 ACCESS: Small midi parsing fixes
69a6292917 ACCESS: Fix TODO and leak - use same sprite storage as original for credits
a7b52e5d9c ACCESS: Update for new midiparser interface
daf31978c3 ACCESS: Fix palette in and after MM abduction scene
5b262b47b1 ACCESS: Add small cleanups suggested by @bluegr


Commit: 6e2d4d12880bcb5c3f52edf48c74c3035de37651
    https://github.com/scummvm/scummvm/commit/6e2d4d12880bcb5c3f52edf48c74c3035de37651
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Small cleanups

Cleaned up initializations to have less hard-coded sizes, reduced string copies
slightly.

Changed paths:
    engines/access/access.cpp
    engines/access/access.h
    engines/access/amazon/amazon_game.cpp
    engines/access/bubble_box.cpp
    engines/access/martian/martian_game.cpp
    engines/access/martian/martian_game.h
    engines/access/scripts.cpp


diff --git a/engines/access/access.cpp b/engines/access/access.cpp
index 4bed05808b3..9262f7b0e24 100644
--- a/engines/access/access.cpp
+++ b/engines/access/access.cpp
@@ -98,15 +98,12 @@ AccessEngine::AccessEngine(OSystem *syst, const AccessGameDescription *gameDesc)
 	_cheatFl = false;
 	_restartFl = false;
 	_printEnd = 0;
-	for (int i = 0; i < 100; i++)
-		_objectsTable[i] = nullptr;
+	ARRAYCLEAR(_objectsTable);
 	_clearSummaryFlag = false;
 
-	for (int i = 0; i < 60; i++)
-		_travel[i] = 0;
+	ARRAYCLEAR(_travel);
 	_startTravelItem = _startTravelBox = 0;
-	for (int i = 0; i < 33; i++)
-		_ask[i] = 0;
+	ARRAYCLEAR(_ask);
 	_startAboutItem = _startAboutBox = 0;
 	_byte26CB5 = 0;
 	_bcnt = 0;
@@ -115,13 +112,12 @@ AccessEngine::AccessEngine(OSystem *syst, const AccessGameDescription *gameDesc)
 	_boxSelectY = 0;
 	_boxSelectYOld = -1;
 	_numLines = 0;
-	_tempList = nullptr;
+	//_tempList = nullptr;
 	_pictureTaken = 0;
 
 	_vidEnd = false;
 
-	for (int i = 0; i < 6; ++i)
-		_countTbl[i] = 0;
+	ARRAYCLEAR(_countTbl);
 }
 
 AccessEngine::~AccessEngine() {
@@ -235,7 +231,7 @@ void AccessEngine::loadCells(Common::Array<CellIdent> &cells) {
 }
 
 void AccessEngine::freeCells() {
-	for (int i = 0; i < 100; ++i) {
+	for (int i = 0; i < ARRAYSIZE(_objectsTable); ++i) {
 		delete _objectsTable[i];
 		_objectsTable[i] = nullptr;
 	}
diff --git a/engines/access/access.h b/engines/access/access.h
index 4d353a62516..df418082d03 100644
--- a/engines/access/access.h
+++ b/engines/access/access.h
@@ -248,7 +248,7 @@ public:
 	int _numLines;
 	byte _byte26CB5;
 	int _bcnt;
-	byte *_tempList;
+	//byte *_tempList;
 	int _pictureTaken;
 	//
 
diff --git a/engines/access/amazon/amazon_game.cpp b/engines/access/amazon/amazon_game.cpp
index 419fbf05935..fa6b109ef9e 100644
--- a/engines/access/amazon/amazon_game.cpp
+++ b/engines/access/amazon/amazon_game.cpp
@@ -734,7 +734,7 @@ void AmazonEngine::dead(int deathId) {
 			_screen->_printOrg = Common::Point(20, 155);
 			_screen->_printStart = Common::Point(20, 155);
 
-			Common::String &msg = de._msg;
+			const Common::String &msg = de._msg;
 			_printEnd = 180;
 
 			printText(_screen, msg);
@@ -760,7 +760,7 @@ void AmazonEngine::dead(int deathId) {
 			_screen->_printOrg = Common::Point(15, 165);
 			_screen->_printStart = Common::Point(15, 165);
 
-			Common::String msg = Common::String(_deaths[deathId]._msg);
+			const Common::String &msg = _deaths[deathId]._msg;
 			_printEnd = 200;
 
 			printText(_screen, msg);
diff --git a/engines/access/bubble_box.cpp b/engines/access/bubble_box.cpp
index bb7e1d5e083..30699c239cd 100644
--- a/engines/access/bubble_box.cpp
+++ b/engines/access/bubble_box.cpp
@@ -761,7 +761,7 @@ void BubbleBox::getList(const char *const data[], int *flags) {
 	int destIdx = 0;
 	while (data[srcIdx]) {
 		if (flags[srcIdx]) {
-			_tempList[destIdx] = Common::String(data[srcIdx]);
+			_tempList[destIdx] = data[srcIdx];
 			_tempListIdx[destIdx] = srcIdx;
 			++destIdx;
 		}
diff --git a/engines/access/martian/martian_game.cpp b/engines/access/martian/martian_game.cpp
index 59d20b3b73c..469d7677b48 100644
--- a/engines/access/martian/martian_game.cpp
+++ b/engines/access/martian/martian_game.cpp
@@ -30,11 +30,10 @@ namespace Access {
 
 namespace Martian {
 
-MartianEngine::MartianEngine(OSystem *syst, const AccessGameDescription *gameDesc) : AccessEngine(syst, gameDesc) {
-	_skipStart = false;
-	_introObjects = nullptr;
-	_creditsStream = nullptr;
-	_spec7Objects = nullptr;
+MartianEngine::MartianEngine(OSystem *syst, const AccessGameDescription *gameDesc) :
+AccessEngine(syst, gameDesc), _skipStart(false), _introObjects(nullptr),
+_creditsStream(nullptr), _spec7Objects(nullptr)
+{
 }
 
 MartianEngine::~MartianEngine() {
@@ -63,15 +62,7 @@ void MartianEngine::initVariables() {
 	Common::fill(&_objectsTable[0], &_objectsTable[100], (SpriteResource *)nullptr);
 	_player->_playerOff = false;
 
-	// Setup timers
-	const int TIMER_DEFAULTS[] = { 4, 10, 8, 1, 1, 1, 1, 2 };
-	for (int i = 0; i < 32; ++i) {
-		TimerEntry te;
-		te._initTm = te._timer = (i < 8) ? TIMER_DEFAULTS[i] : 1;
-		te._flag = 1;
-
-		_timers.push_back(te);
-	}
+	setupTimers();
 
 	_player->_playerX = _player->_rawPlayer.x = _res->ROOMTBL[_player->_roomNumber]._travelPos.x;
 	_player->_playerY = _player->_rawPlayer.y = _res->ROOMTBL[_player->_roomNumber]._travelPos.y;
@@ -80,12 +71,10 @@ void MartianEngine::initVariables() {
 	_mouseMode = 0;
 	_numAnimTimers = 0;
 
-	for (int i = 0; i < 60; i++)
-		_travel[i] = 0;
+	ARRAYCLEAR(_travel);
 	_travel[7] = 1;
 
-	for (int i = 0; i < 40; i++)
-		_ask[i] = 0;
+	ARRAYCLEAR(_ask);
 	_ask[33] = 1;
 }
 
@@ -155,11 +144,7 @@ void MartianEngine::doSpecial5(int param1) {
 	notesRes->_stream->skip(param1 * 2);
 	int pos = notesRes->_stream->readUint16LE();
 	notesRes->_stream->seek(pos);
-	Common::String msg = "";
-	byte c;
-	while ((c = (char)notesRes->_stream->readByte()) != '\0')
-		msg += c;
-
+	Common::String msg = notesRes->_stream->readString();
 	displayNote(msg);
 
 	_midi->stopSong();
@@ -218,7 +203,7 @@ bool MartianEngine::showCredits() {
 	int posX = _creditsStream->readSint16LE();
 	int posY = 0;
 
-	while(posX != -1) {
+	while (posX != -1) {
 		posY = _creditsStream->readSint16LE();
 		int frameNum = _creditsStream->readSint16LE();
 		_screen->plotImage(_introObjects, frameNum, Common::Point(posX, posY));
@@ -283,15 +268,8 @@ void MartianEngine::doCredits() {
 	}
 }
 
-void MartianEngine::setupGame() {
-	// Load death list
-	_deaths.resize(_res->DEATHS.size());
-	for (uint idx = 0; idx < _deaths.size(); ++idx) {
-		_deaths[idx]._screenId = _res->DEATHS[idx]._screenId;
-		_deaths[idx]._msg = _res->DEATHS[idx]._msg;
-	}
-
-	// Setup timers
+void MartianEngine::setupTimers() {
+	_timers.clear();
 	const int TIMER_DEFAULTS[] = { 4, 10, 8, 1, 1, 1, 1, 2 };
 	for (int i = 0; i < 32; ++i) {
 		TimerEntry te;
@@ -300,6 +278,17 @@ void MartianEngine::setupGame() {
 
 		_timers.push_back(te);
 	}
+}
+
+void MartianEngine::setupGame() {
+	// Load death list
+	_deaths.resize(_res->DEATHS.size());
+	for (uint idx = 0; idx < _deaths.size(); ++idx) {
+		_deaths[idx]._screenId = _res->DEATHS[idx]._screenId;
+		_deaths[idx]._msg = _res->DEATHS[idx]._msg;
+	}
+
+	setupTimers();
 
 	// Miscellaneous
 	Martian::MartianResources &res = *((Martian::MartianResources *)_res);
diff --git a/engines/access/martian/martian_game.h b/engines/access/martian/martian_game.h
index f58b6688fb9..9c677aa42e4 100644
--- a/engines/access/martian/martian_game.h
+++ b/engines/access/martian/martian_game.h
@@ -48,6 +48,7 @@ private:
 	void initObjects();
 	void configSelect();
 	void initVariables();
+	void setupTimers();
 protected:
 	/**
 	 * Play the game
diff --git a/engines/access/scripts.cpp b/engines/access/scripts.cpp
index 75d86c4dc7b..ddb503aaa52 100644
--- a/engines/access/scripts.cpp
+++ b/engines/access/scripts.cpp
@@ -818,9 +818,9 @@ void Scripts::cmdTexSpeak() {
 		tmpStr += (char)v;
 
 	if (_vm->getGameID() == GType_MartianMemorandum)
-		_vm->_bubbleBox->_bubbleDisplStr = Common::String("TEX");
+		_vm->_bubbleBox->_bubbleDisplStr = "TEX";
 	else
-		_vm->_bubbleBox->_bubbleDisplStr = Common::String("JASON");
+		_vm->_bubbleBox->_bubbleDisplStr = "JASON";
 
 	_vm->_bubbleBox->placeBubble1(tmpStr);
 	findNull();
@@ -856,7 +856,7 @@ void Scripts::cmdTexChoice() {
 	_vm->_screen->_printStart = _texsOrg;
 
 	_vm->_bubbleBox->clearBubbles();
-	_vm->_bubbleBox->_bubbleDisplStr = Common::String("RESPONSE 1");
+	_vm->_bubbleBox->_bubbleDisplStr = "RESPONSE 1";
 
 	byte v;
 	Common::String tmpStr = "";
@@ -877,7 +877,7 @@ void Scripts::cmdTexChoice() {
 		tmpStr += (char)v;
 
 	if (tmpStr.size() != 0) {
-		_vm->_bubbleBox->_bubbleDisplStr = Common::String("RESPONSE 2");
+		_vm->_bubbleBox->_bubbleDisplStr = "RESPONSE 2";
 		_vm->_bubbleBox->calcBubble(tmpStr);
 		_vm->_bubbleBox->printBubble(tmpStr);
 		responseCoords.push_back(_vm->_bubbleBox->_bounds);
@@ -892,7 +892,7 @@ void Scripts::cmdTexChoice() {
 		tmpStr += (char)v;
 
 	if (tmpStr.size() != 0) {
-		_vm->_bubbleBox->_bubbleDisplStr = Common::String("RESPONSE 3");
+		_vm->_bubbleBox->_bubbleDisplStr = "RESPONSE 3";
 		_vm->_bubbleBox->calcBubble(tmpStr);
 		_vm->_bubbleBox->printBubble(tmpStr);
 		responseCoords.push_back(_vm->_bubbleBox->_bounds);


Commit: 342c9ad00f12b5c6d7345880b0db60cba02bbc4d
    https://github.com/scummvm/scummvm/commit/342c9ad00f12b5c6d7345880b0db60cba02bbc4d
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Fix rendering of initial MM notes after credits

To match the original:
* Embed corrected font data into MartianResources
* Update the word wrapping algorithm to match the original (max chars not max
  pixels)

Also embedded the mouse cursors so ACCESS.DAT file can be limited to items
which need to come from the EXE *and* change based on translation.

Changed paths:
    engines/access/amazon/amazon_resources.cpp
    engines/access/amazon/amazon_resources.h
    engines/access/bubble_box.cpp
    engines/access/events.cpp
    engines/access/font.cpp
    engines/access/font.h
    engines/access/martian/martian_game.cpp
    engines/access/martian/martian_resources.cpp
    engines/access/martian/martian_resources.h
    engines/access/resources.h
    engines/access/scripts.cpp


diff --git a/engines/access/amazon/amazon_resources.cpp b/engines/access/amazon/amazon_resources.cpp
index 86cad62bfaf..f69e6ef2a5b 100644
--- a/engines/access/amazon/amazon_resources.cpp
+++ b/engines/access/amazon/amazon_resources.cpp
@@ -89,6 +89,11 @@ void AmazonResources::load(Common::SeekableReadStream &s) {
 	_font6x6 = new AmazonFont(&index[0], &data[0]);
 }
 
+const byte *AmazonResources::getCursor(int num) const {
+	return CURSORS[num].data();
+}
+
+
 /*------------------------------------------------------------------------*/
 
 const int SIDEOFFR[] = { 5, 5, 5, 5, 5, 5, 5, 5, 0 };
diff --git a/engines/access/amazon/amazon_resources.h b/engines/access/amazon/amazon_resources.h
index 3c431339e6e..310aa4008a7 100644
--- a/engines/access/amazon/amazon_resources.h
+++ b/engines/access/amazon/amazon_resources.h
@@ -136,9 +136,15 @@ public:
 	Common::String BAR_MESSAGE;
 	Common::String HELPLVLTXT[3];
 	Common::String IQLABELS[9];
+
+private:
+	Common::Array< Common::Array<byte> > CURSORS;
+
 public:
 	AmazonResources(AccessEngine *vm) : Resources(vm), _font3x5(nullptr), _font6x6(nullptr) {}
 	~AmazonResources() override;
+
+	const byte *getCursor(int num) const override;
 };
 
 #define AMRES (*((Amazon::AmazonResources *)_vm->_res))
diff --git a/engines/access/bubble_box.cpp b/engines/access/bubble_box.cpp
index 30699c239cd..3f407a09fc9 100644
--- a/engines/access/bubble_box.cpp
+++ b/engines/access/bubble_box.cpp
@@ -117,7 +117,11 @@ void BubbleBox::calcBubble(const Common::String &msg) {
 	int width = 0;
 	bool lastLine;
 	do {
-		lastLine = _vm->_fonts._font2->getLine(s, screen._maxChars * 6, line, width);
+		if (_vm->getGameID() == GType_MartianMemorandum)
+			lastLine = _vm->_fonts._font2->getLine(s, screen._maxChars, line, width, Font::kWidthInChars);
+		else
+			lastLine = _vm->_fonts._font2->getLine(s, screen._maxChars * 6, line, width);
+
 		_vm->_fonts._printMaxX = MAX(width, _vm->_fonts._printMaxX);
 
 		screen._printOrg.y += 6;
@@ -173,7 +177,7 @@ void BubbleBox::printBubble_v1(const Common::String &msg) {
 	do {
 		// Get next line
 		Font &font2 = *_vm->_fonts._font2;
-		lastLine = font2.getLine(s, _vm->_screen->_maxChars * 6, line, width);
+		lastLine = font2.getLine(s, _vm->_screen->_maxChars, line, width, Font::kWidthInChars);
 		// Draw the text
 		printString(line);
 
@@ -336,7 +340,6 @@ void BubbleBox::setCursorPos(int posX, int posY) {
 }
 
 void BubbleBox::printString(Common::String msg) {
-	warning("TODO: Proper implementation of printString");
 	_vm->_fonts._font1->drawString(_vm->_screen, msg, _vm->_screen->_printOrg);
 }
 
diff --git a/engines/access/events.cpp b/engines/access/events.cpp
index 1e65ca51c6c..4d081d32286 100644
--- a/engines/access/events.cpp
+++ b/engines/access/events.cpp
@@ -72,7 +72,7 @@ void EventsManager::setCursor(CursorType cursorId) {
 		CursorMan.replaceCursor(_invCursor, _invCursor.w / 2, _invCursor.h / 2, 0);
 	} else {
 		// Get a pointer to the mouse data to use, and get the cursor hotspot
-		const byte *srcP = &_vm->_res->CURSORS[cursorId][0];
+		const byte *srcP = _vm->_res->getCursor(cursorId);
 		int hotspotX = (int16)READ_LE_UINT16(srcP);
 		int hotspotY = (int16)READ_LE_UINT16(srcP + 2);
 		srcP += 4;
diff --git a/engines/access/font.cpp b/engines/access/font.cpp
index d903b5f2f6d..3256f9630c7 100644
--- a/engines/access/font.cpp
+++ b/engines/access/font.cpp
@@ -49,7 +49,8 @@ int Font::stringWidth(const Common::String &msg) {
 	return total;
 }
 
-bool Font::getLine(Common::String &s, int maxWidth, Common::String &line, int &width) {
+bool Font::getLine(Common::String &s, int maxWidth, Common::String &line, int &width,
+				   LINE_WIDTH_TYPE widthType) {
 	assert(maxWidth > 0);
 	width = 0;
 	const char *src = s.c_str();
@@ -64,7 +65,7 @@ bool Font::getLine(Common::String &s, int maxWidth, Common::String &line, int &w
 		}
 
 		++src;
-		width += charWidth(c);
+		width += (widthType == kWidthInPixels ? charWidth(c) : 1);
 		if (width < maxWidth)
 			continue;
 
@@ -79,7 +80,7 @@ bool Font::getLine(Common::String &s, int maxWidth, Common::String &line, int &w
 		// Work backwards to find space at the start of the current word
 		// as a point to split the line on
 		while (src >= s.c_str() && *src != ' ') {
-			width -= charWidth(*src);
+			width -= (widthType == kWidthInPixels ? charWidth(*src) : 1);
 			--src;
 		}
 		if (src < s.c_str())
@@ -93,7 +94,7 @@ bool Font::getLine(Common::String &s, int maxWidth, Common::String &line, int &w
 
 	// Return entire string
 	line = s;
-	s = Common::String();
+	s.clear();
 	return true;
 }
 
@@ -171,10 +172,15 @@ void AmazonFont::load(const int *fontIndex, const byte *fontData) {
 
 MartianFont::MartianFont(int height, Common::SeekableReadStream &s) : Font(0) {
 	_height = height;
-	load(s);
+	loadFromStream(s);
 }
 
-void MartianFont::load(Common::SeekableReadStream &s) {
+MartianFont::MartianFont(int height, size_t count, const byte *widths, const int *offsets, const byte *data) : Font(0) {
+	_height = height;
+	loadFromData(count, widths, offsets, data);
+}
+
+void MartianFont::loadFromStream(Common::SeekableReadStream &s) {
 	// Get the number of characters and the size of the raw font data
 	size_t count = s.readUint16LE();
 	size_t dataSize = s.readUint16LE();
@@ -196,6 +202,10 @@ void MartianFont::load(Common::SeekableReadStream &s) {
 	data.resize(dataSize);
 	s.read(&data[0], dataSize);
 
+	loadFromData(count, widths.data(), offsets.data(), data.data());
+}
+
+void MartianFont::loadFromData(size_t count, const byte *widths, const int *offsets, const byte *data) {
 	// Iterate through decoding each character
 	_chars.resize(count);
 	for (size_t idx = 0; idx < count; ++idx) {
diff --git a/engines/access/font.h b/engines/access/font.h
index c9280e759a4..6cddeaa5721 100644
--- a/engines/access/font.h
+++ b/engines/access/font.h
@@ -66,15 +66,28 @@ public:
 	 */
 	int stringWidth(const Common::String &msg);
 
+	/**
+	 * Type of line wrapping - Martian wraps based on chars, Amazon based on px.
+	 *
+	 * Since the fonts are variable width we need to support both types to
+	 * exactly wrap like the originals.
+	 */
+	enum LINE_WIDTH_TYPE {
+		kWidthInPixels,
+		kWidthInChars
+	};
+
 	/**
 	 * Get a partial string that will fit in a given width
 	 * @param s			Source string. Modified to remove line
-	 * @param maxWidth	Maximum width allowed
+	 * @param maxWidth	Maximum width allowed in px or chars (see widthType)
 	 * @param line		Output line
-	 * @param width		Calculated width of returned line
+	 * @param width		Actual width of returned line in selected units
+	 * @param widthType Select the type of width constraint - px or chars
 	 * @returns			True if last line
 	 */
-	bool getLine(Common::String &s, int maxWidth, Common::String &line, int &width);
+	bool getLine(Common::String &s, int maxWidth, Common::String &line, int &width,
+				 LINE_WIDTH_TYPE widthType = kWidthInPixels);
 
 	/**
 	 * Draw a string on a given surface
@@ -109,12 +122,14 @@ private:
 	/**
 	 * Load the given font data
 	 */
-	void load(Common::SeekableReadStream &s);
+	void loadFromStream(Common::SeekableReadStream &s);
+	void loadFromData(size_t count, const byte *widths, const int *offsets, const byte *data);
 public:
 	/**
 	* Constructor
 	*/
 	MartianFont(int height, Common::SeekableReadStream &s);
+	MartianFont(int height, size_t count, const byte *widths, const int *offsets, const byte *data);
 };
 
 
diff --git a/engines/access/martian/martian_game.cpp b/engines/access/martian/martian_game.cpp
index 469d7677b48..b20c6771c47 100644
--- a/engines/access/martian/martian_game.cpp
+++ b/engines/access/martian/martian_game.cpp
@@ -107,7 +107,7 @@ void MartianEngine::displayNote(const Common::String &msg) {
 	int width = 0;
 	bool lastLine = false;
 	do {
-		lastLine = _fonts._font1->getLine(lines, _screen->_maxChars * 6, line, width);
+		lastLine = _fonts._font1->getLine(lines, _screen->_maxChars, line, width, Font::kWidthInChars);
 		_bubbleBox->printString(line);
 		_screen->_printOrg = Common::Point(_screen->_printStart.x, _screen->_printOrg.y + 6);
 
@@ -263,7 +263,7 @@ void MartianEngine::doCredits() {
 		while (!shouldQuit() && !_events->isKeyActionMousePressed()&& !showCredits())
 			_events->pollEventsAndWait();
 
-		warning("TODO: Free word_21E2B");
+		warning("TODO: Free word_21E2B (roomSprites+54h)");
 		_midi->freeMusic();
 	}
 }
@@ -292,7 +292,7 @@ void MartianEngine::setupGame() {
 
 	// Miscellaneous
 	Martian::MartianResources &res = *((Martian::MartianResources *)_res);
-	_fonts.load(res._font6x6, res._font3x5);
+	_fonts.load(res._font1, res._font2);
 
 	// Set player room and position
 	_player->_roomNumber = 7;
@@ -305,7 +305,7 @@ void MartianEngine::showDeathText(Common::String msg) {
 	int width = 0;
 	bool lastLine;
 	do {
-		lastLine = _fonts._font2->getLine(msg, _screen->_maxChars * 6, line, width);
+		lastLine = _fonts._font2->getLine(msg, _screen->_maxChars, line, width, Font::kWidthInChars);
 		// Draw the text
 		_bubbleBox->printString(line);
 
diff --git a/engines/access/martian/martian_resources.cpp b/engines/access/martian/martian_resources.cpp
index ec17b73f9eb..b72720e247b 100644
--- a/engines/access/martian/martian_resources.cpp
+++ b/engines/access/martian/martian_resources.cpp
@@ -26,31 +26,10 @@ namespace Access {
 
 namespace Martian {
 
-MartianResources::~MartianResources() {
-	delete _font6x6;
-	delete _font3x5;
-}
 
-void MartianResources::load(Common::SeekableReadStream &s) {
-	Resources::load(s);
-	uint count;
-
-	// Get the offset of the general shared data for the game
-	uint entryOffset = findEntry(_vm->getGameID(), 2, 0, (Common::Language)0);
-	s.seek(entryOffset);
-
-	// Read in the cursor list
-	count = s.readUint16LE();
-	CURSORS.resize(count);
-	for (uint idx = 0; idx < count; ++idx) {
-		uint count2 = s.readUint16LE();
-		CURSORS[idx].resize(count2);
-		s.read(&CURSORS[idx][0], count2);
-	}
-
-	// Load font data
-	_font6x6 = new MartianFont(6, s);
-	_font3x5 = new MartianFont(5, s);
+MartianResources::~MartianResources() {
+	delete _font1;
+	delete _font2;
 }
 
 /*------------------------------------------------------------------------*/
@@ -156,5 +135,191 @@ const int PICTURERANGE[][2] = {
 	{ -1, -1 }
 };
 
+static const byte FONT1_WIDTHS[] = {
+	0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+	0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+	0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+	0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+	0x5,  0x3,  0x4,  0x6,  0x5,  0x6,  0x6,  0x3,
+	0x4,  0x4,  0x5,  0x6,  0x3,  0x5,  0x3,  0x6,
+	0x6,  0x4,  0x6,  0x6,  0x6,  0x6,  0x6,  0x6,
+	0x6,  0x6,  0x6,  0x6,  0x6,  0x6,  0x6,  0x6,
+	0x6,  0x6,  0x6,  0x6,  0x6,  0x6,  0x6,  0x6,
+	0x6,  0x4,  0x6,  0x5,  0x5,  0x6,  0x6,  0x6,
+	0x6,  0x6,  0x6,  0x6,  0x6,  0x6,  0x6,  0x6,
+	0x6,  0x6,  0x6,  0x4,  0x6,  0x4,  0x4,  0x6,
+	0x3, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+	0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+	0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
+};
+
+static const byte FONT2_WIDTHS[] = {
+	0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+	0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+	0xFF, 0xFF,  0x5, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+	0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+	0x5,  0x3,  0x5,  0x6,  0x6,  0x5,  0x6,  0x3,
+	0x5,  0x5,  0x6,  0x5,  0x3,  0x5,  0x3,  0x5,
+	0x5,  0x5,  0x5,  0x5,  0x5,  0x5,  0x5,  0x5,
+	0x5,  0x5,  0x5,  0x5,  0x5,  0x5,  0x5,  0x5,
+	0x5,  0x5,  0x5,  0x5,  0x5,  0x5,  0x5,  0x5,
+	0x5,  0x5,  0x5,  0x5,  0x5,  0x7,  0x6,  0x5,
+	0x5,  0x5,  0x5,  0x5,  0x5,  0x5,  0x5,  0x7,
+	0x5,  0x5,  0x5,  0x4,  0x5,  0x4,  0x4,  0x5,
+	0x3, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+	0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+	0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
+};
+
+// Offsets into the data array for each char (starts at 0x4d13)
+static const int FONT1_OFFSETS[] = {
+	0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
+	0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
+	0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
+	0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
+	0x0, 0x2, 0xa, 0x12, 0x20, 0x37, 0x4e, 0x65,
+	0x6a, 0x75, 0x80, 0x97, 0x9f, 0xa4, 0xa9, 0xae,
+	0xbf, 0xd6, 0xe1, 0xf2, 0x103, 0x10e, 0x11f, 0x130,
+	0x13e, 0x155, 0x166, 0x16e, 0x176, 0x187, 0x18f, 0x1a0,
+	0x1b1, 0x1c2, 0x1d0, 0x1e4, 0x1ef, 0x1fd, 0x20b, 0x216,
+	0x227, 0x232, 0x23d, 0x24b, 0x25f, 0x267, 0x278, 0x289,
+	0x297, 0x2a5, 0x2b6, 0x2ca, 0x2db, 0x2e3, 0x2ee, 0x2ff,
+	0x310, 0x32d, 0x33e, 0x34f, 0x35a, 0x36b, 0x376, 0x381,
+	0x386, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
+	0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
+	0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
+};
+
+// Offsets into the data array for each char (starts at 0x485d)
+static const int FONT2_OFFSETS[] = {
+	0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
+	0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
+	0x0, 0x0, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0,
+	0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
+	0x0, 0x13, 0x1b, 0x23, 0x31, 0x48, 0x59, 0x70,
+	0x75, 0x80, 0x8b, 0xa2, 0xaa, 0xaf, 0xb4, 0xb9,
+	0xc4, 0xd2, 0xdd, 0xee, 0xff, 0x10a, 0x11b, 0x12c,
+	0x137, 0x14e, 0x15f, 0x167, 0x16f, 0x180, 0x188, 0x199,
+	0x1a7, 0x1b5, 0x1c3, 0x1d7, 0x1e2, 0x1f0, 0x1fe, 0x209,
+	0x217, 0x222, 0x22d, 0x238, 0x246,0x24e, 0x25f, 0x26d,
+	0x27b, 0x289, 0x29a, 0x2ab,0x2bc, 0x2c4, 0x2cf, 0x2dd,
+	0x2ee, 0x2ff, 0x30a,0x31b, 0x326, 0x331, 0x33c, 0x347,
+	0x34c, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
+	0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
+	0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
+};
+
+static const byte FONT1_DATA[] = {
+	0xFF, 0xFF, 0x01, 0x01, 0x05, 0xFF, 0x01, 0x01, 0x03, 0xFF, 0xFF, 0x01, 0x01, 0x02, 0x03, 0x01, 0x02, 0xFF, 0x01, 0x05, 0x02, 0x01, 0x05, 0x04, 0xFF, 0x02, 0x01, 0x05, 0x04, 0x01, 0x05, 0xFF, 0x02, 0x02, 0x00, 0x02, 0x04, 0x01, 0x01, 0x01, 0x02, 0x02, 0x03, 0x03, 0x04, 0x04, 0x04, 0x01, 0x03, 0x05, 0x02, 0x02, 0x06, 0xFF, 0xFF, 0x01, 0x01, 0x01, 0x05, 0x05, 0x01, 0x04, 0x04, 0x02, 0x03, 0x03, 0x03, 0x02, 0x02, 0x04, 0x01, 0x01, 0x05, 0x05, 0x05, 0x05, 0xFF, 0xFF, 0x02, 0x03, 0x01, 0x02, 0x03, 0x02, 0x04, 0x04, 0x02, 0x03, 0x03, 0x04, 0x02, 0x04, 0x05, 0xFF, 0x01, 0x03, 0x04, 0x04, 0x03, 0x04, 0xFF, 0xFF, 0x01, 0x01, 0x02, 0xFF, 0x02, 0x02, 0x01, 0x02, 0x02, 0x05, 0xFF, 0x01, 0x02, 0x04, 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x05, 0xFF, 0x02, 0x02, 0x04, 0xFF, 0x01, 0x01, 0x01, 0x04, 0x04, 0x01, 0x01, 0x04, 0x03, 0x01, 0x01, 0x05, 0x04, 0x04, 0x05, 0xFF, 0x02, 0x02, 0x04, 0x03, 0x02, 0x04, 0xFF, 0x01, 0x05, 0x03, 0xFF, 0x03, 0x01, 0x05, 0xFF, 0xFF, 0x01, 0x05, 0x06, 0xFF, 0x02, 0x04, 0x03, 0xFF, 0xFF, 0x01, 0x02, 0x05, 0xFF, 0xFF, 0x01, 0x01, 0x05, 0x02, 0x02, 0x04, 0x03, 0x03, 0x03, 0x04, 0x04, 0x02, 0x05, 0x05, 0x01, 0xFF, 0xFF, 0x02, 0x04, 0x01, 0x02, 0x04, 0x05, 0x02, 0x02, 0x04, 0x03, 0x03, 0x03, 0x04, 0x04, 0x02, 0xFF, 0x01, 0x02, 0x04, 0x05, 0x02, 0x04, 0xFF, 0x01, 0x01, 0x02, 0x01, 0x03, 0x05, 0xFF, 0x02, 0x01, 0x04, 0xFF, 0x01, 0x04, 0x01, 0x05, 0x05, 0x02, 0x03, 0x04, 0x03, 0x02, 0x02, 0x04, 0x01, 0x05, 0x05, 0xFF, 0xFF, 0x01, 0x04, 0x01, 0x05, 0x05, 0x02, 0x02, 0x04, 0x03, 0x05, 0x05, 0x04, 0x01, 0x04, 0x05, 0xFF, 0xFF, 0x01, 0x01, 0x02, 0x01, 0x05, 0x03, 0xFF, 0x04, 0x01, 0x05, 0xFF, 0x02, 0x05, 0x01, 0x02, 0x04, 0x03, 0x05, 0x05, 0x04, 0x01, 0x04, 0x05, 0xFF, 0x01, 0x01, 0x03, 0xFF, 0x02, 0x05, 0x01, 0x02, 0x04, 0x03, 0x05, 0x05, 0x04, 0x02, 0x04, 0x05, 0xFF, 0x01, 0x02, 0x04, 0xFF, 0x01, 0x05, 0x01, 0x05, 0x05, 0x02, 0x04, 0x04, 0x03, 0xFF, 0x03, 0x04, 0x05, 0xFF, 0x02, 0x04, 0x01, 0x01, 0x01, 0x02, 0x05, 0x05, 0x02, 0x02, 0x04, 0x03, 0x01, 0x01, 0x04, 0x05, 0x05, 0x04, 0x02, 0x04, 0x05, 0xFF, 0xFF, 0x02, 0x04, 0x01, 0x01, 0x01, 0x02, 0x02, 0x04, 0x03, 0x01, 0x04, 0x05, 0xFF, 0x05, 0x02, 0x04, 0xFF, 0x01, 0x01, 0x02, 0x01, 0x01, 0x04, 0xFF, 0xFF, 0x01, 0x01, 0x02, 0xFF, 0x01, 0x04, 0x05, 0xFF, 0x03, 0x03, 0x01, 0x02, 0x02, 0x02, 0x01, 0x01, 0x03, 0x02, 0x02, 0x04, 0x03, 0x03, 0x05, 0xFF, 0xFF, 0x01, 0x04, 0x02, 0x01, 0x04, 0x04, 0xFF, 0xFF, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x03, 0x03, 0x03, 0x02, 0x02, 0x04, 0x01, 0x01, 0x05, 0xFF, 0xFF, 0x02, 0x03, 0x01, 0x01, 0x01, 0x02, 0x03, 0x03, 0x04, 0x03, 0x03, 0x06, 0xFF, 0x04, 0x02, 0x03, 0xFF, 0x02, 0x04, 0x01, 0x05, 0x05, 0x02, 0x04, 0x05, 0x03, 0x02, 0x04, 0x05, 0xFF, 0x01, 0x02, 0x04, 0xFF, 0x02, 0x04, 0x01, 0x02, 0x04, 0x04, 0xFF, 0x01, 0x02, 0x05, 0x05, 0x02, 0x05, 0xFF, 0x02, 0x04, 0x01, 0x05, 0x05, 0x02, 0x02, 0x04, 0x03, 0x05, 0x05, 0x04, 0x02, 0x04, 0x05, 0xFF, 0x01, 0x01, 0x05, 0xFF, 0x02, 0x05, 0x01, 0x02, 0x05, 0x05, 0xFF, 0x01, 0x02, 0x04, 0xFF, 0x02, 0x04, 0x01, 0x02, 0x04, 0x05, 0xFF, 0x01, 0x01, 0x05, 0x05, 0x02, 0x04, 0xFF, 0x02, 0x05, 0x01, 0x02, 0x03, 0x03, 0x02, 0x05, 0x05, 0xFF, 0x01, 0x01, 0x05, 0xFF, 0x02, 0x05, 0x01, 0x02, 0x03, 0x03, 0xFF, 0x01, 0x01, 0x05, 0xFF, 0x02, 0x05, 0x01, 0x04, 0x05, 0x03, 0x02, 0x04, 0x05, 0xFF, 0x01, 0x02, 0x04, 0x05, 0x03, 0x04, 0xFF, 0x02, 0x04, 0x03, 0xFF, 0x01, 0x01, 0x05, 0x05, 0x01, 0x05, 0xFF, 0x01, 0x03, 0x01, 0x01, 0x03, 0x05, 0xFF, 0x02, 0x04, 0x02, 0xFF, 0x03, 0x05, 0x01, 0x01, 0x01, 0x04, 0x02, 0x03, 0x05, 0xFF, 0x04, 0x02, 0x04, 0xFF, 0x04, 0x04, 0x01, 0x03, 0x03, 0x02, 0x02, 0x02, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x05, 0xFF, 0x01, 0x01, 0x05, 0xFF, 0x02, 0x04, 0x05, 0xFF, 0x01, 0x01, 0x05, 0xFF, 0x02, 0x02, 0x02, 0x04, 0x04, 0x02, 0x03, 0x03, 0x03, 0xFF, 0x01, 0x01, 0x05, 0x05, 0x01, 0x05, 0xFF, 0x02, 0x02, 0x02, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0xFF, 0x01, 0x01, 0x05, 0x05, 0x01, 0x05, 0xFF, 0x02, 0x04, 0x01, 0x02, 0x04, 0x05, 0xFF, 0x01, 0x02, 0x04, 0x05, 0x02, 0x04, 0xFF, 0x02, 0x04, 0x01, 0x05, 0x05, 0x02, 0x02, 0x04, 0x03, 0xFF, 0x01, 0x01, 0x05, 0xFF, 0x02, 0x04, 0x01, 0x03, 0x03, 0x04, 0x02, 0x04, 0x05, 0xFF, 0x01, 0x02, 0x04, 0x05, 0x02, 0x06, 0xFF, 0x02, 0x04, 0x01, 0x05, 0x05, 0x02, 0x02, 0x04, 0x03, 0x04, 0x04, 0x04, 0x05, 0x05, 0x05, 0xFF, 0x01, 0x01, 0x05, 0xFF, 0x02, 0x04, 0x01, 0x01, 0x01, 0x02, 0x02, 0x04, 0x03, 0x05, 0x05, 0x04, 0x02, 0x04, 0x05, 0xFF, 0xFF, 0x01, 0x05, 0x01, 0xFF, 0x03, 0x02, 0x05, 0xFF, 0x02, 0x04, 0x05, 0xFF, 0x01, 0x01, 0x04, 0x05, 0x01, 0x04, 0xFF, 0x02, 0x02, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x05, 0xFF, 0x01, 0x01, 0x03, 0x05, 0x01, 0x03, 0xFF, 0x03, 0x03, 0x03, 0x02, 0x02, 0x04, 0x04, 0x04, 0x04, 0xFF, 0x01, 0x01, 0x05, 0x05, 0x01, 0x05, 0xFF, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x05, 0x05, 0x05, 0x01, 0x01, 0x05, 0x02, 0x02, 0x04, 0x04, 0x04, 0x02, 0x05, 0x05, 0x01, 0xFF, 0xFF, 0x02, 0x02, 0x03, 0x04, 0x04, 0x03, 0xFF, 0x01, 0x01, 0x02, 0x05, 0x01, 0x02, 0x03, 0x04, 0x05, 0xFF, 0x01, 0x05, 0x01, 0x04, 0x04, 0x02, 0x03, 0x03, 0x03, 0x02, 0x02, 0x04, 0x01, 0x05, 0x05, 0xFF, 0xFF, 0x02, 0x03, 0x01, 0x02, 0x03, 0x05, 0xFF, 0x01, 0x01, 0x05, 0xFF, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x05, 0x05, 0x05, 0xFF, 0xFF, 0x01, 0x02, 0x01, 0x01, 0x02, 0x05, 0xFF, 0x02, 0x01, 0x05, 0xFF, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02, 0x03, 0x03, 0x02, 0xFF, 0xFF, 0x01, 0x05, 0x05, 0xFF, 0xFF, 0xFF, 0x01, 0x01, 0x02, 0xFF
+};
+
+static const byte FONT2_DATA[] = {
+	0xFF, 0xFF, 0x01, 0x03, 0x01, 0x00, 0x04, 0x02, 0x00, 0x04, 0x06, 0x01, 0x03, 0x07, 0xFF, 0x02, 0x00, 0x08, 0xFF, 0x01, 0x01, 0x05, 0xFF, 0x01, 0x01, 0x03, 0xFF, 0xFF, 0x01, 0x01, 0x02, 0x03, 0x01, 0x02, 0xFF, 0x01, 0x05, 0x02, 0x01, 0x05, 0x04, 0xFF, 0x02, 0x01, 0x05, 0x04, 0x01, 0x05, 0xFF, 0x02, 0x02, 0x00, 0x02, 0x04, 0x01, 0x01, 0x01, 0x02, 0x02, 0x03, 0x03, 0x04, 0x04, 0x04, 0x01, 0x03, 0x05, 0x02, 0x02, 0x06, 0xFF, 0xFF, 0x01, 0x01, 0x01, 0x02, 0x02, 0x03, 0x03, 0x03, 0x05, 0xFF, 0x01, 0x04, 0x05, 0x03, 0x01, 0x02, 0xFF, 0x02, 0x03, 0x01, 0x02, 0x03, 0x02, 0x04, 0x04, 0x02, 0x03, 0x03, 0x04, 0x02, 0x04, 0x05, 0xFF, 0x01, 0x03, 0x04, 0x04, 0x03, 0x04, 0xFF, 0xFF, 0x01, 0x01, 0x02, 0xFF, 0x02, 0x02, 0x01, 0x02, 0x02, 0x05, 0xFF, 0x01, 0x02, 0x04, 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x05, 0xFF, 0x02, 0x02, 0x04, 0xFF, 0x01, 0x01, 0x01, 0x04, 0x04, 0x01, 0x01, 0x04, 0x03, 0x01, 0x01, 0x05, 0x04, 0x04, 0x05, 0xFF, 0x02, 0x02, 0x04, 0x03, 0x02, 0x04, 0xFF, 0x01, 0x03, 0x03, 0xFF, 0x02, 0x02, 0x04, 0xFF, 0xFF, 0x01, 0x05, 0x06, 0xFF, 0x01, 0x03, 0x03, 0xFF, 0xFF, 0x01, 0x02, 0x05, 0xFF, 0xFF, 0x02, 0x02, 0x03, 0xFF, 0x01, 0x04, 0x05, 0x03, 0x01, 0x02, 0xFF, 0x02, 0x02, 0x01, 0x02, 0x02, 0x05, 0xFF, 0x01, 0x02, 0x04, 0x03, 0x02, 0x04, 0xFF, 0x01, 0x01, 0x02, 0x01, 0x03, 0x05, 0xFF, 0x02, 0x01, 0x04, 0xFF, 0x01, 0x02, 0x01, 0x03, 0x03, 0x02, 0x02, 0x02, 0x03, 0x01, 0x01, 0x04, 0x01, 0x03, 0x05, 0xFF, 0xFF, 0x01, 0x02, 0x01, 0x03, 0x03, 0x02, 0x02, 0x02, 0x03, 0x03, 0x03, 0x04, 0x01, 0x02, 0x05, 0xFF, 0xFF, 0x01, 0x01, 0x02, 0x01, 0x03, 0x03, 0xFF, 0x03, 0x01, 0x05, 0xFF, 0x01, 0x03, 0x01, 0x01, 0x01, 0x02, 0x01, 0x02, 0x03, 0x03, 0x03, 0x04, 0x01, 0x02, 0x05, 0xFF, 0xFF, 0x02, 0x03, 0x01, 0x02, 0x02, 0x03, 0x03, 0x03, 0x04, 0x02, 0x02, 0x05, 0xFF, 0x01, 0x02, 0x04, 0xFF, 0x01, 0x03, 0x01, 0x03, 0x03, 0x02, 0xFF, 0x02, 0x03, 0x05, 0xFF, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02, 0x03, 0x03, 0x02, 0x02, 0x02, 0x03, 0x01, 0x01, 0x04, 0x03, 0x03, 0x04, 0x02, 0x02, 0x05, 0xFF, 0xFF, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x03, 0x01, 0x02, 0x05, 0xFF, 0x03, 0x02, 0x04, 0xFF, 0x01, 0x01, 0x02, 0x01, 0x01, 0x04, 0xFF, 0xFF, 0x01, 0x01, 0x02, 0xFF, 0x01, 0x04, 0x05, 0xFF, 0x03, 0x03, 0x01, 0x02, 0x02, 0x02, 0x01, 0x01, 0x03, 0x02, 0x02, 0x04, 0x03, 0x03, 0x05, 0xFF, 0xFF, 0x01, 0x03, 0x02, 0x01, 0x03, 0x04, 0xFF, 0xFF, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x03, 0x03, 0x03, 0x02, 0x02, 0x04, 0x01, 0x01, 0x05, 0xFF, 0xFF, 0x01, 0x02, 0x01, 0x03, 0x03, 0x02, 0x02, 0x02, 0x03, 0x02, 0x02, 0x05, 0xFF, 0xFF, 0x02, 0x02, 0x01, 0x02, 0x03, 0x05, 0xFF, 0x01, 0x02, 0x04, 0x03, 0x02, 0x03, 0xFF, 0x02, 0x02, 0x01, 0x02, 0x02, 0x04, 0xFF, 0x01, 0x02, 0x05, 0x03, 0x02, 0x05, 0xFF, 0x02, 0x02, 0x01, 0x03, 0x03, 0x02, 0x02, 0x02, 0x03, 0x03, 0x03, 0x04, 0x02, 0x02, 0x05, 0xFF, 0x01, 0x01, 0x05, 0xFF, 0x02, 0x03, 0x01, 0x02, 0x03, 0x05, 0xFF, 0x01, 0x02, 0x04, 0xFF, 0x02, 0x02, 0x01, 0x02, 0x02, 0x05, 0xFF, 0x01, 0x01, 0x05, 0x03, 0x02, 0x04, 0xFF, 0x02, 0x03, 0x01, 0x02, 0x02, 0x03, 0x02, 0x03, 0x05, 0xFF, 0x01, 0x01, 0x05, 0xFF, 0x02, 0x03, 0x01, 0x02, 0x02, 0x03, 0xFF, 0x01, 0x01, 0x05, 0xFF, 0x02, 0x03, 0x01, 0x03, 0x03, 0x04, 0x02, 0x03, 0x05, 0xFF, 0x01, 0x02, 0x04, 0xFF, 0x02, 0x02, 0x03, 0xFF, 0x01, 0x01, 0x05, 0x03, 0x01, 0x05, 0xFF, 0x01, 0x03, 0x01, 0x01, 0x03, 0x05, 0xFF, 0x02, 0x04, 0x02, 0xFF, 0x01, 0x01, 0x04, 0x02, 0x02, 0x05, 0xFF, 0x03, 0x01, 0x04, 0xFF, 0x02, 0x02, 0x03, 0xFF, 0x01, 0x01, 0x05, 0x03, 0x01, 0x02, 0x03, 0x04, 0x05, 0xFF, 0x02, 0x03, 0x05, 0xFF, 0x01, 0x01, 0x05, 0xFF, 0x02, 0x02, 0x02, 0x04, 0x04, 0x02, 0x03, 0x03, 0x03, 0xFF, 0x01, 0x01, 0x05, 0x05, 0x01, 0x05, 0xFF, 0x02, 0x02, 0x02, 0x03, 0x03, 0x03, 0xFF, 0x01, 0x01, 0x05, 0x04, 0x01, 0x05, 0xFF, 0x02, 0x02, 0x01, 0x02, 0x02, 0x05, 0xFF, 0x01, 0x02, 0x04, 0x03, 0x02, 0x04, 0xFF, 0x02, 0x02, 0x01, 0x03, 0x03, 0x02, 0x02, 0x02, 0x03, 0xFF, 0x01, 0x01, 0x05, 0xFF, 0x02, 0x02, 0x01, 0x01, 0x03, 0x04, 0x02, 0x03, 0x05, 0xFF, 0x01, 0x02, 0x03, 0x03, 0x02, 0x03, 0xFF, 0x02, 0x02, 0x01, 0x03, 0x03, 0x02, 0x02, 0x02, 0x03, 0xFF, 0x01, 0x01, 0x05, 0x03, 0x04, 0x05, 0xFF, 0x02, 0x03, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x03, 0x03, 0x03, 0x04, 0x02, 0x03, 0x05, 0xFF, 0xFF, 0x01, 0x03, 0x01, 0xFF, 0x02, 0x02, 0x05, 0xFF, 0x02, 0x02, 0x05, 0xFF, 0x01, 0x01, 0x04, 0x03, 0x01, 0x04, 0xFF, 0x02, 0x02, 0x04, 0x02, 0x02, 0x05, 0xFF, 0x01, 0x01, 0x03, 0x03, 0x01, 0x03, 0xFF, 0x03, 0x03, 0x03, 0x02, 0x02, 0x04, 0x04, 0x04, 0x04, 0xFF, 0x01, 0x01, 0x05, 0x05, 0x01, 0x05, 0xFF, 0x02, 0x02, 0x03, 0xFF, 0x01, 0x01, 0x02, 0x01, 0x04, 0x05, 0x03, 0x01, 0x02, 0x03, 0x04, 0x05, 0xFF, 0xFF, 0x01, 0x01, 0x02, 0x03, 0x01, 0x02, 0x02, 0x03, 0x05, 0xFF, 0x01, 0x03, 0x01, 0x03, 0x03, 0x02, 0x02, 0x02, 0x03, 0x01, 0x01, 0x04, 0x01, 0x03, 0x05, 0xFF, 0xFF, 0x02, 0x03, 0x01, 0x02, 0x03, 0x05, 0xFF, 0x01, 0x01, 0x05, 0xFF, 0x02, 0x02, 0x03, 0xFF, 0x01, 0x01, 0x02, 0x03, 0x04, 0x05, 0xFF, 0x01, 0x02, 0x01, 0x01, 0x02, 0x05, 0xFF, 0x02, 0x01, 0x05, 0xFF, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02, 0x03, 0x03, 0x02, 0xFF, 0xFF, 0x01, 0x05, 0x05, 0xFF, 0xFF, 0xFF, 0x01, 0x01, 0x02, 0xFF
+};
+
+
+static const byte CURSOR_1_DATA[] = {
+	0x0,  0x0,  0x0,  0x0,  0x0,  0x2,  0xF7, 0x5,
+	0x0,  0x3,  0xF7, 0xF7, 0x5,  0x0,  0x3,  0xF7,
+	0xF7, 0x5,  0x0,  0x4,  0xF7, 0xF7, 0xF7, 0x5,
+	0x0,  0x4,  0xF7, 0xF7, 0xF7, 0x5,  0x0,  0x5,
+	0xF7, 0xF7, 0xF7, 0xF7, 0x5,  0x0,  0x5,  0xF7,
+	0xF7, 0xF7, 0xF7, 0x5,  0x0,  0x6,  0xF7, 0xF7,
+	0xF7, 0xF7, 0xF7, 0x5,  0x0,  0x6,  0xF7, 0xF7,
+	0xF7, 0xF7, 0xF7, 0x5,  0x0,  0x7,  0xF7, 0xF7,
+	0xF7, 0xF7, 0xF7, 0xF7, 0x5,  0x0,  0x6,  0xF7,
+	0xF7, 0xF7, 0xF7, 0xF7, 0x5,  0x0,  0x5,  0xF7,
+	0xF7, 0xF7, 0xF7, 0x5,  0x2,  0x3,  0xF7, 0xF7,
+	0x5,  0x3,  0x3,  0xF7, 0xF7, 0x5,  0x3,  0x3,
+	0xF7, 0xF7, 0x5,  0x4,  0x2,  0xF7, 0x5
+};
+
+static const byte CURSOR_2_DATA[] = {
+	0x7,  0x0,  0x7,  0x0,  0x6,  0x1,  0xF7, 0x4,
+	0x5,  0xFF, 0xFF, 0x0,  0xFF, 0xFF, 0x3,  0x7,
+	0xFF, 0x0,  0x0,  0x0,  0x0,  0x0,  0xFF, 0x2,
+	0x9,  0xFF, 0x0,  0x0,  0x0,  0xF7, 0x0,  0x0,
+	0x0,  0xFF, 0x1,  0xB,  0xFF, 0x0,  0x0,  0x0,
+	0x0,  0x0,  0x0,  0x0,  0x0,  0x0,  0xFF, 0x1,
+	0xB,  0xFF, 0x0,  0x0,  0x0,  0x0,  0xF7, 0x0,
+	0x0,  0x0,  0x0,  0xFF, 0x0,  0xD,  0xF7, 0x0,
+	0x0,  0xF7, 0x0,  0xF7, 0x0,  0xF7, 0x0,  0xF7,
+	0x0,  0x0,  0xF7, 0x1,  0xB,  0xFF, 0x0,  0x0,
+	0x0,  0x0,  0xF7, 0x0,  0x0,  0x0,  0x0,  0xFF,
+	0x1,  0xB,  0xFF, 0x0,  0x0,  0x0,  0x0,  0x0,
+	0x0,  0x0,  0x0,  0x0,  0xFF, 0x2,  0x9,  0xFF,
+	0x0,  0x0,  0x0,  0xF7, 0x0,  0x0,  0x0,  0xFF,
+	0x3,  0x7,  0xFF, 0x0,  0x0,  0x0,  0x0,  0x0,
+	0xFF, 0x4,  0x5,  0xFF, 0xFF, 0x0,  0xFF, 0xFF,
+	0x6,  0x1,  0xF7, 0x0,  0x0,  0x0,  0x0,  0x0,
+	0x0
+};
+
+static const byte CURSOR_3_DATA[] = {
+	0x8,  0x0,  0x8,  0x0,  0x0,  0x0,  0x0,  0x0,
+	0x7,  0x2,  0x4,  0x5,  0x7,  0x2,  0x4,  0x5,
+	0x7,  0x2,  0x4,  0x5,  0x7,  0x2,  0x4,  0x5,
+	0x7,  0x2,  0x4,  0x5,  0x2,  0xC,  0x4,  0x4,
+	0x4,  0x4,  0x4,  0x0,  0x4,  0x4,  0x4,  0x4,
+	0x4,  0x5,  0x7,  0x2,  0x4,  0x5,  0x7,  0x2,
+	0x4,  0x5,  0x7,  0x2,  0x4,  0x5,  0x7,  0x2,
+	0x4,  0x5,  0x7,  0x2,  0x4,  0x5,  0x0,  0x0,
+	0x0,  0x0,  0x0,  0x0
+};
+
+static const byte CURSOR_4_DATA[] = {
+	0x0,  0x0,  0x0,  0x0,  0x0,  0xB,  0x6,  0x6,
+	0x6,  0x6,  0x6,  0x6,  0x6,  0x6,  0x6,  0x6,
+	0x6,  0x0,  0xC,  0x6,  0x7,  0x7,  0x7,  0x7,
+	0x7,  0x7,  0x7,  0x7,  0x6,  0x6,  0x5,  0x0,
+	0xC,  0x6,  0x7,  0x7,  0x7,  0x7,  0x7,  0x7,
+	0x7,  0x7,  0x6,  0x5,  0x5,  0x0,  0xC,  0x6,
+	0x6,  0x6,  0x6,  0x6,  0x6,  0x6,  0x6,  0x6,
+	0x6,  0x6,  0x5,  0x0,  0xC,  0x6,  0x6,  0x6,
+	0x6,  0x6,  0x5,  0x6,  0x6,  0x6,  0x6,  0x6,
+	0x5,  0x0,  0xC,  0x6,  0x6,  0x6,  0x6,  0x5,
+	0x0,  0x0,  0x6,  0x6,  0x6,  0x6,  0x5,  0x0,
+	0xC,  0x6,  0x6,  0x6,  0x6,  0x6,  0x0,  0x6,
+	0x6,  0x6,  0x6,  0x6,  0x5,  0x0,  0xC,  0x6,
+	0x6,  0x6,  0x6,  0x6,  0x6,  0x6,  0x6,  0x6,
+	0x6,  0x6,  0x5,  0x0,  0xC,  0x6,  0x6,  0x6,
+	0x6,  0x6,  0x6,  0x6,  0x6,  0x6,  0x6,  0x6,
+	0x5,  0x0,  0xC,  0x6,  0x6,  0x6,  0x6,  0x6,
+	0x5,  0x6,  0x6,  0x6,  0x6,  0x6,  0x5,  0x0,
+	0xC,  0x6,  0x6,  0x6,  0x6,  0x6,  0x5,  0x6,
+	0x6,  0x6,  0x6,  0x6,  0x5,  0x0,  0xC,  0x6,
+	0x6,  0x6,  0x6,  0x6,  0x6,  0x6,  0x6,  0x6,
+	0x6,  0x6,  0x5,  0x1,  0xB,  0x5,  0x5,  0x5,
+	0x5,  0x5,  0x5,  0x5,  0x5,  0x5,  0x5,  0x5,
+	0x0,  0x0,  0x0,  0x0,  0x0,  0x0
+};
+
+
+static const byte *CURSOR_DATA[] =
+{
+	CURSOR_1_DATA,
+	CURSOR_2_DATA,
+	CURSOR_3_DATA,
+	CURSOR_4_DATA,
+};
+
+
+void MartianResources::load(Common::SeekableReadStream &s) {
+	Resources::load(s);
+
+	// Create the fonts from static data.
+	_font1 = new MartianFont(6, ARRAYSIZE(FONT1_WIDTHS), FONT1_WIDTHS, FONT1_OFFSETS, FONT1_DATA);
+	_font2 = new MartianFont(5, ARRAYSIZE(FONT2_WIDTHS), FONT2_WIDTHS, FONT2_OFFSETS, FONT2_DATA);
+}
+
+const byte *MartianResources::getCursor(int num) const {
+	assert(num < ARRAYSIZE(CURSOR_DATA) && num >= 0);
+
+	return CURSOR_DATA[num];
+}
+
+
+
+
 } // End of namespace Martian
 } // End of namespace Access
diff --git a/engines/access/martian/martian_resources.h b/engines/access/martian/martian_resources.h
index 3d2c62d5b51..027f99a28e3 100644
--- a/engines/access/martian/martian_resources.h
+++ b/engines/access/martian/martian_resources.h
@@ -61,11 +61,13 @@ protected:
 	 */
 	void load(Common::SeekableReadStream &s) override;
 public:
-	MartianFont *_font6x6;
-	MartianFont *_font3x5;
+	MartianFont *_font1;
+	MartianFont *_font2;
 public:
-	MartianResources(AccessEngine *vm) : Resources(vm), _font6x6(nullptr), _font3x5(nullptr) {}
+	MartianResources(AccessEngine *vm) : Resources(vm), _font1(nullptr), _font2(nullptr) {}
 	~MartianResources() override;
+
+	const byte *getCursor(int num) const override;
 };
 
 #define MMRES (*((Martian::MartianResources *)_vm->_res))
diff --git a/engines/access/resources.h b/engines/access/resources.h
index 6b290b0b8ef..955a6b62871 100644
--- a/engines/access/resources.h
+++ b/engines/access/resources.h
@@ -86,7 +86,6 @@ public:
 	Common::Array<RoomEntry> ROOMTBL;
 	Common::Array<DeathEntry> DEATHS;
 	Common::Array<InventoryEntry> INVENTORY;
-	Common::Array< Common::Array<byte> > CURSORS;
 	Common::String CANT_GET_THERE;
 public:
 	Resources(AccessEngine *vm) : _vm(vm) {}
@@ -97,6 +96,11 @@ public:
 	 * Load the access.dat file
 	 */
 	bool load(Common::U32String &errorMessage);
+
+	/**
+	 * Get the raw data for the given cursor number
+	 */
+	virtual const byte *getCursor(int num) const = 0;
 };
 
 } // End of namespace Access
diff --git a/engines/access/scripts.cpp b/engines/access/scripts.cpp
index ddb503aaa52..89299ff6d6f 100644
--- a/engines/access/scripts.cpp
+++ b/engines/access/scripts.cpp
@@ -203,7 +203,10 @@ void Scripts::printWatch() {
 	int width = 0;
 	bool lastLine;
 	do {
-		lastLine = _vm->_fonts._font2->getLine(msg, _vm->_screen->_maxChars * 6, line, width);
+		if (_vm->getGameID() == GType_MartianMemorandum)
+			lastLine = _vm->_fonts._font2->getLine(msg, _vm->_screen->_maxChars, line, width, Font::kWidthInChars);
+		else
+			lastLine = _vm->_fonts._font2->getLine(msg, _vm->_screen->_maxChars * 6, line, width);
 		// Draw the text
 		_vm->_bubbleBox->printString(line);
 


Commit: 3dba04cf4d3968ce674cfef0563dd06979f8364f
    https://github.com/scummvm/scummvm/commit/3dba04cf4d3968ce674cfef0563dd06979f8364f
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Correct overlapping MM variable initialization

The mystery variables being initialized on room entry are not unique to MM, but
just part of the engine variables (aka flags).

Changed paths:
    engines/access/martian/martian_game.cpp
    engines/access/martian/martian_room.cpp
    engines/access/martian/martian_room.h


diff --git a/engines/access/martian/martian_game.cpp b/engines/access/martian/martian_game.cpp
index b20c6771c47..80e8ab90088 100644
--- a/engines/access/martian/martian_game.cpp
+++ b/engines/access/martian/martian_game.cpp
@@ -52,8 +52,6 @@ void MartianEngine::configSelect() {
 }
 
 void MartianEngine::initVariables() {
-	warning("TODO: initVariables");
-
 	// Set player room and position
 	_player->_roomNumber = 7;
 
diff --git a/engines/access/martian/martian_room.cpp b/engines/access/martian/martian_room.cpp
index ef2814266e9..adb8d83f742 100644
--- a/engines/access/martian/martian_room.cpp
+++ b/engines/access/martian/martian_room.cpp
@@ -34,10 +34,10 @@ MartianRoom::MartianRoom(AccessEngine *vm) : Room(vm) {
 	_game = (MartianEngine *)vm;
 
 	for (int i = 0; i < 30; i++)
-		_byte26CD2[i] = 0;
+		_vm->_flags[200 + i] = 0;
 
 	for (int i = 0; i < 10; i++)
-		_byte26CBC[i] = 0;
+		_vm->_flags[178 + i] = 0;
 }
 
 MartianRoom::~MartianRoom() {
@@ -92,16 +92,17 @@ void MartianRoom::reloadRoom1() {
 }
 
 void MartianRoom::roomSet() {
+	// aka runScriptInitScript
 	_vm->_numAnimTimers = 0;
 	_vm->_scripts->_sequence = 1000;
 	_vm->_scripts->searchForSequence();
 	_vm->_scripts->executeScript();
 
 	for (int i = 0; i < 30; i++)
-		_byte26CD2[i] = 0;
+		_vm->_flags[200 + i] = 0;
 
 	for (int i = 0; i < 10; i++)
-		_byte26CBC[i] = 0;
+		_vm->_flags[178 + i] = 0;
 }
 
 void MartianRoom::roomMenu() {
diff --git a/engines/access/martian/martian_room.h b/engines/access/martian/martian_room.h
index 877ba057305..2e3f598c032 100644
--- a/engines/access/martian/martian_room.h
+++ b/engines/access/martian/martian_room.h
@@ -39,8 +39,6 @@ private:
 
 	void roomSet();
 
-	int _byte26CD2[30];
-	int _byte26CBC[10];
 protected:
 	void loadRoom(int roomNumber) override;
 


Commit: 680349d51a9253bddcc069aae5432cddbc09af78
    https://github.com/scummvm/scummvm/commit/680349d51a9253bddcc069aae5432cddbc09af78
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Improve const correctness for sprite render operations

Changed paths:
    engines/access/access.cpp
    engines/access/amazon/amazon_logic.cpp
    engines/access/asurface.cpp
    engines/access/asurface.h
    engines/access/bubble_box.cpp
    engines/access/bubble_box.h
    engines/access/inventory.cpp
    engines/access/scripts.cpp
    engines/access/scripts.h


diff --git a/engines/access/access.cpp b/engines/access/access.cpp
index 9262f7b0e24..6dbec241a42 100644
--- a/engines/access/access.cpp
+++ b/engines/access/access.cpp
@@ -360,7 +360,7 @@ void AccessEngine::plotList1() {
 		_imgUnscaled = (ie._flags & IMGFLAG_UNSCALED) != 0;
 		Common::Point pt = ie._position - _screen->_bufferStart;
 		SpriteResource *sprites = ie._spritesPtr;
-		SpriteFrame *frame = sprites->getFrame(ie._frameNumber);
+		const SpriteFrame *frame = sprites->getFrame(ie._frameNumber);
 
 		Common::Rect bounds(pt.x, pt.y, pt.x + frame->w, pt.y + frame->h);
 		if (!_imgUnscaled) {
diff --git a/engines/access/amazon/amazon_logic.cpp b/engines/access/amazon/amazon_logic.cpp
index 6ddaaaabbc3..c5e035b2045 100644
--- a/engines/access/amazon/amazon_logic.cpp
+++ b/engines/access/amazon/amazon_logic.cpp
@@ -615,7 +615,7 @@ void Plane::doFallCell() {
 	if (_vm->_scaleI <= 20)
 		return;
 
-	SpriteFrame *frame = _vm->_objectsTable[20]->getFrame(_planeCount / 6);
+	const SpriteFrame *frame = _vm->_objectsTable[20]->getFrame(_planeCount / 6);
 	Common::Rect r(115, 11, 115 + _vm->_screen->_scaleTable1[frame->w],
 		11 + _vm->_screen->_scaleTable1[frame->h]);
 	_vm->_buffer2.sPlotF(frame, r);
diff --git a/engines/access/asurface.cpp b/engines/access/asurface.cpp
index af1dadf7b8c..9bed021ad38 100644
--- a/engines/access/asurface.cpp
+++ b/engines/access/asurface.cpp
@@ -130,8 +130,8 @@ void BaseSurface::clearBuffer() {
 	Common::fill(pSrc, pSrc + w * h, 0);
 }
 
-void BaseSurface::plotImage(SpriteResource *sprite, int frameNum, const Common::Point &pt) {
-	SpriteFrame *frame = sprite->getFrame(frameNum);
+void BaseSurface::plotImage(const SpriteResource *sprite, int frameNum, const Common::Point &pt) {
+	const SpriteFrame *frame = sprite->getFrame(frameNum);
 	Common::Rect r(pt.x, pt.y, pt.x + frame->w, pt.y + frame->h);
 
 	if (!clip(r)) {
@@ -148,19 +148,19 @@ void BaseSurface::copyBuffer(Graphics::ManagedSurface *src) {
 	blitFrom(*src);
 }
 
-void BaseSurface::plotF(SpriteFrame *frame, const Common::Point &pt) {
+void BaseSurface::plotF(const SpriteFrame *frame, const Common::Point &pt) {
 	sPlotF(frame, Common::Rect(pt.x, pt.y, pt.x + frame->w, pt.y + frame->h));
 }
 
-void BaseSurface::plotB(SpriteFrame *frame, const Common::Point &pt) {
+void BaseSurface::plotB(const SpriteFrame *frame, const Common::Point &pt) {
 	sPlotB(frame, Common::Rect(pt.x, pt.y, pt.x + frame->w, pt.y + frame->h));
 }
 
-void BaseSurface::sPlotF(SpriteFrame *frame, const Common::Rect &bounds) {
+void BaseSurface::sPlotF(const SpriteFrame *frame, const Common::Rect &bounds) {
 	transBlitFrom(*frame, Common::Rect(0, 0, frame->w, frame->h), bounds, TRANSPARENCY, false);
 }
 
-void BaseSurface::sPlotB(SpriteFrame *frame, const Common::Rect &bounds) {
+void BaseSurface::sPlotB(const SpriteFrame *frame, const Common::Rect &bounds) {
 	transBlitFrom(*frame, Common::Rect(0, 0, frame->w, frame->h), bounds, TRANSPARENCY, true);
 }
 
diff --git a/engines/access/asurface.h b/engines/access/asurface.h
index 0354802761b..da1fb16b3e4 100644
--- a/engines/access/asurface.h
+++ b/engines/access/asurface.h
@@ -67,27 +67,27 @@ public:
 
 	void clearBuffer();
 
-	void plotImage(SpriteResource *sprite, int frameNum, const Common::Point &pt);
+	void plotImage(const SpriteResource *sprite, int frameNum, const Common::Point &pt);
 
 	/**
 	 * Scaled draw frame in forward orientation
 	 */
-	void sPlotF(SpriteFrame *frame, const Common::Rect &bounds);
+	void sPlotF(const SpriteFrame *frame, const Common::Rect &bounds);
 
 	/**
 	 * Scaled draw frame in backwards orientation
 	 */
-	void sPlotB(SpriteFrame *frame, const Common::Rect &bounds);
+	void sPlotB(const SpriteFrame *frame, const Common::Rect &bounds);
 
 	/**
 	 * Draw an image full-size in forward orientation
 	 */
-	void plotF(SpriteFrame *frame, const Common::Point &pt);
+	void plotF(const SpriteFrame *frame, const Common::Point &pt);
 
 	/**
 	 * Draw an image full-size in backwards orientation
 	 */
-	void plotB(SpriteFrame *frame, const Common::Point &pt);
+	void plotB(const SpriteFrame *frame, const Common::Point &pt);
 
 	virtual void copyBlock(BaseSurface *src, const Common::Rect &bounds);
 
@@ -144,7 +144,7 @@ public:
 
 	int getCount() { return _frames.size(); }
 
-	SpriteFrame *getFrame(int idx) { return _frames[idx]; }
+	const SpriteFrame *getFrame(int idx) const { return _frames[idx]; }
 };
 
 enum ImageFlag {
diff --git a/engines/access/bubble_box.cpp b/engines/access/bubble_box.cpp
index 3f407a09fc9..3f1a8fa29f5 100644
--- a/engines/access/bubble_box.cpp
+++ b/engines/access/bubble_box.cpp
@@ -25,7 +25,7 @@
 
 namespace Access {
 
-BubbleBox::BubbleBox(AccessEngine *vm, Access::BoxType type, int x, int y, int w, int h, int val1, int val2, int val3, int val4, Common::String title) : Manager(vm) {
+BubbleBox::BubbleBox(AccessEngine *vm, Access::BoxType type, int x, int y, int w, int h, int val1, int val2, int val3, int val4, const char *title) : Manager(vm) {
 	_type = type;
 	_bounds = Common::Rect(x, y, x + w, y + h);
 	_bubbleDisplStr = title;
@@ -39,8 +39,8 @@ BubbleBox::BubbleBox(AccessEngine *vm, Access::BoxType type, int x, int y, int w
 	_boxEndX = _boxEndY = 0;
 	_boxPStartX = _boxPStartY = 0;
 	// Unused in AGoE
-	for (int i = 0; i < 60; i++) {
-		_tempList[i] = "";
+	for (int i = 0; i < ARRAYSIZE(_tempList); i++) {
+		_tempList[i].clear();
 		_tempListIdx[i] = 0;
 	}
 	_btnUpPos = Common::Rect(0, 0, 0, 0);
diff --git a/engines/access/bubble_box.h b/engines/access/bubble_box.h
index fc9e223db1a..8fd3c3889ad 100644
--- a/engines/access/bubble_box.h
+++ b/engines/access/bubble_box.h
@@ -74,7 +74,7 @@ public:
 	Common::Rect _btnDownPos;
 	Common::Array<Common::Rect> _bubbles;
 public:
-	BubbleBox(AccessEngine *vm, Access::BoxType type, int x, int y, int w, int h, int val1, int val2, int val3, int val4, Common::String title);
+	BubbleBox(AccessEngine *vm, Access::BoxType type, int x, int y, int w, int h, int val1, int val2, int val3, int val4, const char *title);
 
 	void load(Common::SeekableReadStream *stream);
 
diff --git a/engines/access/inventory.cpp b/engines/access/inventory.cpp
index 61c70df340b..01ac3763000 100644
--- a/engines/access/inventory.cpp
+++ b/engines/access/inventory.cpp
@@ -152,7 +152,7 @@ int InventoryManager::newDisplayInv() {
 			_vm->_buffer1.clearBuffer();
 
 			SpriteResource *spr = _vm->_objectsTable[99];
-			SpriteFrame *frame = spr->getFrame(_vm->_useItem);
+			const SpriteFrame *frame = spr->getFrame(_vm->_useItem);
 
 			int w = screen._scaleTable1[46];
 			int h = screen._scaleTable1[35];
diff --git a/engines/access/scripts.cpp b/engines/access/scripts.cpp
index 89299ff6d6f..74b41ca086c 100644
--- a/engines/access/scripts.cpp
+++ b/engines/access/scripts.cpp
@@ -313,7 +313,7 @@ void Scripts::cmdPrint_v2() {
 	printString(msg);
 }
 
-void Scripts::doCmdPrint_v1(Common::String msg) {
+void Scripts::doCmdPrint_v1(const Common::String &msg) {
 	_vm->_screen->_printOrg = Common::Point(20, 42);
 	_vm->_screen->_printStart = Common::Point(20, 32);
 	_vm->_bubbleBox->placeBubble(msg);
diff --git a/engines/access/scripts.h b/engines/access/scripts.h
index 254c823fb40..8b74a027183 100644
--- a/engines/access/scripts.h
+++ b/engines/access/scripts.h
@@ -165,7 +165,7 @@ public:
 	int executeScript();
 
 	void findNull();
-	void doCmdPrint_v1(Common::String msg);
+	void doCmdPrint_v1(const Common::String &msg);
 
 	/**
 	 * Print a given message to the screen in a bubble box


Commit: cb672f79a1741f5f98dd3dd2b3ad52aadac1b22e
    https://github.com/scummvm/scummvm/commit/cb672f79a1741f5f98dd3dd2b3ad52aadac1b22e
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Fix drawBox function

Changed paths:
    engines/access/asurface.cpp


diff --git a/engines/access/asurface.cpp b/engines/access/asurface.cpp
index 9bed021ad38..6fbb0122303 100644
--- a/engines/access/asurface.cpp
+++ b/engines/access/asurface.cpp
@@ -208,10 +208,10 @@ void BaseSurface::drawLine() {
 }
 
 void BaseSurface::drawBox() {
-	Graphics::ManagedSurface::drawLine(_orgX1, _orgY1, _orgX2, _orgY1, _lColor);
-	Graphics::ManagedSurface::drawLine(_orgX1, _orgY2, _orgX2, _orgY2, _lColor);
-	Graphics::ManagedSurface::drawLine(_orgX2, _orgY1, _orgX2, _orgY1, _lColor);
-	Graphics::ManagedSurface::drawLine(_orgX2, _orgY2, _orgX2, _orgY2, _lColor);
+	Graphics::ManagedSurface::hLine(_orgX1, _orgY1, _orgX2, _lColor);
+	Graphics::ManagedSurface::hLine(_orgX1, _orgY2, _orgX2, _lColor);
+	Graphics::ManagedSurface::vLine(_orgX1, _orgY1, _orgY2, _lColor);
+	Graphics::ManagedSurface::vLine(_orgX2, _orgY1, _orgY2, _lColor);
 }
 
 void BaseSurface::flipHorizontal(BaseSurface &dest) {


Commit: be6cac311908247f0e7feb3c9b186f8c8cc1fc35
    https://github.com/scummvm/scummvm/commit/be6cac311908247f0e7feb3c9b186f8c8cc1fc35
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Add loading for MM's 8x8 mono font

Changed paths:
    engines/access/amazon/amazon_game.cpp
    engines/access/font.cpp
    engines/access/font.h
    engines/access/martian/martian_game.cpp
    engines/access/martian/martian_resources.cpp
    engines/access/martian/martian_resources.h


diff --git a/engines/access/amazon/amazon_game.cpp b/engines/access/amazon/amazon_game.cpp
index fa6b109ef9e..dbdc852a1c4 100644
--- a/engines/access/amazon/amazon_game.cpp
+++ b/engines/access/amazon/amazon_game.cpp
@@ -161,7 +161,7 @@ void AmazonEngine::setupGame() {
 		_deaths._cells[i] = CellIdent(DEATH_CELLS[i][0], DEATH_CELLS[i][1], DEATH_CELLS[i][2]);
 
 	// Miscellaneous
-	_fonts.load(res._font6x6, res._font3x5);
+	_fonts.load(res._font6x6, res._font3x5, nullptr);
 
 	initVariables();
 }
diff --git a/engines/access/font.cpp b/engines/access/font.cpp
index 3256f9630c7..860ea07d551 100644
--- a/engines/access/font.cpp
+++ b/engines/access/font.cpp
@@ -232,14 +232,34 @@ void MartianFont::loadFromData(size_t count, const byte *widths, const int *offs
 
 /*------------------------------------------------------------------------*/
 
-FontManager::FontManager() : _font1(nullptr), _font2(nullptr) {
+MartianBitFont::MartianBitFont(size_t count, const byte *data) : Font(0x20) {
+	_height = 8;
+	_chars.resize(count);
+	for (size_t i = 0; i < count; i++) {
+		Graphics::Surface &surface = _chars[i];
+		surface.create(8, _height, Graphics::PixelFormat::createFormatCLUT8());
+		for (int y = 0; y < _height; y++) {
+			byte src = data[i * 8 + y];
+			byte *dst = static_cast<byte *>(surface.getBasePtr(0, y));
+			for (int x = 7; x >= 0; x--) {
+				dst[x] = (src & 1);
+				src >>= 1;
+			}
+		}
+	}
+}
+
+/*------------------------------------------------------------------------*/
+
+FontManager::FontManager() : _font1(nullptr), _font2(nullptr), _bitFont(nullptr) {
 	_printMaxX = 0;
 	Common::fill(&Font::_fontColors[0], &Font::_fontColors[4], 0);
 }
 
-void FontManager::load(Font *font1, Font *font2) {
+void FontManager::load(Font *font1, Font *font2, Font *bitFont) {
 	_font1 = font1;
 	_font2 = font2;
+	_bitFont = bitFont;
 }
 
 
diff --git a/engines/access/font.h b/engines/access/font.h
index 6cddeaa5721..79e4f1c765f 100644
--- a/engines/access/font.h
+++ b/engines/access/font.h
@@ -132,6 +132,14 @@ public:
 	MartianFont(int height, size_t count, const byte *widths, const int *offsets, const byte *data);
 };
 
+class MartianBitFont : public Font {
+public:
+	/**
+	* Constructor
+	*/
+	MartianBitFont(size_t count, const byte *data);
+};
+
 
 class FontManager {
 public:
@@ -140,6 +148,7 @@ public:
 	int _printMaxX;
 	Font *_font1;
 	Font *_font2;
+	Font *_bitFont;
 public:
 	/**
 	 * Constructor
@@ -149,7 +158,7 @@ public:
 	/**
 	 * Set the fonts
 	 */
-	void load(Font *font1, Font *font2);
+	void load(Font *font1, Font *font2, Font *bitFont);
 };
 
 } // End of namespace Access
diff --git a/engines/access/martian/martian_game.cpp b/engines/access/martian/martian_game.cpp
index 80e8ab90088..d2dd6d89d53 100644
--- a/engines/access/martian/martian_game.cpp
+++ b/engines/access/martian/martian_game.cpp
@@ -290,7 +290,7 @@ void MartianEngine::setupGame() {
 
 	// Miscellaneous
 	Martian::MartianResources &res = *((Martian::MartianResources *)_res);
-	_fonts.load(res._font1, res._font2);
+	_fonts.load(res._font1, res._font2, res._bitFont);
 
 	// Set player room and position
 	_player->_roomNumber = 7;
diff --git a/engines/access/martian/martian_resources.cpp b/engines/access/martian/martian_resources.cpp
index b72720e247b..d905c140b69 100644
--- a/engines/access/martian/martian_resources.cpp
+++ b/engines/access/martian/martian_resources.cpp
@@ -30,6 +30,7 @@ namespace Martian {
 MartianResources::~MartianResources() {
 	delete _font1;
 	delete _font2;
+	delete _bitFont;
 }
 
 /*------------------------------------------------------------------------*/
@@ -255,6 +256,74 @@ static const byte CURSOR_2_DATA[] = {
 	0x0
 };
 
+static const byte BITFONT_DATA[] = {
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0x00, 0x08, 0x08, 0x08, 0x00, 0x08, 0x00, 0x00,
+    0x00, 0x24, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0x00, 0x14, 0x3E, 0x14, 0x3E, 0x14, 0x00, 0x00,
+    0x3C, 0x50, 0x38, 0x14, 0x78, 0x10, 0x00, 0x00,
+    0x00, 0x22, 0x04, 0x08, 0x10, 0x22, 0x00, 0x00,
+    0x00, 0x30, 0x48, 0x30, 0x2A, 0x4C, 0x32, 0x00,
+    0x00, 0x18, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00,
+    0x00, 0x0C, 0x18, 0x10, 0x18, 0x0C, 0x00, 0x00,
+    0x00, 0x30, 0x18, 0x08, 0x18, 0x30, 0x00, 0x00,
+    0x00, 0x2A, 0x1C, 0x3E, 0x1C, 0x2A, 0x00, 0x00,
+    0x00, 0x00, 0x08, 0x1C, 0x08, 0x00, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x18, 0x08, 0x10, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00,
+    0x00, 0x02, 0x04, 0x08, 0x10, 0x20, 0x00, 0x00,
+    0x00, 0x3C, 0x4A, 0x52, 0x62, 0x3C, 0x00, 0x00,
+    0x00, 0x08, 0x18, 0x08, 0x08, 0x1C, 0x00, 0x00,
+    0x00, 0x3C, 0x42, 0x0C, 0x30, 0x7E, 0x00, 0x00,
+    0x00, 0x3C, 0x42, 0x1C, 0x42, 0x3C, 0x00, 0x00,
+    0x00, 0x42, 0x42, 0x7E, 0x02, 0x02, 0x00, 0x00,
+    0x00, 0x7E, 0x40, 0x7C, 0x02, 0x7C, 0x00, 0x00,
+    0x00, 0x3C, 0x40, 0x7C, 0x42, 0x3C, 0x00, 0x00,
+    0x00, 0x7E, 0x02, 0x04, 0x08, 0x08, 0x00, 0x00,
+    0x00, 0x3C, 0x42, 0x3C, 0x42, 0x3C, 0x00, 0x00,
+    0x00, 0x3C, 0x42, 0x3E, 0x02, 0x3C, 0x00, 0x00,
+    0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00,
+    0x00, 0x00, 0x08, 0x00, 0x18, 0x08, 0x10, 0x00,
+    0x00, 0x08, 0x10, 0x20, 0x10, 0x08, 0x00, 0x00,
+    0x00, 0x00, 0x3C, 0x00, 0x3C, 0x00, 0x00, 0x00,
+    0x00, 0x10, 0x08, 0x04, 0x08, 0x10, 0x00, 0x00,
+    0x00, 0x3C, 0x24, 0x0C, 0x00, 0x08, 0x00, 0x00,
+    0x00, 0x3C, 0x42, 0x5E, 0x40, 0x3E, 0x00, 0x00,
+    0x00, 0x3C, 0x42, 0x42, 0x7E, 0x42, 0x00, 0x00,
+    0x00, 0x7C, 0x42, 0x7C, 0x42, 0x7C, 0x00, 0x00,
+    0x00, 0x3C, 0x42, 0x40, 0x42, 0x3C, 0x00, 0x00,
+    0x00, 0x7C, 0x42, 0x42, 0x42, 0x7C, 0x00, 0x00,
+    0x00, 0x7E, 0x40, 0x7C, 0x40, 0x7E, 0x00, 0x00,
+    0x00, 0x7E, 0x40, 0x7C, 0x40, 0x40, 0x00, 0x00,
+    0x00, 0x3C, 0x40, 0x4E, 0x42, 0x3C, 0x00, 0x00,
+    0x00, 0x42, 0x42, 0x7E, 0x42, 0x42, 0x00, 0x00,
+    0x00, 0x7C, 0x10, 0x10, 0x10, 0x7C, 0x00, 0x00,
+    0x00, 0x1E, 0x04, 0x04, 0x44, 0x38, 0x00, 0x00,
+    0x00, 0x42, 0x4C, 0x70, 0x4C, 0x42, 0x00, 0x00,
+    0x00, 0x40, 0x40, 0x40, 0x40, 0x7E, 0x00, 0x00,
+    0x00, 0x41, 0x63, 0x55, 0x49, 0x41, 0x00, 0x00,
+    0x00, 0x42, 0x62, 0x5A, 0x46, 0x42, 0x00, 0x00,
+    0x00, 0x3C, 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00,
+    0x00, 0x7C, 0x42, 0x7C, 0x40, 0x40, 0x00, 0x00,
+    0x00, 0x3C, 0x42, 0x42, 0x44, 0x3A, 0x00, 0x00,
+    0x00, 0x7C, 0x42, 0x7C, 0x44, 0x42, 0x00, 0x00,
+    0x00, 0x3C, 0x40, 0x3C, 0x02, 0x3C, 0x00, 0x00,
+    0x00, 0x7C, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00,
+    0x00, 0x42, 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00,
+    0x00, 0x42, 0x42, 0x42, 0x24, 0x18, 0x00, 0x00,
+    0x00, 0x41, 0x49, 0x55, 0x63, 0x41, 0x00, 0x00,
+    0x00, 0x42, 0x24, 0x18, 0x24, 0x42, 0x00, 0x00,
+    0x00, 0x42, 0x42, 0x24, 0x18, 0x18, 0x00, 0x00,
+    0x00, 0x7E, 0x04, 0x18, 0x20, 0x7E, 0x00, 0x00,
+    0x00, 0x10, 0x38, 0x7C, 0x38, 0x38, 0x00, 0x00,
+    0x00, 0x38, 0x38, 0x7C, 0x38, 0x10, 0x00, 0x00,
+    0x00, 0x7F, 0x41, 0x41, 0x41, 0x7F, 0x00, 0x00,
+    0x00, 0x7F, 0x55, 0x49, 0x55, 0x7F, 0x00, 0x00,
+    0xFF, 0x91, 0xBD, 0xBD, 0x91, 0xFF, 0x00, 0x00,
+    0xFF, 0x89, 0xBD, 0xBD, 0x89, 0xFF, 0x00, 0x00
+};
+
 static const byte CURSOR_3_DATA[] = {
 	0x8,  0x0,  0x8,  0x0,  0x0,  0x0,  0x0,  0x0,
 	0x7,  0x2,  0x4,  0x5,  0x7,  0x2,  0x4,  0x5,
@@ -309,7 +378,8 @@ void MartianResources::load(Common::SeekableReadStream &s) {
 
 	// Create the fonts from static data.
 	_font1 = new MartianFont(6, ARRAYSIZE(FONT1_WIDTHS), FONT1_WIDTHS, FONT1_OFFSETS, FONT1_DATA);
-	_font2 = new MartianFont(5, ARRAYSIZE(FONT2_WIDTHS), FONT2_WIDTHS, FONT2_OFFSETS, FONT2_DATA);
+	_font2 = new MartianFont(6, ARRAYSIZE(FONT2_WIDTHS), FONT2_WIDTHS, FONT2_OFFSETS, FONT2_DATA);
+	_bitFont = new MartianBitFont(ARRAYSIZE(BITFONT_DATA) / 8, BITFONT_DATA);
 }
 
 const byte *MartianResources::getCursor(int num) const {
diff --git a/engines/access/martian/martian_resources.h b/engines/access/martian/martian_resources.h
index 027f99a28e3..4151cd03cf5 100644
--- a/engines/access/martian/martian_resources.h
+++ b/engines/access/martian/martian_resources.h
@@ -63,8 +63,9 @@ protected:
 public:
 	MartianFont *_font1;
 	MartianFont *_font2;
+	MartianBitFont *_bitFont;
 public:
-	MartianResources(AccessEngine *vm) : Resources(vm), _font1(nullptr), _font2(nullptr) {}
+	MartianResources(AccessEngine *vm) : Resources(vm), _font1(nullptr), _font2(nullptr), _bitFont(nullptr) {}
 	~MartianResources() override;
 
 	const byte *getCursor(int num) const override;


Commit: f9940856ccc9136785b06b28e4cd389cd28641d9
    https://github.com/scummvm/scummvm/commit/f9940856ccc9136785b06b28e4cd389cd28641d9
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Fix rendering of MM dialogs

Now we have the bitmap font we can correctly render the headers and fix some
other sizing and color issues.

They are now the exact size and layout as in the original game.

Changed paths:
    engines/access/bubble_box.cpp


diff --git a/engines/access/bubble_box.cpp b/engines/access/bubble_box.cpp
index 3f1a8fa29f5..a47a3585850 100644
--- a/engines/access/bubble_box.cpp
+++ b/engines/access/bubble_box.cpp
@@ -117,10 +117,12 @@ void BubbleBox::calcBubble(const Common::String &msg) {
 	int width = 0;
 	bool lastLine;
 	do {
-		if (_vm->getGameID() == GType_MartianMemorandum)
-			lastLine = _vm->_fonts._font2->getLine(s, screen._maxChars, line, width, Font::kWidthInChars);
-		else
+		if (_vm->getGameID() == GType_MartianMemorandum) {
+			lastLine = _vm->_fonts._font1->getLine(s, screen._maxChars, line, width, Font::kWidthInChars);
+			width = _vm->_fonts._font1->stringWidth(line);
+		} else {
 			lastLine = _vm->_fonts._font2->getLine(s, screen._maxChars * 6, line, width);
+		}
 
 		_vm->_fonts._printMaxX = MAX(width, _vm->_fonts._printMaxX);
 
@@ -128,25 +130,30 @@ void BubbleBox::calcBubble(const Common::String &msg) {
 		screen._printOrg.x = screen._printStart.x;
 	} while (!lastLine);
 
-	if (_type == kBoxTypeFileDialog)
-		++screen._printOrg.y += 6;
+	if (_vm->getGameID() == GType_MartianMemorandum) {
+		bounds.setWidth((_vm->_fonts._printMaxX / 16 + 2) * 16 + 2 + 1);
+		bounds.bottom = screen._printOrg.y + 4 + 1;
+	} else {
+		if (_type == kBoxTypeFileDialog)
+			++screen._printOrg.y += 6;
 
-	// Determine the width for the area
-	width = (((_vm->_fonts._printMaxX >> 4) + 1) << 4) + 5;
-	if (width >= 24)
-		width += 20 - ((width - 24) % 20);
-	bounds.setWidth(width);
+		// Determine the width for the area
+		width = (((_vm->_fonts._printMaxX >> 4) + 1) << 4) + 5;
+		if (width >= 24)
+			width += 20 - ((width - 24) % 20);
+		bounds.setWidth(width);
 
-	// Determine the height for area
-	int y = screen._printOrg.y + 6;
-	if (_type == kBoxTypeFileDialog)
-		y += 6;
-	int height = y - bounds.top;
-	bounds.setHeight(height);
+		// Determine the height for area
+		int y = screen._printOrg.y + 6;
+		if (_type == kBoxTypeFileDialog)
+			y += 6;
+		int height = y - bounds.top;
+		bounds.setHeight(height);
 
-	height -= (_type == kBoxTypeFileDialog) ? 30 : 24;
-	if (height >= 0)
-		bounds.setHeight(bounds.height() + 13 - (height % 13));
+		height -= (_type == kBoxTypeFileDialog) ? 30 : 24;
+		if (height >= 0)
+			bounds.setHeight(bounds.height() + 13 - (height % 13));
+	}
 
 	if (bounds.bottom > screen.h)
 		bounds.translate(0, screen.h - bounds.bottom);
@@ -167,8 +174,12 @@ void BubbleBox::printBubble(const Common::String &msg) {
 }
 
 void BubbleBox::printBubble_v1(const Common::String &msg) {
+	Font::_fontColors[1] = 255;
+
 	drawBubble(_bubbles.size() - 1);
 
+	Font::_fontColors[3] = 247;
+
 	// Loop through drawing the lines
 	Common::String s = msg;
 	Common::String line;
@@ -176,8 +187,8 @@ void BubbleBox::printBubble_v1(const Common::String &msg) {
 	bool lastLine;
 	do {
 		// Get next line
-		Font &font2 = *_vm->_fonts._font2;
-		lastLine = font2.getLine(s, _vm->_screen->_maxChars, line, width, Font::kWidthInChars);
+		Font &font1 = *_vm->_fonts._font1;
+		lastLine = font1.getLine(s, _vm->_screen->_maxChars, line, width, Font::kWidthInChars);
 		// Draw the text
 		printString(line);
 
@@ -335,8 +346,11 @@ void BubbleBox::doBox(int item, int box) {
 }
 
 void BubbleBox::setCursorPos(int posX, int posY) {
-	_vm->_screen->_printStart = _vm->_screen->_printOrg = Common::Point((posX << 3) + _rowOff, posY << 3);
-	warning("Missing call to setCursorPos");
+	Common::Point newPt =  Common::Point(posX * 8, posY * 8 + _boxPStartY);
+	_vm->_screen->_printStart = _vm->_screen->_printOrg = newPt;
+	// This function (at 0x6803) calculates something from a lookup table, but
+	// never does anything with it.
+	debug("Skipping call to setCursorPos");
 }
 
 void BubbleBox::printString(Common::String msg) {
@@ -444,6 +458,11 @@ int BubbleBox::doBox_v1(int item, int box, int &btnSelected) {
 	_startItem = item;
 	_startBox = box;
 
+	Common::Point origPrintStart = _vm->_screen->_printStart;
+	Common::Point origPrintOrg = _vm->_screen->_printOrg;
+
+	_vm->_events->hideCursor();
+
 	// Save state information
 	_vm->_screen->saveScreen();
 	_vm->_screen->setDisplayScan();
@@ -473,8 +492,8 @@ int BubbleBox::doBox_v1(int item, int box, int &btnSelected) {
 	// Draw the inner box;
 	++_vm->_screen->_orgX1;
 	++_vm->_screen->_orgY1;
-	--_vm->_screen->_orgX2;
-	--_vm->_screen->_orgY2;
+	_vm->_screen->_orgX2 -= 2;
+	_vm->_screen->_orgY2 -= 2;
 	_vm->_screen->_lColor = 0xF9;
 
 	// Draw the inner border
@@ -587,31 +606,29 @@ int BubbleBox::doBox_v1(int item, int box, int &btnSelected) {
 		_vm->_screen->drawLine();
 	}
 
-	int len = _bubbleDisplStr.size();
-	int newX = _bounds.top >> 3;
-	newX = (len - newX) / 2;
+	int displStrLen = _bubbleDisplStr.size();
 
-	_boxPStartX = _bounds.left >> 3;
-	newX += _boxPStartX;
+	_boxPStartX = _bounds.left / 8;
+	int newX = (_boxPStartX + _bounds.width() / 8 - displStrLen) / 2;
 
-	int newY = _bounds.top >> 3;
-	int bp = _bounds.top - (newY << 3) + 1;
-	if (bp == 8) {
-		++newY;
-		bp = 0;
+	int _rowOff = _bounds.top / 8;
+	_boxPStartY = 1 - (_rowOff * 8 - _bounds.top);
+	if (_boxPStartY == 8) {
+		_boxPStartY = 0;
+		++_rowOff;
 	}
 
-	_rowOff = bp;
-	retval_ = _boxPStartY = newY;
+	retval_ = _boxPStartY;
 
-	setCursorPos(newX, newY);
+	setCursorPos(newX, _rowOff);
 
 	_vm->_fonts._charFor._lo = 0xFF;
-	_vm->_fonts._font1->drawString(_vm->_screen, _bubbleDisplStr, _vm->_screen->_printOrg);
+	_vm->_fonts._bitFont->drawString(_vm->_screen, _bubbleDisplStr, _vm->_screen->_printOrg);
 
 	if (_type == TYPE_2) {
 		_vm->_events->showCursor();
-		warning("TODO: pop values");
+		_vm->_screen->_printStart = origPrintStart;
+		_vm->_screen->_printOrg = origPrintOrg;
 		_vm->_screen->restoreScreen();
 		delete icons;
 		return retval_;
@@ -756,6 +773,10 @@ int BubbleBox::doBox_v1(int item, int box, int &btnSelected) {
 		retval_ = -1;
 	else
 		retval_ = _vm->_boxDataStart + _vm->_boxSelectY;
+
+	_vm->_screen->_printStart = origPrintStart;
+	_vm->_screen->_printOrg = origPrintOrg;
+
 	return retval_;
 }
 


Commit: b2907a14d872cd5a6d2b8d7c38740ec18a3d2634
    https://github.com/scummvm/scummvm/commit/b2907a14d872cd5a6d2b8d7c38740ec18a3d2634
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Cache icons, fix icon bar position in MM

We were reloading ICONS.LZ all the time.  It's not a big saving but it's
cleaner to cache the resulting sprite.

This also fixes the tool bar position in MM.

Changed paths:
    engines/access/access.cpp
    engines/access/access.h
    engines/access/amazon/amazon_room.cpp
    engines/access/asurface.cpp
    engines/access/asurface.h
    engines/access/bubble_box.cpp
    engines/access/char.cpp
    engines/access/martian/martian_room.cpp
    engines/access/room.cpp


diff --git a/engines/access/access.cpp b/engines/access/access.cpp
index 6dbec241a42..df1b068b6c3 100644
--- a/engines/access/access.cpp
+++ b/engines/access/access.cpp
@@ -117,6 +117,8 @@ AccessEngine::AccessEngine(OSystem *syst, const AccessGameDescription *gameDesc)
 
 	_vidEnd = false;
 
+	_icons = nullptr;
+
 	ARRAYCLEAR(_countTbl);
 }
 
@@ -139,6 +141,7 @@ AccessEngine::~AccessEngine() {
 	delete _scripts;
 	delete _sound;
 	delete _video;
+	delete _icons;
 
 	freeCells();
 	delete _establish;
@@ -202,6 +205,15 @@ void AccessEngine::initialize() {
 	}
 }
 
+const SpriteResource *AccessEngine::getIcons() {
+	if (!_icons) {
+		Resource *iconData = _files->loadFile("ICONS.LZ");
+		_icons = new SpriteResource(this, iconData);
+		delete iconData;
+	}
+	return _icons;
+}
+
 Common::Error AccessEngine::run() {
 	_res = Resources::init(this);
 	Common::U32String errorMessage;
diff --git a/engines/access/access.h b/engines/access/access.h
index df418082d03..0b621099ea5 100644
--- a/engines/access/access.h
+++ b/engines/access/access.h
@@ -122,6 +122,11 @@ class AccessEngine : public Engine {
 private:
 	uint32 _lastTime, _curTime;
 
+	/**
+	 * A cache for the ICONS.LZ sprite data
+     */
+	SpriteResource *_icons;
+
 	/**
 	 * Handles basic initialization
 	 */
@@ -279,6 +284,8 @@ public:
 
 	int getRandomNumber(int maxNumber);
 
+	const SpriteResource *getIcons();
+
 	void loadCells(Common::Array<CellIdent> &cells);
 
 	/**
diff --git a/engines/access/amazon/amazon_room.cpp b/engines/access/amazon/amazon_room.cpp
index 4c8ec6b7900..5eac427372a 100644
--- a/engines/access/amazon/amazon_room.cpp
+++ b/engines/access/amazon/amazon_room.cpp
@@ -143,19 +143,16 @@ void AmazonRoom::roomSet() {
 }
 
 void AmazonRoom::roomMenu() {
-	Resource *iconData = _vm->_files->loadFile("ICONS.LZ");
-	SpriteResource *spr = new SpriteResource(_vm, iconData);
-	delete iconData;
+	const SpriteResource *icons = _vm->getIcons();
 
 	Screen &screen = *_vm->_screen;
 	screen.saveScreen();
 	screen.setDisplayScan();
 	_vm->_destIn = &screen;	// TODO: Redundant
-	screen.plotImage(spr, 0, Common::Point(0, 177));
-	screen.plotImage(spr, 1, Common::Point(143, 177));
+	screen.plotImage(icons, 0, Common::Point(0, 177));
+	screen.plotImage(icons, 1, Common::Point(143, 177));
 
 	screen.restoreScreen();
-	delete spr;
 }
 
 void AmazonRoom::mainAreaClick() {
diff --git a/engines/access/asurface.cpp b/engines/access/asurface.cpp
index 6fbb0122303..c7c2e85c49f 100644
--- a/engines/access/asurface.cpp
+++ b/engines/access/asurface.cpp
@@ -29,7 +29,7 @@ namespace Access {
 
 const int TRANSPARENCY = 0;
 
-SpriteResource::SpriteResource(AccessEngine *vm, Resource *res) {
+SpriteResource::SpriteResource(const AccessEngine *vm, Resource *res) {
 	Common::Array<uint32> offsets;
 	int count = res->_stream->readUint16LE();
 
@@ -52,7 +52,7 @@ SpriteResource::~SpriteResource() {
 		delete _frames[i];
 }
 
-SpriteFrame::SpriteFrame(AccessEngine *vm, Common::SeekableReadStream *stream, int frameSize) {
+SpriteFrame::SpriteFrame(const AccessEngine *vm, Common::SeekableReadStream *stream, int frameSize) {
 	int xSize = stream->readUint16LE();
 	int ySize = stream->readUint16LE();
 
diff --git a/engines/access/asurface.h b/engines/access/asurface.h
index da1fb16b3e4..fdda2906548 100644
--- a/engines/access/asurface.h
+++ b/engines/access/asurface.h
@@ -131,7 +131,7 @@ public:
 
 class SpriteFrame : public ASurface {
 public:
-	SpriteFrame(AccessEngine *vm, Common::SeekableReadStream *stream, int frameSize);
+	SpriteFrame(const AccessEngine *vm, Common::SeekableReadStream *stream, int frameSize);
 	~SpriteFrame() override;
 };
 
@@ -139,7 +139,7 @@ class SpriteResource {
 public:
 	Common::Array<SpriteFrame *> _frames;
 public:
-	SpriteResource(AccessEngine *vm, Resource *res);
+	SpriteResource(const AccessEngine *vm, Resource *res);
 	~SpriteResource();
 
 	int getCount() { return _frames.size(); }
diff --git a/engines/access/bubble_box.cpp b/engines/access/bubble_box.cpp
index a47a3585850..d9052b987ff 100644
--- a/engines/access/bubble_box.cpp
+++ b/engines/access/bubble_box.cpp
@@ -267,10 +267,7 @@ void BubbleBox::doBox(int item, int box) {
 		return;
 	}
 
-	// Get icons data
-	Resource *iconData = _vm->_files->loadFile("ICONS.LZ");
-	SpriteResource *icons = new SpriteResource(_vm, iconData);
-	delete iconData;
+	const SpriteResource *icons = _vm->getIcons();
 
 	// Set the up boundaries and color to use for the box background
 	_vm->_screen->_orgX1 = _bounds.left - 2;
@@ -340,9 +337,6 @@ void BubbleBox::doBox(int item, int box) {
 	_charCol = charCol;
 	_rowOff = rowOff;
 	_vm->_screen->restoreScreen();
-
-	// Free icons data
-	delete icons;
 }
 
 void BubbleBox::setCursorPos(int posX, int posY) {
@@ -499,10 +493,7 @@ int BubbleBox::doBox_v1(int item, int box, int &btnSelected) {
 	// Draw the inner border
 	_vm->_screen->drawBox();
 
-	// Get icons data
-	Resource *iconData = _vm->_files->loadFile("ICONS.LZ");
-	SpriteResource *icons = new SpriteResource(_vm, iconData);
-	delete iconData;
+	const SpriteResource *icons = _vm->getIcons();
 
 	// Draw upper border
 	_vm->_bcnt = (_vm->_screen->_orgX2 - _vm->_screen->_orgX1) >> 4;
@@ -630,7 +621,6 @@ int BubbleBox::doBox_v1(int item, int box, int &btnSelected) {
 		_vm->_screen->_printStart = origPrintStart;
 		_vm->_screen->_printOrg = origPrintOrg;
 		_vm->_screen->restoreScreen();
-		delete icons;
 		return retval_;
 	}
 
@@ -663,8 +653,6 @@ int BubbleBox::doBox_v1(int item, int box, int &btnSelected) {
 		}
 	}
 
-	delete icons;
-
 	_vm->_screen->restoreScreen();
 	_vm->_boxDataStart = _startItem;
 	_vm->_boxSelectYOld = -1;
diff --git a/engines/access/char.cpp b/engines/access/char.cpp
index 92920bdb7b2..c38843710d4 100644
--- a/engines/access/char.cpp
+++ b/engines/access/char.cpp
@@ -147,20 +147,18 @@ void CharManager::loadChar(int charId) {
 }
 
 void CharManager::charMenu() {
-	Resource *iconData = _vm->_files->loadFile("ICONS.LZ");
-	SpriteResource *spr = new SpriteResource(_vm, iconData);
-	delete iconData;
+	const SpriteResource *icons = _vm->getIcons();
 
 	Screen &screen = *_vm->_screen;
 	screen.saveScreen();
 	screen.setDisplayScan();
 
 	if (_vm->getGameID() == GType_MartianMemorandum) {
-		screen.plotImage(spr, 17, Common::Point(0, 184));
-		screen.plotImage(spr, 18, Common::Point(193, 184));
+		screen.plotImage(icons, 17, Common::Point(0, 184));
+		screen.plotImage(icons, 18, Common::Point(193, 184));
 	} else if (_vm->getGameID() == GType_Amazon) {
-		screen.plotImage(spr, 17, Common::Point(0, 176));
-		screen.plotImage(spr, 18, Common::Point(155, 176));
+		screen.plotImage(icons, 17, Common::Point(0, 176));
+		screen.plotImage(icons, 18, Common::Point(155, 176));
 	} else
 		error("Game not supported");
 
@@ -169,7 +167,6 @@ void CharManager::charMenu() {
 	screen.copyTo(&_vm->_buffer1);
 
 	screen.restoreScreen();
-	delete spr;
 }
 
 } // End of namespace Access
diff --git a/engines/access/martian/martian_room.cpp b/engines/access/martian/martian_room.cpp
index adb8d83f742..724a3bcc525 100644
--- a/engines/access/martian/martian_room.cpp
+++ b/engines/access/martian/martian_room.cpp
@@ -106,18 +106,15 @@ void MartianRoom::roomSet() {
 }
 
 void MartianRoom::roomMenu() {
-	Resource *iconData = _vm->_files->loadFile("ICONS.LZ");
-	SpriteResource *spr = new SpriteResource(_vm, iconData);
-	delete iconData;
+	const SpriteResource *icons = _vm->getIcons();
 
 	_vm->_screen->saveScreen();
 	_vm->_screen->setDisplayScan();
 	_vm->_destIn = _vm->_screen;	// TODO: Redundant
-	_vm->_screen->plotImage(spr, 0, Common::Point(5, 184));
-	_vm->_screen->plotImage(spr, 1, Common::Point(155, 184));
+	_vm->_screen->plotImage(icons, 0, Common::Point(5, 184));
+	_vm->_screen->plotImage(icons, 1, Common::Point(155, 184));
 
 	_vm->_screen->restoreScreen();
-	delete spr;
 }
 
 void MartianRoom::mainAreaClick() {
diff --git a/engines/access/room.cpp b/engines/access/room.cpp
index e67edf4cbab..d6f31de08e2 100644
--- a/engines/access/room.cpp
+++ b/engines/access/room.cpp
@@ -707,19 +707,19 @@ void Room::executeCommand(int commandId) {
 	screen.saveScreen();
 	screen.setDisplayScan();
 
-	// Get the toolbar icons resource
-	Resource *iconData = _vm->_files->loadFile("ICONS.LZ");
-	SpriteResource *spr = new SpriteResource(_vm, iconData);
-	delete iconData;
+	const SpriteResource *icons = _vm->getIcons();
 
 	// Draw the button as selected
-	screen.plotImage(spr, 0, Common::Point(0, 177));
-	screen.plotImage(spr, 1, Common::Point(143, 177));
-	screen.plotImage(spr, _selectCommand + 2,
+	if (_vm->getGameID() == GType_MartianMemorandum) {
+		screen.plotImage(icons, 0, Common::Point(5, 184));
+		screen.plotImage(icons, 1, Common::Point(155, 184));
+	} else {
+		screen.plotImage(icons, 0, Common::Point(0, 177));
+		screen.plotImage(icons, 1, Common::Point(143, 177));
+	}
+	screen.plotImage(icons, _selectCommand + 2,
 		Common::Point(_rMouse[_selectCommand][0], (_vm->getGameID() == GType_MartianMemorandum) ? 184 : 176));
 
-	delete spr;
-
 	_vm->_screen->restoreScreen();
 	_vm->_boxSelect = true;
 }


Commit: 159a64b7fbb486aab2465fdc9d1f6c5de0b6e1ad
    https://github.com/scummvm/scummvm/commit/159a64b7fbb486aab2465fdc9d1f6c5de0b6e1ad
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Reduce game-specific code slightly

Move some more constants into resources to reduce ifs and switches based on
game ID.

Changed paths:
    engines/access/amazon/amazon_resources.cpp
    engines/access/amazon/amazon_resources.h
    engines/access/martian/martian_resources.cpp
    engines/access/martian/martian_resources.h
    engines/access/resources.h
    engines/access/room.cpp
    engines/access/scripts.cpp


diff --git a/engines/access/amazon/amazon_resources.cpp b/engines/access/amazon/amazon_resources.cpp
index f69e6ef2a5b..0beb2621caa 100644
--- a/engines/access/amazon/amazon_resources.cpp
+++ b/engines/access/amazon/amazon_resources.cpp
@@ -26,6 +26,15 @@ namespace Access {
 
 namespace Amazon {
 
+static const int BTN_RANGES[6][2] = {
+	{ 0, 76 }, { 77, 154 }, { 155, 232 }, { 233, 276 }, { 0, 0 }, { 277, 319 }
+};
+
+static const int RMOUSE[10][2] = {
+	{ 0, 35 }, { 0, 0 }, { 36, 70 }, { 71, 106 }, { 107, 141 },
+	{ 142, 177 }, { 178, 212 }, { 213, 248 }, { 249, 283 }, { 284, 318 }
+};
+
 AmazonResources::~AmazonResources() {
 	delete _font3x5;
 	delete _font6x6;
@@ -93,6 +102,17 @@ const byte *AmazonResources::getCursor(int num) const {
 	return CURSORS[num].data();
 }
 
+int AmazonResources::getRMouse(int i, int j) const {
+	return RMOUSE[i][j];
+}
+
+int AmazonResources::inButtonXRange(int x) const {
+	for (int i = 0; i < ARRAYSIZE(BTN_RANGES); i++) {
+		if ((x >= BTN_RANGES[i][0]) && (x < BTN_RANGES[i][1]))
+			return i;
+	}
+	return -1;
+}
 
 /*------------------------------------------------------------------------*/
 
@@ -523,11 +543,6 @@ const int CAST_END_OBJ1[4][4] = {
 	{ 3, 103, 1300, 10 }
 };
 
-const int RMOUSE[10][2] = {
-	{ 0, 35 }, { 0, 0 }, { 36, 70 }, { 71, 106 }, { 107, 141 },
-	{ 142, 177 }, { 178, 212 }, { 213, 248 }, { 249, 283 }, { 284, 318 }
-};
-
 
 } // End of namespace Amazon
 } // End of namespace Access
diff --git a/engines/access/amazon/amazon_resources.h b/engines/access/amazon/amazon_resources.h
index 310aa4008a7..84fad6d1a14 100644
--- a/engines/access/amazon/amazon_resources.h
+++ b/engines/access/amazon/amazon_resources.h
@@ -119,8 +119,6 @@ extern const int RIVER1OBJ[23][4];
 extern const int CAST_END_OBJ[26][4];
 extern const int CAST_END_OBJ1[4][4];
 
-extern const int RMOUSE[10][2];
-
 class AmazonResources: public Resources {
 protected:
 	/**
@@ -145,6 +143,9 @@ public:
 	~AmazonResources() override;
 
 	const byte *getCursor(int num) const override;
+	const char *getEgoName() const override { return "JASON"; }
+	int getRMouse(int i, int j) const override;
+	int inButtonXRange(int x) const override;
 };
 
 #define AMRES (*((Amazon::AmazonResources *)_vm->_res))
diff --git a/engines/access/martian/martian_resources.cpp b/engines/access/martian/martian_resources.cpp
index d905c140b69..5bdc17867b9 100644
--- a/engines/access/martian/martian_resources.cpp
+++ b/engines/access/martian/martian_resources.cpp
@@ -26,6 +26,16 @@ namespace Access {
 
 namespace Martian {
 
+static const int RMOUSE[10][2] = {
+	{ 7, 36 },    { 38, 68 },   { 70, 99 },   { 102, 125 }, { 128, 152 },
+	{ 155, 185 }, { 188, 216 }, { 219, 260 }, { 263, 293 }, { 295, 314 }
+};
+
+// MM defines the last range twice in the original.
+static const int BTN_RANGES[6][2] = {
+	{ 0, 60 }, { 64, 124 }, { 129, 192 }, { 194, 227 }, { 233, 292 }, { 297, 319 }
+};
+
 
 MartianResources::~MartianResources() {
 	delete _font1;
@@ -33,6 +43,18 @@ MartianResources::~MartianResources() {
 	delete _bitFont;
 }
 
+int MartianResources::getRMouse(int i, int j) const {
+	return RMOUSE[i][j];
+}
+
+int MartianResources::inButtonXRange(int x) const {
+	for (int i = 0; i < ARRAYSIZE(BTN_RANGES); i++) {
+		if ((x >= BTN_RANGES[i][0]) && (x < BTN_RANGES[i][1]))
+			return i;
+	}
+	return -1;
+}
+
 /*------------------------------------------------------------------------*/
 
 const int SIDEOFFR[] = {  4, 0, 7, 10,  3, 1, 2, 13, 0, 0, 0, 0 };
@@ -69,11 +91,6 @@ const byte ICON_PALETTE[] = {
 	0x00, 0x2D, 0x3A
 };
 
-const int RMOUSE[10][2] = {
-	{ 7, 36 },    { 38, 68 },   { 70, 99 },   { 102, 125 }, { 128, 152 },
-	{ 155, 185 }, { 188, 216 }, { 219, 260 }, { 263, 293 }, { 295, 314 }
-};
-
 const char *const TRAVDATA[] = {
 	"GALACTIC PICTURES", "TERRAFORM", "WASHROOM", "MR. BIG", "ALEXIS' HOME",
 	"JOHNNY FEDORA", "JUNKYARD IN", "TEX'S OFFICE", "MURDER SCENE", "PLAZA HOTEL",
diff --git a/engines/access/martian/martian_resources.h b/engines/access/martian/martian_resources.h
index 4151cd03cf5..1028d09cc08 100644
--- a/engines/access/martian/martian_resources.h
+++ b/engines/access/martian/martian_resources.h
@@ -43,8 +43,6 @@ extern const int SIDEOFFD[];
 extern const byte CREDIT_DATA[];
 extern const byte ICON_PALETTE[];
 
-extern const int RMOUSE[10][2];
-
 extern byte HELP[];
 extern const char *const ASK_TBL[];
 extern const char *const TRAVDATA[];
@@ -69,6 +67,9 @@ public:
 	~MartianResources() override;
 
 	const byte *getCursor(int num) const override;
+	const char *getEgoName() const override { return "TEX"; }
+	int getRMouse(int i, int j) const override;
+	int inButtonXRange(int x) const override;
 };
 
 #define MMRES (*((Martian::MartianResources *)_vm->_res))
diff --git a/engines/access/resources.h b/engines/access/resources.h
index 955a6b62871..ffab7743846 100644
--- a/engines/access/resources.h
+++ b/engines/access/resources.h
@@ -101,6 +101,22 @@ public:
 	 * Get the raw data for the given cursor number
 	 */
 	virtual const byte *getCursor(int num) const = 0;
+
+	/**
+	 * Get the name of the lead character
+	 */
+	virtual const char *getEgoName() const = 0;
+
+	/**
+	 * Get the room mouse values
+	 */
+	virtual int getRMouse(int i, int j) const = 0;
+
+	/**
+	 * Find if the mouse X is inside the range for a button,
+	 * or -1 if no button range matches.
+	 */
+	virtual int inButtonXRange(int x) const = 0;
 };
 
 } // End of namespace Access
diff --git a/engines/access/room.cpp b/engines/access/room.cpp
index d6f31de08e2..67c281a3029 100644
--- a/engines/access/room.cpp
+++ b/engines/access/room.cpp
@@ -40,21 +40,9 @@ Room::Room(AccessEngine *vm) : Manager(vm) {
 	_conFlag = false;
 	_selectCommand = -1;
 
-	switch (vm->getGameID()) {
-	case GType_Amazon:
-		for (int i = 0; i < 10; i++) {
-			_rMouse[i][0] = Amazon::RMOUSE[i][0];
-			_rMouse[i][1] = Amazon::RMOUSE[i][1];
-		}
-		break;
-	case GType_MartianMemorandum:
-		for (int i = 0; i < 10; i++) {
-			_rMouse[i][0] = Martian::RMOUSE[i][0];
-			_rMouse[i][1] = Martian::RMOUSE[i][1];
-		}
-		break;
-	default:
-		error("Game not supported");
+	for (int i = 0; i < 10; i++) {
+		_rMouse[i][0] = vm->_res->getRMouse(i, 0);
+		_rMouse[i][1] = vm->_res->getRMouse(i, 1);
 	}
 }
 
diff --git a/engines/access/scripts.cpp b/engines/access/scripts.cpp
index 74b41ca086c..c209f5beb35 100644
--- a/engines/access/scripts.cpp
+++ b/engines/access/scripts.cpp
@@ -820,26 +820,13 @@ void Scripts::cmdTexSpeak() {
 	while ((v = _data->readByte()) != 0)
 		tmpStr += (char)v;
 
-	if (_vm->getGameID() == GType_MartianMemorandum)
-		_vm->_bubbleBox->_bubbleDisplStr = "TEX";
-	else
-		_vm->_bubbleBox->_bubbleDisplStr = "JASON";
+	_vm->_bubbleBox->_bubbleDisplStr = _vm->_res->getEgoName();
 
 	_vm->_bubbleBox->placeBubble1(tmpStr);
 	findNull();
 }
 
-#define BTN_COUNT 6
 void Scripts::cmdTexChoice() {
-	// MM is defining 2 times the last range in the original.
-	static const int BTN_RANGES_v1[BTN_COUNT][2] = {
-		{ 0, 60 }, { 64, 124 }, { 129, 192 }, { 194, 227 }, { 233, 292 }, { 297, 319 }
-	};
-
-	static const int BTN_RANGES_v2[BTN_COUNT][2] = {
-		{ 0, 76 }, { 77, 154 }, { 155, 232 }, { 233, 276 }, { 0, 0 }, { 277, 319 }
-	};
-
 
 	_vm->_oldRects.clear();
 	_choiceStart = _data->pos() - 1;
@@ -869,9 +856,11 @@ void Scripts::cmdTexChoice() {
 	_vm->_bubbleBox->calcBubble(tmpStr);
 	_vm->_bubbleBox->printBubble(tmpStr);
 
+	const int responseYOff = (_vm->getGameID() == GType_MartianMemorandum) ? 20 : 11;
+
 	Common::Array<Common::Rect> responseCoords;
 	responseCoords.push_back(_vm->_bubbleBox->_bounds);
-	_vm->_screen->_printOrg.y = _vm->_bubbleBox->_bounds.bottom + ((_vm->getGameID() == GType_MartianMemorandum) ? 20 : 11);
+	_vm->_screen->_printOrg.y = _vm->_bubbleBox->_bounds.bottom + responseYOff;
 
 	findNull();
 
@@ -884,7 +873,7 @@ void Scripts::cmdTexChoice() {
 		_vm->_bubbleBox->calcBubble(tmpStr);
 		_vm->_bubbleBox->printBubble(tmpStr);
 		responseCoords.push_back(_vm->_bubbleBox->_bounds);
-		_vm->_screen->_printOrg.y = _vm->_bubbleBox->_bounds.bottom + ((_vm->getGameID() == GType_MartianMemorandum) ? 20 : 11);
+		_vm->_screen->_printOrg.y = _vm->_bubbleBox->_bounds.bottom + responseYOff;
 	}
 
 	findNull();
@@ -899,7 +888,7 @@ void Scripts::cmdTexChoice() {
 		_vm->_bubbleBox->calcBubble(tmpStr);
 		_vm->_bubbleBox->printBubble(tmpStr);
 		responseCoords.push_back(_vm->_bubbleBox->_bounds);
-		_vm->_screen->_printOrg.y = _vm->_bubbleBox->_bounds.bottom + ((_vm->getGameID() == GType_MartianMemorandum) ? 20 : 11);
+		_vm->_screen->_printOrg.y = _vm->_bubbleBox->_bounds.bottom + responseYOff;
 	}
 
 	findNull();
@@ -917,14 +906,7 @@ void Scripts::cmdTexChoice() {
 			if (_vm->_events->_mouseRow >= ((_vm->getGameID() == GType_MartianMemorandum) ? 23 : 22)) {
 				_vm->_events->debounceLeft();
 				int x = _vm->_events->_mousePos.x;
-				for (int i = 0; i < BTN_COUNT; i++) {
-					if (((_vm->getGameID() == GType_MartianMemorandum) && (x >= BTN_RANGES_v1[i][0]) && (x < BTN_RANGES_v1[i][1]))
-					||  ((_vm->getGameID() == GType_Amazon) && (x >= BTN_RANGES_v2[i][0]) && (x < BTN_RANGES_v2[i][1]))) {
-
-						choice = i;
-						break;
-					}
-				}
+				choice = _vm->_res->inButtonXRange(x);
 			} else {
 				_vm->_events->debounceLeft();
 				choice = _vm->_events->checkMouseBox1(responseCoords);


Commit: 05426ac1cdefa7927a33bcb067e9d5a75fc65187
    https://github.com/scummvm/scummvm/commit/05426ac1cdefa7927a33bcb067e9d5a75fc65187
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Remove MM-specific code from Amazon engine

This branch will never be executed because it's checking against game type.

Changed paths:
    engines/access/amazon/amazon_game.cpp


diff --git a/engines/access/amazon/amazon_game.cpp b/engines/access/amazon/amazon_game.cpp
index dbdc852a1c4..4cfa0878c34 100644
--- a/engines/access/amazon/amazon_game.cpp
+++ b/engines/access/amazon/amazon_game.cpp
@@ -255,23 +255,12 @@ void AmazonEngine::doEstablish(int screenId, int estabIndex) {
 	_screen->setIconPalette();
 	_screen->forceFadeIn();
 
-	if (getGameID() == GType_MartianMemorandum) {
-		_fonts._charSet._lo = 1;
-		_fonts._charSet._hi = 10;
-		_fonts._charFor._lo = 0xF7;
-		_fonts._charFor._hi = 0xFF;
-
-		_screen->_maxChars = 50;
-		_screen->_printOrg = _screen->_printStart = Common::Point(24, 18);
-	} else {
-		_fonts._charSet._lo = 1;
-		_fonts._charSet._hi = 10;
-		_fonts._charFor._lo = 29;
-		_fonts._charFor._hi = 32;
-
-		_screen->_maxChars = 37;
-		_screen->_printOrg = _screen->_printStart = Common::Point(48, 35);
-	}
+	_fonts._charSet._lo = 1;
+	_fonts._charSet._hi = 10;
+	_fonts._charFor._lo = 29;
+	_fonts._charFor._hi = 32;
+	_screen->_maxChars = 37;
+	_screen->_printOrg = _screen->_printStart = Common::Point(48, 35);
 
 	loadEstablish(estabIndex);
 	uint16 msgOffset;


Commit: cef8a20a3b2397df403f68a701f1a8388685e6cf
    https://github.com/scummvm/scummvm/commit/cef8a20a3b2397df403f68a701f1a8388685e6cf
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Rename game enum vals to match ScummVM style

Changed paths:
    engines/access/access.cpp
    engines/access/asurface.cpp
    engines/access/bubble_box.cpp
    engines/access/char.cpp
    engines/access/debugger.cpp
    engines/access/detection.h
    engines/access/detection_tables.h
    engines/access/metaengine.cpp
    engines/access/player.cpp
    engines/access/resources.cpp
    engines/access/room.cpp
    engines/access/screen.cpp
    engines/access/scripts.cpp
    engines/access/sound.cpp


diff --git a/engines/access/access.cpp b/engines/access/access.cpp
index df1b068b6c3..245eff682ca 100644
--- a/engines/access/access.cpp
+++ b/engines/access/access.cpp
@@ -171,7 +171,7 @@ void AccessEngine::initialize() {
 	// Create sub-objects of the engine
 	_animation = new AnimationManager(this);
 	_bubbleBox = new BubbleBox(this, TYPE_2, 64, 32, 130, 122, 0, 0, 0, 0, "");
-	if (getGameID() == GType_MartianMemorandum) {
+	if (getGameID() == kGameMartianMemorandum) {
 		_helpBox = new BubbleBox(this, TYPE_1, 64, 24, 146, 122, 1, 32, 2, 76, "HELP");
 		_travelBox = new BubbleBox(this, TYPE_1, 64, 32, 194, 122, 1, 24, 2, 74, "TRAVEL");
 		_invBox = new BubbleBox(this, TYPE_1, 64, 32, 146, 122, 1, 32, 2, 76, "INVENTORY");
diff --git a/engines/access/asurface.cpp b/engines/access/asurface.cpp
index c7c2e85c49f..3eb6ce63e72 100644
--- a/engines/access/asurface.cpp
+++ b/engines/access/asurface.cpp
@@ -56,7 +56,7 @@ SpriteFrame::SpriteFrame(const AccessEngine *vm, Common::SeekableReadStream *str
 	int xSize = stream->readUint16LE();
 	int ySize = stream->readUint16LE();
 
-	if (vm->getGameID() == GType_MartianMemorandum) {
+	if (vm->getGameID() == kGameMartianMemorandum) {
 		int size = stream->readUint16LE();
 		if (size != frameSize)
 			warning("Unexpected file difference: framesize %d - size %d %d - unknown %d", frameSize, xSize, ySize, size);
diff --git a/engines/access/bubble_box.cpp b/engines/access/bubble_box.cpp
index d9052b987ff..28636c2a917 100644
--- a/engines/access/bubble_box.cpp
+++ b/engines/access/bubble_box.cpp
@@ -76,7 +76,7 @@ void BubbleBox::clearBubbles() {
 }
 
 void BubbleBox::placeBubble(const Common::String &msg) {
-	_vm->_screen->_maxChars = (_vm->getGameID() == GType_MartianMemorandum) ? 30 : 27;
+	_vm->_screen->_maxChars = (_vm->getGameID() == kGameMartianMemorandum) ? 30 : 27;
 	placeBubble1(msg);
 }
 
@@ -84,8 +84,8 @@ void BubbleBox::placeBubble1(const Common::String &msg) {
 	_bubbles.clear();
 	_vm->_fonts._charSet._lo = 1;
 	_vm->_fonts._charSet._hi = 8;
-	_vm->_fonts._charFor._lo = (_vm->getGameID() == GType_MartianMemorandum) ? 247 : 29;
-	_vm->_fonts._charFor._hi = (_vm->getGameID() == GType_MartianMemorandum) ? 255 : 32;
+	_vm->_fonts._charFor._lo = (_vm->getGameID() == kGameMartianMemorandum) ? 247 : 29;
+	_vm->_fonts._charFor._hi = (_vm->getGameID() == kGameMartianMemorandum) ? 255 : 32;
 
 	calcBubble(msg);
 
@@ -117,7 +117,7 @@ void BubbleBox::calcBubble(const Common::String &msg) {
 	int width = 0;
 	bool lastLine;
 	do {
-		if (_vm->getGameID() == GType_MartianMemorandum) {
+		if (_vm->getGameID() == kGameMartianMemorandum) {
 			lastLine = _vm->_fonts._font1->getLine(s, screen._maxChars, line, width, Font::kWidthInChars);
 			width = _vm->_fonts._font1->stringWidth(line);
 		} else {
@@ -130,7 +130,7 @@ void BubbleBox::calcBubble(const Common::String &msg) {
 		screen._printOrg.x = screen._printStart.x;
 	} while (!lastLine);
 
-	if (_vm->getGameID() == GType_MartianMemorandum) {
+	if (_vm->getGameID() == kGameMartianMemorandum) {
 		bounds.setWidth((_vm->_fonts._printMaxX / 16 + 2) * 16 + 2 + 1);
 		bounds.bottom = screen._printOrg.y + 4 + 1;
 	} else {
@@ -167,7 +167,7 @@ void BubbleBox::calcBubble(const Common::String &msg) {
 }
 
 void BubbleBox::printBubble(const Common::String &msg) {
-	if (_vm->getGameID() == GType_MartianMemorandum)
+	if (_vm->getGameID() == kGameMartianMemorandum)
 		printBubble_v1(msg);
 	else
 		printBubble_v2(msg);
@@ -233,7 +233,7 @@ void BubbleBox::printBubble_v2(const Common::String &msg) {
 
 void BubbleBox::drawBubble(int index) {
 	_bounds = _bubbles[index];
-	if (_vm->getGameID() == GType_MartianMemorandum) {
+	if (_vm->getGameID() == kGameMartianMemorandum) {
 		int btnSelected = 0;
 		doBox_v1(0, 0, btnSelected);
 	} else
diff --git a/engines/access/char.cpp b/engines/access/char.cpp
index c38843710d4..f1a1cba452c 100644
--- a/engines/access/char.cpp
+++ b/engines/access/char.cpp
@@ -30,7 +30,7 @@ CharEntry::CharEntry(const byte *data, AccessEngine *vm) {
 	Common::MemoryReadStream s(data, 999);
 
 	_charFlag = s.readByte();
-	if (vm->getGameID() != GType_Amazon || !vm->isCD()) {
+	if (vm->getGameID() != kGameAmazon || !vm->isCD()) {
 		_screenFile.load(s);
 		_estabIndex = s.readSint16LE();
 	} else {
@@ -40,7 +40,7 @@ CharEntry::CharEntry(const byte *data, AccessEngine *vm) {
 
 	_paletteFile.load(s);
 	_startColor = s.readUint16LE();
-	if (vm->getGameID() == GType_MartianMemorandum) {
+	if (vm->getGameID() == kGameMartianMemorandum) {
 		int lastColor = s.readUint16LE();
 		_numColors = lastColor - _startColor;
 	} else
@@ -153,10 +153,10 @@ void CharManager::charMenu() {
 	screen.saveScreen();
 	screen.setDisplayScan();
 
-	if (_vm->getGameID() == GType_MartianMemorandum) {
+	if (_vm->getGameID() == kGameMartianMemorandum) {
 		screen.plotImage(icons, 17, Common::Point(0, 184));
 		screen.plotImage(icons, 18, Common::Point(193, 184));
-	} else if (_vm->getGameID() == GType_Amazon) {
+	} else if (_vm->getGameID() == kGameAmazon) {
 		screen.plotImage(icons, 17, Common::Point(0, 176));
 		screen.plotImage(icons, 18, Common::Point(155, 176));
 	} else
diff --git a/engines/access/debugger.cpp b/engines/access/debugger.cpp
index 37b741f7683..4e4ab521182 100644
--- a/engines/access/debugger.cpp
+++ b/engines/access/debugger.cpp
@@ -44,7 +44,7 @@ static int strToInt(const char *s) {
 
 Debugger *Debugger::init(AccessEngine *vm) {
 	switch (vm->getGameID()) {
-	case GType_Amazon:
+	case kGameAmazon:
 		return new Amazon::AmazonDebugger(vm);
 	default:
 		return new Debugger(vm);
diff --git a/engines/access/detection.h b/engines/access/detection.h
index d019e5daf79..6c9f93aa63f 100644
--- a/engines/access/detection.h
+++ b/engines/access/detection.h
@@ -26,10 +26,10 @@
 
 namespace Access {
 
-enum {
-	GType_Amazon = 1,
-	GType_MartianMemorandum = 2,
-	GType_Noctropolis = 3
+enum AccessGameType {
+	kGameAmazon = 1,
+	kGameMartianMemorandum = 2,
+	kGameNoctropolis = 3
 };
 
 struct AccessGameDescription {
diff --git a/engines/access/detection_tables.h b/engines/access/detection_tables.h
index 18afcefca95..4a8d35fcdfc 100644
--- a/engines/access/detection_tables.h
+++ b/engines/access/detection_tables.h
@@ -35,7 +35,7 @@ static const AccessGameDescription gameDescriptions[] = {
 			ADGF_NO_FLAGS,
 			GUIO1(GUIO_NONE)
 		},
-		GType_Amazon,
+		kGameAmazon,
 		0
 	},
 
@@ -51,7 +51,7 @@ static const AccessGameDescription gameDescriptions[] = {
 			ADGF_NO_FLAGS,
 			GUIO1(GUIO_NONE)
 		},
-		GType_Amazon,
+		kGameAmazon,
 		0
 	},
 
@@ -66,7 +66,7 @@ static const AccessGameDescription gameDescriptions[] = {
 			ADGF_DEMO,
 			GUIO1(GUIO_NONE)
 		},
-		GType_Amazon,
+		kGameAmazon,
 		0
 	},
 
@@ -81,7 +81,7 @@ static const AccessGameDescription gameDescriptions[] = {
 			ADGF_CD,
 			GUIO1(GUIO_NONE)
 		},
-		GType_Amazon,
+		kGameAmazon,
 		0
 	},
 
@@ -96,7 +96,7 @@ static const AccessGameDescription gameDescriptions[] = {
 			ADGF_UNSTABLE,
 			GUIO1(GUIO_NONE)
 		},
-		GType_MartianMemorandum,
+		kGameMartianMemorandum,
 		0
 	},
 
@@ -111,7 +111,7 @@ static const AccessGameDescription gameDescriptions[] = {
 			ADGF_DEMO | ADGF_UNSTABLE,
 			GUIO1(GUIO_NONE)
 		},
-		GType_MartianMemorandum,
+		kGameMartianMemorandum,
 		0
 	},
 
diff --git a/engines/access/metaengine.cpp b/engines/access/metaengine.cpp
index a3f4fdbcd25..eaf1f0f9752 100644
--- a/engines/access/metaengine.cpp
+++ b/engines/access/metaengine.cpp
@@ -109,10 +109,10 @@ bool Access::AccessEngine::hasFeature(EngineFeature f) const {
 
 Common::Error AccessMetaEngine::createInstance(OSystem *syst, Engine **engine, const Access::AccessGameDescription *gd) const {
 	switch (gd->gameID) {
-	case Access::GType_Amazon:
+	case Access::kGameAmazon:
 		*engine = new Access::Amazon::AmazonEngine(syst, gd);
 		break;
-	case Access::GType_MartianMemorandum:
+	case Access::kGameMartianMemorandum:
 		*engine = new Access::Martian::MartianEngine(syst, gd);
 		break;
 	default:
diff --git a/engines/access/player.cpp b/engines/access/player.cpp
index efba602317a..f45d5cb90d7 100644
--- a/engines/access/player.cpp
+++ b/engines/access/player.cpp
@@ -31,10 +31,10 @@ namespace Access {
 
 Player *Player::init(AccessEngine *vm) {
 	switch (vm->getGameID()) {
-	case GType_Amazon:
+	case kGameAmazon:
 		vm->_playerDataCount = 8;
 		return new Amazon::AmazonPlayer(vm);
-	case GType_MartianMemorandum:
+	case kGameMartianMemorandum:
 		vm->_playerDataCount = 10;
 		return new Martian::MartianPlayer(vm);
 	default:
@@ -668,11 +668,11 @@ void Player::plotCom(int flags) {
 }
 
 void Player::plotCom0() {
-	plotCom(_vm->getGameID() == GType_Amazon ? 0 : IMGFLAG_BACKWARDS);
+	plotCom(_vm->getGameID() == kGameAmazon ? 0 : IMGFLAG_BACKWARDS);
 }
 
 void Player::plotCom1() {
-	plotCom(_vm->getGameID() == GType_Amazon ? IMGFLAG_BACKWARDS : 0);
+	plotCom(_vm->getGameID() == kGameAmazon ? IMGFLAG_BACKWARDS : 0);
 }
 
 void Player::plotCom2() {
diff --git a/engines/access/resources.cpp b/engines/access/resources.cpp
index 9ec2300d2da..fc3a8017b34 100644
--- a/engines/access/resources.cpp
+++ b/engines/access/resources.cpp
@@ -28,9 +28,9 @@
 namespace Access {
 
 Resources *Resources::init(AccessEngine *vm) {
-	if (vm->getGameID() == GType_Amazon)
+	if (vm->getGameID() == kGameAmazon)
 		return new Amazon::AmazonResources(vm);
-	else if (vm->getGameID() == GType_MartianMemorandum)
+	else if (vm->getGameID() == kGameMartianMemorandum)
 		return new Martian::MartianResources(vm);
 
 	error("Unknown game");
diff --git a/engines/access/room.cpp b/engines/access/room.cpp
index 67c281a3029..b072b470b8a 100644
--- a/engines/access/room.cpp
+++ b/engines/access/room.cpp
@@ -176,7 +176,7 @@ void Room::doRoom() {
 			_vm->_events->pollEventsAndWait();
 			_vm->_canSaveLoad = false;
 
-			if ((_vm->getGameID() == GType_MartianMemorandum) && (_vm->_player->_roomNumber == 47)) {
+			if ((_vm->getGameID() == kGameMartianMemorandum) && (_vm->_player->_roomNumber == 47)) {
 				takePicture();
 			} else {
 				_vm->_player->walk();
@@ -232,8 +232,8 @@ void Room::doRoom() {
 				} else {
 					_vm->plotList();
 
-					if (((_vm->getGameID() == GType_MartianMemorandum) && (_vm->_events->_mousePos.y < 184)) ||
-						((_vm->getGameID() == GType_Amazon) && (_vm->_events->_mousePos.y < 177)))
+					if (((_vm->getGameID() == kGameMartianMemorandum) && (_vm->_events->_mousePos.y < 184)) ||
+						((_vm->getGameID() == kGameAmazon) && (_vm->_events->_mousePos.y < 177)))
 						_vm->_events->setCursor(_vm->_events->_normalMouse);
 					else
 						_vm->_events->setCursor(CURSOR_ARROW);
@@ -608,7 +608,7 @@ void Room::executeCommand(int commandId) {
 	Screen &screen = *_vm->_screen;
 	_selectCommand = commandId;
 
-	if (_vm->getGameID() == GType_MartianMemorandum) {
+	if (_vm->getGameID() == kGameMartianMemorandum) {
 		switch (commandId) {
 		case 4:
 			events.setCursor(CURSOR_ARROW);
@@ -698,7 +698,7 @@ void Room::executeCommand(int commandId) {
 	const SpriteResource *icons = _vm->getIcons();
 
 	// Draw the button as selected
-	if (_vm->getGameID() == GType_MartianMemorandum) {
+	if (_vm->getGameID() == kGameMartianMemorandum) {
 		screen.plotImage(icons, 0, Common::Point(5, 184));
 		screen.plotImage(icons, 1, Common::Point(155, 184));
 	} else {
@@ -706,7 +706,7 @@ void Room::executeCommand(int commandId) {
 		screen.plotImage(icons, 1, Common::Point(143, 177));
 	}
 	screen.plotImage(icons, _selectCommand + 2,
-		Common::Point(_rMouse[_selectCommand][0], (_vm->getGameID() == GType_MartianMemorandum) ? 184 : 176));
+		Common::Point(_rMouse[_selectCommand][0], (_vm->getGameID() == kGameMartianMemorandum) ? 184 : 176));
 
 	_vm->_screen->restoreScreen();
 	_vm->_boxSelect = true;
@@ -927,7 +927,7 @@ RoomInfo::RoomInfo(const byte *data, int gameType, bool isCD, bool isDemo) {
 	_roomFlag = stream.readByte();
 
 	_estIndex = -1;
-	if (gameType == GType_Amazon && isCD)
+	if (gameType == kGameAmazon && isCD)
 		_estIndex = stream.readSint16LE();
 
 	_musicFile.load(stream);
diff --git a/engines/access/screen.cpp b/engines/access/screen.cpp
index f1d11647498..4f6e6d6a70f 100644
--- a/engines/access/screen.cpp
+++ b/engines/access/screen.cpp
@@ -124,7 +124,7 @@ void Screen::setManPalette() {
 }
 
 void Screen::setIconPalette() {
-	if (_vm->getGameID() == GType_MartianMemorandum) {
+	if (_vm->getGameID() == kGameMartianMemorandum) {
 		for (int i = 0; i < 0x1B; i++) {
 			_rawPalette[741 + i] = PALETTE_6BIT_TO_8BIT(Martian::ICON_PALETTE[i]);
 		}
diff --git a/engines/access/scripts.cpp b/engines/access/scripts.cpp
index c209f5beb35..8a92bb58aa7 100644
--- a/engines/access/scripts.cpp
+++ b/engines/access/scripts.cpp
@@ -203,7 +203,7 @@ void Scripts::printWatch() {
 	int width = 0;
 	bool lastLine;
 	do {
-		if (_vm->getGameID() == GType_MartianMemorandum)
+		if (_vm->getGameID() == kGameMartianMemorandum)
 			lastLine = _vm->_fonts._font2->getLine(msg, _vm->_screen->_maxChars, line, width, Font::kWidthInChars);
 		else
 			lastLine = _vm->_fonts._font2->getLine(msg, _vm->_screen->_maxChars * 6, line, width);
@@ -330,7 +330,7 @@ void Scripts::cmdPrint_v1() {
 }
 
 void Scripts::printString(const Common::String &msg) {
-	if (_vm->getGameID() != GType_MartianMemorandum) {
+	if (_vm->getGameID() != kGameMartianMemorandum) {
 		_vm->_screen->_printOrg = Common::Point(20, 42);
 		_vm->_screen->_printStart = Common::Point(20, 42);
 		_vm->_timers[PRINT_TIMER]._timer = 50;
@@ -780,7 +780,7 @@ void Scripts::cmdSpecial() {
 
 		// WORKAROUND: This fixes scene establishment being re-shown
 		// when restoring savegames in rooms which have one
-		if (_vm->getGameID() == GType_Amazon && !_vm->isCD())
+		if (_vm->getGameID() == kGameAmazon && !_vm->isCD())
 			_vm->_establishTable[p2] = true;
 	}
 }
@@ -813,7 +813,7 @@ void Scripts::cmdCharSpeak() {
 void Scripts::cmdTexSpeak() {
 	_vm->_screen->_printOrg = _texsOrg;
 	_vm->_screen->_printStart = _texsOrg;
-	_vm->_screen->_maxChars = (_vm->getGameID() == GType_MartianMemorandum) ? 23 : 20;
+	_vm->_screen->_maxChars = (_vm->getGameID() == kGameMartianMemorandum) ? 23 : 20;
 
 	byte v;
 	Common::String tmpStr = "";
@@ -834,7 +834,7 @@ void Scripts::cmdTexChoice() {
 	_vm->_fonts._charSet._hi = 8;
 	_vm->_fonts._charFor._hi = 255;
 
-	if (_vm->getGameID() == GType_MartianMemorandum) {
+	if (_vm->getGameID() == kGameMartianMemorandum) {
 		_vm->_fonts._charFor._lo = 247;
 		_vm->_screen->_maxChars = 23;
 	} else {
@@ -856,7 +856,7 @@ void Scripts::cmdTexChoice() {
 	_vm->_bubbleBox->calcBubble(tmpStr);
 	_vm->_bubbleBox->printBubble(tmpStr);
 
-	const int responseYOff = (_vm->getGameID() == GType_MartianMemorandum) ? 20 : 11;
+	const int responseYOff = (_vm->getGameID() == kGameMartianMemorandum) ? 20 : 11;
 
 	Common::Array<Common::Rect> responseCoords;
 	responseCoords.push_back(_vm->_bubbleBox->_bounds);
@@ -903,7 +903,7 @@ void Scripts::cmdTexChoice() {
 
 		_vm->_bubbleBox->_bubbleDisplStr = _vm->_bubbleBox->_bubbleTitle;
 		if (_vm->_events->_leftButton) {
-			if (_vm->_events->_mouseRow >= ((_vm->getGameID() == GType_MartianMemorandum) ? 23 : 22)) {
+			if (_vm->_events->_mouseRow >= ((_vm->getGameID() == kGameMartianMemorandum) ? 23 : 22)) {
 				_vm->_events->debounceLeft();
 				int x = _vm->_events->_mousePos.x;
 				choice = _vm->_res->inButtonXRange(x);
diff --git a/engines/access/sound.cpp b/engines/access/sound.cpp
index 8beb49ebabf..dac578a349e 100644
--- a/engines/access/sound.cpp
+++ b/engines/access/sound.cpp
@@ -230,7 +230,7 @@ MusicManager::MusicManager(AccessEngine *vm) : _vm(vm) {
 	//
 	switch (musicType) {
 	case MT_ADLIB: {
-		if (_vm->getGameID() == GType_Amazon && !_vm->isDemo()) {
+		if (_vm->getGameID() == kGameAmazon && !_vm->isDemo()) {
 			Resource   *midiDrvResource = _vm->_files->loadFile(92, 1);
 			Common::MemoryReadStream *adLibInstrumentStream = new Common::MemoryReadStream(midiDrvResource->data(), midiDrvResource->_size);
 


Commit: a2e5b921777ae90cb9b66dcfa398d0ac2302eba0
    https://github.com/scummvm/scummvm/commit/a2e5b921777ae90cb9b66dcfa398d0ac2302eba0
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Ensure nullptr always at end of inventory

Fixes inventory display in MM where the dat file doesn't include a null.  Also
make the code a bit cleaner by using Common::Array instead of malloc.

Changed paths:
    engines/access/bubble_box.cpp
    engines/access/bubble_box.h
    engines/access/inventory.cpp


diff --git a/engines/access/bubble_box.cpp b/engines/access/bubble_box.cpp
index 28636c2a917..ad3e8967306 100644
--- a/engines/access/bubble_box.cpp
+++ b/engines/access/bubble_box.cpp
@@ -768,7 +768,7 @@ int BubbleBox::doBox_v1(int item, int box, int &btnSelected) {
 	return retval_;
 }
 
-void BubbleBox::getList(const char *const data[], int *flags) {
+void BubbleBox::getList(const char *const data[], const int *flags) {
 	int srcIdx = 0;
 	int destIdx = 0;
 	while (data[srcIdx]) {
diff --git a/engines/access/bubble_box.h b/engines/access/bubble_box.h
index 8fd3c3889ad..283992155b7 100644
--- a/engines/access/bubble_box.h
+++ b/engines/access/bubble_box.h
@@ -102,7 +102,7 @@ public:
 	void doBox(int item, int box);
 
 	int doBox_v1(int item, int box, int &btnSelected);
-	void getList(const char *const data[], int *flags);
+	void getList(const char *const data[], const int *flags);
 	void setCursorPos(int posX, int posY);
 	void printString(Common::String msg);
 };
diff --git a/engines/access/inventory.cpp b/engines/access/inventory.cpp
index 01ac3763000..b3ac345f611 100644
--- a/engines/access/inventory.cpp
+++ b/engines/access/inventory.cpp
@@ -211,15 +211,17 @@ int InventoryManager::newDisplayInv() {
 }
 
 int InventoryManager::displayInv() {
-	int *inv = (int *) malloc(_vm->_res->INVENTORY.size() * sizeof(int));
-	const char **names = (const char **)malloc(_vm->_res->INVENTORY.size() * sizeof(const char *));
+	size_t invSize = _vm->_res->INVENTORY.size();
 
-	for (uint i = 0; i < _vm->_res->INVENTORY.size(); i++) {
-		inv[i] = _inv[i]._value;
-		names[i] = _inv[i]._name.c_str();
+	Common::Array<int> invNums(invSize + 1);
+	Common::Array<const char *> invNames(invSize + 1);
+
+	for (size_t i = 0; i < invSize; i++) {
+		invNums[i] = _inv[i]._value;
+		invNames[i] = _inv[i]._name.c_str();
 	}
 	_vm->_events->forceSetCursor(CURSOR_CROSSHAIRS);
-	_vm->_invBox->getList(names, inv);
+	_vm->_invBox->getList(invNames.data(), invNums.data());
 
 	int btnSelected = 0;
 	int boxX = _vm->_invBox->doBox_v1(_startInvItem, _startInvBox, btnSelected);
@@ -234,8 +236,6 @@ int InventoryManager::displayInv() {
 	else
 		_vm->_useItem = -1;
 
-	free(names);
-	free(inv);
 	return 0;
 }
 


Commit: 3839333672e13d5ef97a4c06b9976f8fb7484edd
    https://github.com/scummvm/scummvm/commit/3839333672e13d5ef97a4c06b9976f8fb7484edd
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Fix rendering of MM inventory

Changed paths:
    engines/access/access.cpp
    engines/access/bubble_box.cpp


diff --git a/engines/access/access.cpp b/engines/access/access.cpp
index 245eff682ca..6e1fa112cea 100644
--- a/engines/access/access.cpp
+++ b/engines/access/access.cpp
@@ -172,10 +172,11 @@ void AccessEngine::initialize() {
 	_animation = new AnimationManager(this);
 	_bubbleBox = new BubbleBox(this, TYPE_2, 64, 32, 130, 122, 0, 0, 0, 0, "");
 	if (getGameID() == kGameMartianMemorandum) {
-		_helpBox = new BubbleBox(this, TYPE_1, 64, 24, 146, 122, 1, 32, 2, 76, "HELP");
-		_travelBox = new BubbleBox(this, TYPE_1, 64, 32, 194, 122, 1, 24, 2, 74, "TRAVEL");
-		_invBox = new BubbleBox(this, TYPE_1, 64, 32, 146, 122, 1, 32, 2, 76, "INVENTORY");
-		_aboutBox = new BubbleBox(this, TYPE_1, 64, 32, 194, 122, 1, 32, 2, 76, "ASK ABOUT");
+		// Note: add 1 more pixel to width and height to get the right box size.
+		_helpBox = new BubbleBox(this, TYPE_1, 64, 24, 147, 123, 1, 32, 2, 76, "HELP");
+		_travelBox = new BubbleBox(this, TYPE_1, 64, 32, 195, 123, 1, 24, 2, 74, "TRAVEL");
+		_invBox = new BubbleBox(this, TYPE_1, 64, 32, 147, 123, 1, 32, 2, 76, "INVENTORY");
+		_aboutBox = new BubbleBox(this, TYPE_1, 64, 32, 195, 123, 1, 32, 2, 76, "ASK ABOUT");
 	} else {
 		_helpBox = nullptr;
 		_travelBox = nullptr;
diff --git a/engines/access/bubble_box.cpp b/engines/access/bubble_box.cpp
index ad3e8967306..0e515cc290e 100644
--- a/engines/access/bubble_box.cpp
+++ b/engines/access/bubble_box.cpp
@@ -340,7 +340,7 @@ void BubbleBox::doBox(int item, int box) {
 }
 
 void BubbleBox::setCursorPos(int posX, int posY) {
-	Common::Point newPt =  Common::Point(posX * 8, posY * 8 + _boxPStartY);
+	Common::Point newPt =  Common::Point(posX * 8, posY * 8 + _rowOff);
 	_vm->_screen->_printStart = _vm->_screen->_printOrg = newPt;
 	// This function (at 0x6803) calculates something from a lookup table, but
 	// never does anything with it.
@@ -372,7 +372,7 @@ void BubbleBox::displayBoxData() {
 		_vm->_events->hideCursor();
 
 		_vm->_screen->_orgX1 = _boxStartX;
-		_vm->_screen->_orgX2 = _boxEndX;
+		_vm->_screen->_orgX2 = _boxEndX + 1;
 		_vm->_screen->_orgY1 = _boxStartY;
 		_vm->_screen->_orgY2 = _boxEndY;
 		_vm->_screen->_lColor = 0xFA;
@@ -514,8 +514,9 @@ int BubbleBox::doBox_v1(int item, int box, int &btnSelected) {
 	int tmpX = 0;
 	int tmpY = 0;
 	if (_type != TYPE_2) {
+		// Draw the button background at the bottom
 		oldY = _vm->_screen->_orgY1;
-		--_vm->_screen->_orgY2;
+		//--_vm->_screen->_orgY2;
 		_vm->_screen->_orgY1 = _vm->_screen->_orgY2 - 8;
 		if (_type == TYPE_3)
 			_vm->_screen->_orgY1 -= 8;
@@ -597,23 +598,24 @@ int BubbleBox::doBox_v1(int item, int box, int &btnSelected) {
 		_vm->_screen->drawLine();
 	}
 
+	// Draw the box title
 	int displStrLen = _bubbleDisplStr.size();
 
 	_boxPStartX = _bounds.left / 8;
-	int newX = (_boxPStartX + _bounds.width() / 8 - displStrLen) / 2;
+	int newX = _boxPStartX + (_bounds.width() / 8 - displStrLen) / 2;
 
-	int _rowOff = _bounds.top / 8;
-	_boxPStartY = 1 - (_rowOff * 8 - _bounds.top);
-	if (_boxPStartY == 8) {
-		_boxPStartY = 0;
-		++_rowOff;
+	_boxPStartY = _bounds.top / 8;
+	_rowOff = 1 - (_boxPStartY * 8 - _bounds.top);
+	if (_rowOff == 8) {
+		_rowOff = 0;
+		++_boxPStartY;
 	}
 
-	retval_ = _boxPStartY;
+	retval_ = _rowOff;
 
-	setCursorPos(newX, _rowOff);
+	setCursorPos(newX, _boxPStartY);
 
-	_vm->_fonts._charFor._lo = 0xFF;
+	Font::_fontColors[1] = _vm->_fonts._charFor._lo = 0xFF;
 	_vm->_fonts._bitFont->drawString(_vm->_screen, _bubbleDisplStr, _vm->_screen->_printOrg);
 
 	if (_type == TYPE_2) {


Commit: 77990dec0997d7197b167f1cc648227458919d03
    https://github.com/scummvm/scummvm/commit/77990dec0997d7197b167f1cc648227458919d03
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Clean up unnecessary export

Changed paths:
    engines/access/access.h
    engines/access/amazon/amazon_game.cpp


diff --git a/engines/access/access.h b/engines/access/access.h
index 0b621099ea5..128c347bda5 100644
--- a/engines/access/access.h
+++ b/engines/access/access.h
@@ -105,8 +105,6 @@ static const AccessActionCode _accessActionCodes[] = {
 	{ kActionHelp, 8 },
 };
 
-extern const char *const _estTable[];
-
 #define ACCESS_SAVEGAME_VERSION 1
 
 struct AccessSavegameHeader {
diff --git a/engines/access/amazon/amazon_game.cpp b/engines/access/amazon/amazon_game.cpp
index 4cfa0878c34..0aa3af035eb 100644
--- a/engines/access/amazon/amazon_game.cpp
+++ b/engines/access/amazon/amazon_game.cpp
@@ -181,7 +181,7 @@ void AmazonEngine::initVariables() {
 	_player->_playerOff = false;
 
 	// Setup timers
-	const int TIMER_DEFAULTS[] = { 3, 10, 8, 1, 1, 1, 1, 2 };
+	static const int TIMER_DEFAULTS[] = { 3, 10, 8, 1, 1, 1, 1, 2 };
 	for (int i = 0; i < 32; ++i) {
 		TimerEntry te;
 		te._initTm = te._timer = (i < 8) ? TIMER_DEFAULTS[i] : 1;
@@ -209,14 +209,14 @@ void AmazonEngine::establishCenter(int screenId, int esatabIndex) {
 	doEstablish(screenId, esatabIndex);
 }
 
-const char *const _estTable[] = { "ETEXT0.DAT", "ETEXT1.DAT", "ETEXT2.DAT", "ETEXT3.DAT" };
+static const char *const EST_TABLE[] = { "ETEXT0.DAT", "ETEXT1.DAT", "ETEXT2.DAT", "ETEXT3.DAT" };
 
 void AmazonEngine::loadEstablish(int estabIndex) {
 	if (!_files->existFile("ETEXT.DAT")) {
 		int oldGroup = _establishGroup;
 		_establishGroup = 0;
 
-		_establish = _files->loadFile(_estTable[oldGroup]);
+		_establish = _files->loadFile(EST_TABLE[oldGroup]);
 		_establishCtrlTblOfs = READ_LE_UINT16(_establish->data());
 
 		int ofs = _establishCtrlTblOfs + (estabIndex * 2);


Commit: 7d0f71d303fe277295df1f8f81c984abe1fa2a92
    https://github.com/scummvm/scummvm/commit/7d0f71d303fe277295df1f8f81c984abe1fa2a92
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Remove some magic numbers

Changed paths:
    engines/access/screen.cpp


diff --git a/engines/access/screen.cpp b/engines/access/screen.cpp
index 4f6e6d6a70f..15aeac915c6 100644
--- a/engines/access/screen.cpp
+++ b/engines/access/screen.cpp
@@ -70,7 +70,7 @@ Screen::Screen(AccessEngine *vm) : _vm(vm) {
 	_endCycle = 0;
 	_fadeIn = false;
 
-	for (int i = 0; i < 768; ++i) {
+	for (int i = 0; i < Graphics::PALETTE_SIZE; ++i) {
 		_rawPalette[i] = 0;
 		_savedPalettes[0][i] = 0;
 		_savedPalettes[1][i] = 0;
@@ -231,7 +231,7 @@ void Screen::setBufferScan() {
 
 void Screen::setScaleTable(int scale) {
 	int total = 0;
-	for (int idx = 0; idx < 256; ++idx) {
+	for (int idx = 0; idx < ARRAYSIZE(_scaleTable1); ++idx) {
 		_scaleTable1[idx] = total >> 8;
 		_scaleTable2[idx] = total & 0xff;
 		total += scale;


Commit: 51613a54b07b5a8108cf22a90dad5b49a461c5bb
    https://github.com/scummvm/scummvm/commit/51613a54b07b5a8108cf22a90dad5b49a461c5bb
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Fix watch rendering in MM

Changed paths:
    engines/access/scripts.cpp


diff --git a/engines/access/scripts.cpp b/engines/access/scripts.cpp
index 8a92bb58aa7..27bf449244b 100644
--- a/engines/access/scripts.cpp
+++ b/engines/access/scripts.cpp
@@ -180,7 +180,7 @@ void Scripts::clearWatch() {
 	_vm->_screen->_orgX1 = 128;
 	_vm->_screen->_orgY1 = 57;
 	_vm->_screen->_orgX2 = 228;
-	_vm->_screen->_orgY2 = 106;
+	_vm->_screen->_orgY2 = 106 + 1;
 	_vm->_screen->_lColor = 0;
 	_vm->_screen->drawRect();
 
@@ -192,6 +192,7 @@ void Scripts::printWatch() {
 	_vm->_fonts._charSet._hi = 2;
 	_vm->_fonts._charFor._lo = 2;
 	_vm->_fonts._charFor._hi = 255;
+	Font::_fontColors[3] = 2;
 
 	_vm->_screen->_maxChars = 19;
 	_vm->_screen->_printOrg = Common::Point(128, 58);
@@ -203,12 +204,10 @@ void Scripts::printWatch() {
 	int width = 0;
 	bool lastLine;
 	do {
-		if (_vm->getGameID() == kGameMartianMemorandum)
-			lastLine = _vm->_fonts._font2->getLine(msg, _vm->_screen->_maxChars, line, width, Font::kWidthInChars);
-		else
-			lastLine = _vm->_fonts._font2->getLine(msg, _vm->_screen->_maxChars * 6, line, width);
+		lastLine = _vm->_fonts._font2->getLine(msg, _vm->_screen->_maxChars, line, width, Font::kWidthInChars);
+
 		// Draw the text
-		_vm->_bubbleBox->printString(line);
+		_vm->_fonts._font2->drawString(_vm->_screen, line, _vm->_screen->_printOrg);
 
 		_vm->_screen->_printOrg.y += 6;
 		_vm->_screen->_printOrg.x = _vm->_screen->_printStart.x;


Commit: d0835f9ad8683b9fdbe1baffc578958e036bb93c
    https://github.com/scummvm/scummvm/commit/d0835f9ad8683b9fdbe1baffc578958e036bb93c
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Small const correctness fixes

Changed paths:
    engines/access/amazon/amazon_game.cpp
    engines/access/decompress.cpp
    engines/access/decompress.h
    engines/access/screen.cpp
    engines/access/sound.cpp


diff --git a/engines/access/amazon/amazon_game.cpp b/engines/access/amazon/amazon_game.cpp
index 0aa3af035eb..f8795b7f9bb 100644
--- a/engines/access/amazon/amazon_game.cpp
+++ b/engines/access/amazon/amazon_game.cpp
@@ -605,7 +605,7 @@ void AmazonEngine::startChapter(int chapter) {
 	_establishGroup = 1;
 	loadEstablish(0x40 + _chapter);
 
-	byte *entryOffset = _establish->data() + ((0x40 + _chapter) * 2);
+	const byte *entryOffset = _establish->data() + ((0x40 + _chapter) * 2);
 	if (isCD())
 		entryOffset += 2;
 
diff --git a/engines/access/decompress.cpp b/engines/access/decompress.cpp
index d1c0003b377..80949ca4e93 100644
--- a/engines/access/decompress.cpp
+++ b/engines/access/decompress.cpp
@@ -27,7 +27,7 @@
 
 namespace Access {
 
-void LzwDecompressor::decompress(byte *source, byte *dest) {
+void LzwDecompressor::decompress(const byte *source, byte *dest) {
 
 	_source = source;
 
@@ -131,7 +131,7 @@ uint16 LzwDecompressor::getCode() {
 	return result;
 }
 
-uint32 decompressDBE(byte *source, byte **dest) {
+uint32 decompressDBE(const byte *source, byte **dest) {
 
 	uint32 destSize = READ_LE_UINT32(source + 4);
 	*dest = new byte[destSize];
diff --git a/engines/access/decompress.h b/engines/access/decompress.h
index f0899e8564c..a333559eb95 100644
--- a/engines/access/decompress.h
+++ b/engines/access/decompress.h
@@ -28,15 +28,15 @@ namespace Access {
 
 class LzwDecompressor {
 public:
-	void decompress(byte *source, byte *dest);
+	void decompress(const byte *source, byte *dest);
 private:
-	byte *_source;
+	const byte *_source;
 	byte _sourceBitsLeft;
 	byte _codeLength;
 	uint16 getCode();
 };
 
-uint32 decompressDBE(byte *source, byte **dest);
+uint32 decompressDBE(const byte *source, byte **dest);
 
 } // End of namespace Access
 
diff --git a/engines/access/screen.cpp b/engines/access/screen.cpp
index 15aeac915c6..7c3f7fe0900 100644
--- a/engines/access/screen.cpp
+++ b/engines/access/screen.cpp
@@ -133,7 +133,7 @@ void Screen::setIconPalette() {
 
 void Screen::loadPalette(int fileNum, int subfile) {
 	Resource *res = _vm->_files->loadFile(fileNum, subfile);
-	byte *palette = res->data();
+	const byte *palette = res->data();
 	Common::copy(palette, palette + (_numColors * 3), &_rawPalette[_startColor * 3]);
 	delete res;
 }
diff --git a/engines/access/sound.cpp b/engines/access/sound.cpp
index dac578a349e..eb5084b7e96 100644
--- a/engines/access/sound.cpp
+++ b/engines/access/sound.cpp
@@ -101,7 +101,7 @@ void SoundManager::playSound(int soundIndex, bool loop) {
 void SoundManager::playSound(Resource *res, int priority, bool loop, int soundIndex) {
 	debugC(1, kDebugSound, "playSound");
 
-	byte *resourceData = res->data();
+	const byte *resourceData = res->data();
 
 	assert(res->_size >= 32);
 


Commit: 9538b81fff97b038fdee0bdbcbbb93279dbb2596
    https://github.com/scummvm/scummvm/commit/9538b81fff97b038fdee0bdbcbbb93279dbb2596
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Fix first cutscene in MM

Fixes a few small bugs in the way special 0 worked.

Changed paths:
    engines/access/bubble_box.cpp
    engines/access/martian/martian_scripts.cpp
    engines/access/scripts.cpp
    engines/access/video.cpp


diff --git a/engines/access/bubble_box.cpp b/engines/access/bubble_box.cpp
index 0e515cc290e..c160da1aced 100644
--- a/engines/access/bubble_box.cpp
+++ b/engines/access/bubble_box.cpp
@@ -709,7 +709,7 @@ int BubbleBox::doBox_v1(int item, int box, int &btnSelected) {
 
 		if ((_vm->_events->_mousePos.x >= _boxStartX) && (_vm->_events->_mousePos.x <= _boxEndX)
 		&&  (_vm->_events->_mousePos.y >= _boxStartY) && (_vm->_events->_mousePos.y <= _boxEndY)) {
-			int val = (_vm->_events->_mousePos.x >> 3) - _boxPStartY;
+			int val = (_vm->_events->_mousePos.y >> 3) - _boxPStartY;
 			if (val > _vm->_bcnt)
 				continue;
 			--val;
diff --git a/engines/access/martian/martian_scripts.cpp b/engines/access/martian/martian_scripts.cpp
index 97e92a4a135..9a6fa5407c4 100644
--- a/engines/access/martian/martian_scripts.cpp
+++ b/engines/access/martian/martian_scripts.cpp
@@ -50,28 +50,40 @@ void MartianScripts::cmdSpecial0() {
 
 	_vm->_video->setVideo(_vm->_screen, Common::Point(46, 30), "HVID.VID", 20);
 
+	warning("TODO: MartianScripts::cmdSpecial0: Work out how to get timing right");
 	do {
 		_vm->_video->playVideo();
+		_vm->_events->pollEvents();
 		if (_vm->_video->_videoFrame == 4) {
 			_vm->_screen->flashPalette(16);
 			_vm->_sound->playSound(4);
 			do {
 				_vm->_events->pollEvents();
 			} while (!_vm->shouldQuit() && _vm->_sound->_playingSound);
-			_vm->_timers[31]._timer = _vm->_timers[31]._initTm = 40;
+			//
+			// TODO:
+			//
+			// The original sets these, probably to hold the video until the sound finishes?
+			// But, if we do that they never get past frame 4, because in the next iteration
+			// of the loop the timer is still "counting down", so we stay on frame 4 forever.
+			//
+			// Need to double-check the exact flow of the original here.
+			//
+			//_vm->_timers[31]._timer = _vm->_timers[31]._initTm = 40;
 		}
 	} while (!_vm->_video->_videoEnd && !_vm->shouldQuit());
 
-	if (_vm->_video->_videoEnd) {
-		_vm->_screen->flashPalette(12);
-		_vm->_sound->playSound(4);
-		do {
-			_vm->_events->pollEvents();
-		} while (!_vm->shouldQuit() && _vm->_sound->_playingSound);
-		_vm->_midi->stopSong();
-		_vm->_midi->freeMusic();
-		warning("TODO: Pop Midi");
-	}
+	if (_vm->shouldQuit())
+		return;
+
+	_vm->_screen->flashPalette(12);
+	_vm->_sound->playSound(4);
+	do {
+		_vm->_events->pollEvents();
+	} while (!_vm->shouldQuit() && _vm->_sound->_playingSound);
+	_vm->_midi->stopSong();
+	_vm->_midi->freeMusic();
+	warning("TODO: Pop Midi");
 }
 
 void MartianScripts::cmdSpecial1(int param1) {
diff --git a/engines/access/scripts.cpp b/engines/access/scripts.cpp
index 27bf449244b..149f84ab44d 100644
--- a/engines/access/scripts.cpp
+++ b/engines/access/scripts.cpp
@@ -764,8 +764,8 @@ void Scripts::cmdSpecial() {
 	int p1 = _data->readUint16LE();
 	int p2 = _data->readUint16LE();
 
-	if (_specialFunction == 1) {
-		if (_vm->_establishTable[p2])
+	if (_specialFunction == 1 || _vm->getGameID() == kGameMartianMemorandum) {
+		if (_vm->getGameID() == kGameAmazon && _vm->_establishTable[p2])
 			return;
 
 		_vm->_screen->savePalette();
@@ -773,7 +773,7 @@ void Scripts::cmdSpecial() {
 
 	executeSpecial(_specialFunction, p1, p2);
 
-	if (_specialFunction == 1) {
+	if (_specialFunction == 1 || _vm->getGameID() == kGameMartianMemorandum) {
 		_vm->_screen->restorePalette();
 		_vm->_room->_function = FN_RELOAD;
 
diff --git a/engines/access/video.cpp b/engines/access/video.cpp
index 9a857b39c25..81fe0c6da90 100644
--- a/engines/access/video.cpp
+++ b/engines/access/video.cpp
@@ -112,7 +112,7 @@ void VideoPlayer::getFrame() {
 void VideoPlayer::playVideo() {
 	if (_vm->_timers[31]._flag)
 		return;
-	++_vm->_timers[31]._flag;
+	_vm->_timers[31]._flag = 1;
 
 	byte *pDest = _startCoord;
 	byte *pLine = _startCoord;


Commit: a8da0b68854d5b5f5f189ed6056f4bb092bfa6ff
    https://github.com/scummvm/scummvm/commit/a8da0b68854d5b5f5f189ed6056f4bb092bfa6ff
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Add some MM-specific data to saves

Probably other data needs saving too, but without travel and ask data the game
can't progress.

Changed paths:
    engines/access/access.h
    engines/access/bubble_box.cpp
    engines/access/bubble_box.h
    engines/access/inventory.cpp
    engines/access/martian/martian_game.cpp
    engines/access/martian/martian_game.h
    engines/access/scripts.cpp


diff --git a/engines/access/access.h b/engines/access/access.h
index 128c347bda5..238d1ff8a07 100644
--- a/engines/access/access.h
+++ b/engines/access/access.h
@@ -238,8 +238,8 @@ public:
 
 	// Fields used by MM
 	// TODO: Refactor
-	int _travel[60];
-	int _ask[40];
+	byte _travel[60];
+	byte _ask[40];
 	int _startTravelItem;
 	int _startTravelBox;
 	int _startAboutItem;
@@ -252,7 +252,7 @@ public:
 	byte _byte26CB5;
 	int _bcnt;
 	//byte *_tempList;
-	int _pictureTaken;
+	int16 _pictureTaken;
 	//
 
 	bool _vidEnd;
diff --git a/engines/access/bubble_box.cpp b/engines/access/bubble_box.cpp
index c160da1aced..381206e2e47 100644
--- a/engines/access/bubble_box.cpp
+++ b/engines/access/bubble_box.cpp
@@ -770,7 +770,7 @@ int BubbleBox::doBox_v1(int item, int box, int &btnSelected) {
 	return retval_;
 }
 
-void BubbleBox::getList(const char *const data[], const int *flags) {
+void BubbleBox::getList(const char *const data[], const byte *flags) {
 	int srcIdx = 0;
 	int destIdx = 0;
 	while (data[srcIdx]) {
diff --git a/engines/access/bubble_box.h b/engines/access/bubble_box.h
index 283992155b7..05146159f85 100644
--- a/engines/access/bubble_box.h
+++ b/engines/access/bubble_box.h
@@ -102,7 +102,7 @@ public:
 	void doBox(int item, int box);
 
 	int doBox_v1(int item, int box, int &btnSelected);
-	void getList(const char *const data[], const int *flags);
+	void getList(const char *const data[], const byte *flags);
 	void setCursorPos(int posX, int posY);
 	void printString(Common::String msg);
 };
diff --git a/engines/access/inventory.cpp b/engines/access/inventory.cpp
index b3ac345f611..f5362bd6e98 100644
--- a/engines/access/inventory.cpp
+++ b/engines/access/inventory.cpp
@@ -213,7 +213,7 @@ int InventoryManager::newDisplayInv() {
 int InventoryManager::displayInv() {
 	size_t invSize = _vm->_res->INVENTORY.size();
 
-	Common::Array<int> invNums(invSize + 1);
+	Common::Array<byte> invNums(invSize + 1);
 	Common::Array<const char *> invNames(invSize + 1);
 
 	for (size_t i = 0; i < invSize; i++) {
diff --git a/engines/access/martian/martian_game.cpp b/engines/access/martian/martian_game.cpp
index d2dd6d89d53..8600ac17102 100644
--- a/engines/access/martian/martian_game.cpp
+++ b/engines/access/martian/martian_game.cpp
@@ -350,6 +350,37 @@ void MartianEngine::dead(int deathId) {
 	_events->pollEvents();
 }
 
+void MartianEngine::synchronize(Common::Serializer &s) {
+	AccessEngine::synchronize(s);
+
+	for (int i = 0; i < ARRAYSIZE(_travel); i++) {
+		s.syncAsByte(_travel[i]);
+	}
+
+	for (int i = 0; i < ARRAYSIZE(_ask); i++) {
+		s.syncAsByte(_ask[i]);
+	}
+
+	s.syncAsSint16LE(_pictureTaken);
+
+	/*
+	TODO: Do any of these need to be synchronized here?
+	Mostly involved in modal dialogs.
+	_startTravelItem
+	_startTravelBox
+	_startAboutItem
+	_startAboutBox
+	_byte26CB5
+	_bcnt
+	_boxDataStart
+	_boxDataEnd
+	_boxSelectY
+	_boxSelectYOld
+	_numLines
+	*/
+}
+
+
 } // End of namespace Martian
 
 } // End of namespace Access
diff --git a/engines/access/martian/martian_game.h b/engines/access/martian/martian_game.h
index 9c677aa42e4..3db1b19af60 100644
--- a/engines/access/martian/martian_game.h
+++ b/engines/access/martian/martian_game.h
@@ -33,6 +33,7 @@ private:
 	bool _skipStart;
 	SpriteResource *_introObjects;
 	Common::MemoryReadStream *_creditsStream;
+
 	/**
 	 * Do the game introduction
 	 */
@@ -68,6 +69,11 @@ public:
 	void doSpecial5(int param1);
 	void showDeathText(Common::String msg);
 	void establish(int esatabIndex, int sub) override {};
+
+	/**
+	* Synchronize savegame data
+	*/
+	void synchronize(Common::Serializer &s) override;
 };
 
 } // End of namespace Martian
diff --git a/engines/access/scripts.cpp b/engines/access/scripts.cpp
index 149f84ab44d..535dbf5ae3c 100644
--- a/engines/access/scripts.cpp
+++ b/engines/access/scripts.cpp
@@ -546,7 +546,7 @@ void Scripts::cmdDispInv_v2() {
 
 void Scripts::cmdSetAbout() {
 	int idx = _data->readByte();
-	int val = _data->readByte();
+	byte val = _data->readByte();
 	_vm->_ask[idx] = val;
 	_vm->_startAboutBox = _vm->_startAboutItem = 0;
 }
@@ -591,7 +591,7 @@ void Scripts::cmdCheckTimer() {
 
 void Scripts::cmdSetTravel() {
 	int idx = _data->readByte();
-	int dest = _data->readByte();
+	byte dest = _data->readByte();
 	_vm->_travel[idx] = dest;
 	_vm->_startTravelItem = _vm->_startTravelBox = 0;
 }
@@ -751,7 +751,7 @@ void Scripts::cmdHelp_v1() {
 
 void Scripts::cmdCheckAbout() {
 	int idx = _data->readSint16LE();
-	int val = _data->readSint16LE();
+	int16 val = _data->readSint16LE();
 
 	if (_vm->_ask[idx] == val)
 		cmdGoto();
@@ -1045,7 +1045,7 @@ void Scripts::cmdPushLocation() {
 
 void Scripts::cmdCheckTravel() {
 	int idx = _data->readSint16LE();
-	int val = _data->readUint16LE();
+	uint16 val = _data->readUint16LE();
 
 	if (_vm->_travel[idx] == val)
 		cmdGoto();


Commit: d896d831417018ed3581b0723ae6d2bc1be9368c
    https://github.com/scummvm/scummvm/commit/d896d831417018ed3581b0723ae6d2bc1be9368c
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Filter MM inventory list to unused items only

When picking up the mail at the start, the mail itself goes in the inventory
and then is instantly marked "USED".  It should not appear in the inventory
after that.

Changed paths:
    engines/access/inventory.cpp


diff --git a/engines/access/inventory.cpp b/engines/access/inventory.cpp
index f5362bd6e98..7ae18dcdeb2 100644
--- a/engines/access/inventory.cpp
+++ b/engines/access/inventory.cpp
@@ -213,15 +213,17 @@ int InventoryManager::newDisplayInv() {
 int InventoryManager::displayInv() {
 	size_t invSize = _vm->_res->INVENTORY.size();
 
-	Common::Array<byte> invNums(invSize + 1);
+	Common::Array<byte> invFlags(invSize + 1);
 	Common::Array<const char *> invNames(invSize + 1);
 
+	// Only show items that are in the inventory, skip "used".
 	for (size_t i = 0; i < invSize; i++) {
-		invNums[i] = _inv[i]._value;
+		byte flag = (_inv[i]._value == ITEM_IN_INVENTORY) ? 1 : 0;
+		invFlags[i] = flag;
 		invNames[i] = _inv[i]._name.c_str();
 	}
 	_vm->_events->forceSetCursor(CURSOR_CROSSHAIRS);
-	_vm->_invBox->getList(invNames.data(), invNums.data());
+	_vm->_invBox->getList(invNames.data(), invFlags.data());
 
 	int btnSelected = 0;
 	int boxX = _vm->_invBox->doBox_v1(_startInvItem, _startInvBox, btnSelected);


Commit: a793a625059899861f84b74bc7f7f1f48c2aa785
    https://github.com/scummvm/scummvm/commit/a793a625059899861f84b74bc7f7f1f48c2aa785
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Fix scrolling around with the camera in MM

There were various issues with the rendering of the video of the dancing person
in the window.  Still some graphical glitches but I think I've eliminated the
crashes.

Changed paths:
    engines/access/asurface.cpp
    engines/access/events.cpp
    engines/access/events.h
    engines/access/martian/martian_player.cpp
    engines/access/martian/martian_room.cpp
    engines/access/room.cpp
    engines/access/scripts.cpp
    engines/access/video.cpp


diff --git a/engines/access/asurface.cpp b/engines/access/asurface.cpp
index 3eb6ce63e72..fdd76f566b7 100644
--- a/engines/access/asurface.cpp
+++ b/engines/access/asurface.cpp
@@ -245,6 +245,8 @@ void BaseSurface::moveBufferDown() {
 	Common::copy_backward(p, p + (pitch * (h - TILE_HEIGHT)), p + (pitch * h));
 }
 
+/* For compatibility with the original logic, true return means the
+   rect is *outside* the clip region. */
 bool BaseSurface::clip(Common::Rect &r) {
 	int skip;
 	_leftSkip = _rightSkip = 0;
diff --git a/engines/access/events.cpp b/engines/access/events.cpp
index 4d081d32286..89afcf57cd2 100644
--- a/engines/access/events.cpp
+++ b/engines/access/events.cpp
@@ -344,7 +344,7 @@ Common::Point EventsManager::calcRawMouse() {
 	return pt;
 }
 
-int EventsManager::checkMouseBox1(Common::Array<Common::Rect> &rects) {
+int EventsManager::checkMouseBox1(const Common::Array<Common::Rect> &rects) {
 	for (uint16 i = 0; i < rects.size(); ++i) {
 		if (rects[i].left == -1)
 			return -1;
diff --git a/engines/access/events.h b/engines/access/events.h
index 0b31e32de7a..fca94bdb8dc 100644
--- a/engines/access/events.h
+++ b/engines/access/events.h
@@ -145,7 +145,7 @@ public:
 
 	Common::Point calcRawMouse();
 
-	int checkMouseBox1(Common::Array<Common::Rect> &rects);
+	int checkMouseBox1(const Common::Array<Common::Rect> &rects);
 
 	bool isKeyActionMousePressed();
 
diff --git a/engines/access/martian/martian_player.cpp b/engines/access/martian/martian_player.cpp
index 39d57a755bb..64c44886af7 100644
--- a/engines/access/martian/martian_player.cpp
+++ b/engines/access/martian/martian_player.cpp
@@ -59,6 +59,8 @@ void MartianPlayer::load() {
 	_upWalkMax = 14;
 	_downWalkMin = 15;
 	_downWalkMax = 23;
+
+	// playerPalette is configured in Player::load.
 }
 
 } // End of namespace Martian
diff --git a/engines/access/martian/martian_room.cpp b/engines/access/martian/martian_room.cpp
index 724a3bcc525..7267ca81bc0 100644
--- a/engines/access/martian/martian_room.cpp
+++ b/engines/access/martian/martian_room.cpp
@@ -61,6 +61,7 @@ void MartianRoom::reloadRoom() {
 }
 
 void MartianRoom::reloadRoom1() {
+	// aka initScene
 	_selectCommand = -1;
 	_vm->_boxSelect = false; //-1
 	_vm->_player->_playerOff = false;
diff --git a/engines/access/room.cpp b/engines/access/room.cpp
index b072b470b8a..ff9d42d5092 100644
--- a/engines/access/room.cpp
+++ b/engines/access/room.cpp
@@ -80,12 +80,20 @@ void Room::clearCamera() {
 }
 
 void Room::takePicture() {
+	// aka specialFuncRoomNumber47
 	_vm->_events->pollEvents();
-	if (!_vm->_events->_leftButton)
+	if (!_vm->_events->_leftButton) {
+		// WORKAROUND: The original doesn't reset player move direction here
+		// because it handles mouse/keyboard differently, but we need to reset
+		// after mouse-up, otherwise the next click anywhere not on a button
+		// will repeat the previous move.
+		_vm->_player->_move = NONE;
 		return;
+	}
 
 	Common::Array<Common::Rect> pictureCoords;
 	for (int i = 0; Martian::PICTURERANGE[i][0] != -1; i += 2) {
+		// PICTURERANGE is min/max X, min/max Y
 		pictureCoords.push_back(Common::Rect(Martian::PICTURERANGE[i][0], Martian::PICTURERANGE[i + 1][0],
 			                                 Martian::PICTURERANGE[i][1], Martian::PICTURERANGE[i + 1][1]));
 	}
@@ -93,6 +101,7 @@ void Room::takePicture() {
 	int result = _vm->_events->checkMouseBox1(pictureCoords);
 
 	if (result == 4) {
+		// Take picture button
 		_vm->_events->debounceLeft();
 		if (_vm->_inventory->_inv[44]._value != ITEM_IN_INVENTORY) {
 			Common::String msg = "YOU HAVE NO MORE FILM.";
@@ -124,6 +133,7 @@ void Room::takePicture() {
 		clearCamera();
 		return;
 	} else if (result == 5) {
+		// Exit button
 		if (_vm->_flags[26] != 2) {
 			_vm->_video->closeVideo();
 			_vm->_video->_videoEnd = true;
@@ -418,7 +428,7 @@ void Room::buildColumn(int playX, int screenX) {
 		_playFieldWidth + playX;
 
 	// WORKAROUND: Original's use of '+ 1' would frequently cause memory overruns
-	int h = MIN(_vm->_screen->_vWindowHeight + 1, _playFieldHeight);
+	int h = MIN(_vm->_screen->_vWindowHeight + 1, _playFieldHeight - _vm->_scrollRow);
 
 	for (int y = 0; y < h; ++y) {
 		byte *pTile = _tile + (*pSrc << 8);
@@ -439,10 +449,10 @@ void Room::buildRow(int playY, int screenY) {
 		return;
 	assert(screenY <= (_vm->_screen->h - TILE_HEIGHT));
 
-	const byte *pSrc = _playField + playY *_playFieldWidth + _vm->_scrollCol;
+	const byte *pSrc = _playField + playY * _playFieldWidth + _vm->_scrollCol;
 
 	// WORKAROUND: Original's use of '+ 1' would frequently cause memory overruns
-	int w = MIN(_vm->_screen->_vWindowWidth + 1, _playFieldWidth);
+	int w = MIN(_vm->_screen->_vWindowWidth + 1, _playFieldWidth - _vm->_scrollCol);
 
 	for (int x = 0; x < w; ++x) {
 		byte *pTile = _tile + (*pSrc << 8);
diff --git a/engines/access/scripts.cpp b/engines/access/scripts.cpp
index 535dbf5ae3c..fefba1c99a8 100644
--- a/engines/access/scripts.cpp
+++ b/engines/access/scripts.cpp
@@ -649,6 +649,7 @@ void Scripts::cmdSaveRect() {
 	int y = _vm->_screen->_lastBoundsY;
 	int w = _vm->_screen->_lastBoundsW;
 	int h = _vm->_screen->_lastBoundsH;
+	assert(x >= 0 && y >= 0 && x < 320 && y < 200 && w > 0 && h > 0 && w <= 320 && h <= 200);
 	_vm->_newRects.push_back(Common::Rect(x, y, x + w, x + h));
 }
 
diff --git a/engines/access/video.cpp b/engines/access/video.cpp
index 81fe0c6da90..6de588e6f34 100644
--- a/engines/access/video.cpp
+++ b/engines/access/video.cpp
@@ -77,8 +77,11 @@ void VideoPlayer::setVideo(BaseSurface *vidSurface, const Common::Point &pt, int
 			_videoData->_stream->read(pDest, _xCount);
 		}
 
-		if (vidSurface == _vm->_screen)
+		if (vidSurface == _vm->_screen) {
+			assert(pt.x >= 0 && pt.y >= 0 && pt.x < 320 && pt.y < 200 &&
+				_xCount > 0 && _xCount <= 320 && _scanCount > 0 && _scanCount <= 200);
 			_vm->_newRects.push_back(Common::Rect(pt.x, pt.y, pt.x + _xCount, pt.y + _scanCount));
+		}
 
 		getFrame();
 	}
@@ -166,6 +169,7 @@ void VideoPlayer::playVideo() {
 }
 
 void VideoPlayer::copyVideo() {
+	// aka drawTalkVideoFrame
 	_vm->_player->calcPlayer();
 
 	// Figure out the dirty rect area for the video frame
@@ -173,16 +177,19 @@ void VideoPlayer::copyVideo() {
 		_vm->_vidY - _vm->_screen->_bufferStart.y,
 		_vm->_vidX - _vm->_screen->_bufferStart.x + _header._width,
 		_vm->_vidY - _vm->_screen->_bufferStart.y + _header._height);
-	if (!_vm->_screen->clip(r))
+	if (_vm->_screen->clip(r))
 		return;
+	assert(r.left >= 0 && r.left < 320 && r.top >= 0 && r.top < 200 &&
+		r.right > 0 && r.right <= 320 && r.bottom > 0 && r.bottom <= 200);
 	_vm->_newRects.push_back(r);
 
-	int vh = _header._height;
-	int vw = _header._width;
-	int destIdx = _vm->_vidX - _vm->_screen->_bufferStart.x;
-	int srcIdx = _vm->_screen->_leftSkip;
-	for (int i = 0; i < _vm->_screen->_topSkip; i++)
-		destIdx += 160;
+	int vh = r.height();
+	int vw = r.width();
+	int destIdx = r.left + r.top * _vm->_buffer2.pitch;
+	int srcIdx = _vm->_screen->_leftSkip + _vm->_screen->_topSkip * _vm->_vidBuf.pitch;
+
+	assert (srcIdx >= 0);
+	assert (destIdx >= 0);
 
 	const byte *srcP = (const byte *)_vm->_vidBuf.getPixels() + srcIdx;
 	byte *destP = (byte *)_vm->_buffer2.getPixels() + destIdx;


Commit: 392a25f83ab356c849f47a412ea4f0d5bc748268
    https://github.com/scummvm/scummvm/commit/392a25f83ab356c849f47a412ea4f0d5bc748268
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Convert loops to C++11 style for slightly cleaner code

Changed paths:
    engines/access/access.cpp
    engines/access/access.h
    engines/access/animation.cpp
    engines/access/asurface.cpp
    engines/access/bubble_box.cpp
    engines/access/char.cpp
    engines/access/font.cpp
    engines/access/resources.cpp
    engines/access/room.cpp
    engines/access/sound.cpp
    engines/access/sound.h
    engines/access/video.cpp


diff --git a/engines/access/access.cpp b/engines/access/access.cpp
index 6e1fa112cea..706bb3e9637 100644
--- a/engines/access/access.cpp
+++ b/engines/access/access.cpp
@@ -235,10 +235,11 @@ int AccessEngine::getRandomNumber(int maxNumber) {
 	return _randomSource.getRandomNumber(maxNumber);
 }
 
-void AccessEngine::loadCells(Common::Array<CellIdent> &cells) {
-	for (uint i = 0; i < cells.size(); ++i) {
-		Resource *spriteData = _files->loadFile(cells[i]);
-		_objectsTable[cells[i]._cell] = new SpriteResource(this, spriteData);
+void AccessEngine::loadCells(const Common::Array<CellIdent> &cells) {
+	for (const auto &cell : cells) {
+		Resource *spriteData = _files->loadFile(cell);
+		assert(_objectsTable[cell._cell] == nullptr); // ensure no leaks
+		_objectsTable[cell._cell] = new SpriteResource(this, spriteData);
 		delete spriteData;
 	}
 }
@@ -419,8 +420,8 @@ void AccessEngine::plotList1() {
 
 void AccessEngine::copyBlocks() {
 	// Copy the block list from the previous frame
-	for (uint i = 0; i < _oldRects.size(); ++i) {
-		_screen->copyBlock(&_buffer2, _oldRects[i]);
+	for (const auto &rect : _oldRects) {
+		_screen->copyBlock(&_buffer2, rect);
 	}
 
 	copyRects();
@@ -428,9 +429,9 @@ void AccessEngine::copyBlocks() {
 
 void AccessEngine::copyRects() {
 	_oldRects.clear();
-	for (uint i = 0; i < _newRects.size(); ++i) {
-		_screen->copyBlock(&_buffer2, _newRects[i]);
-		_oldRects.push_back(_newRects[i]);
+	for (const auto &rect : _newRects) {
+		_screen->copyBlock(&_buffer2, rect);
+		_oldRects.push_back(rect);
 	}
 }
 
diff --git a/engines/access/access.h b/engines/access/access.h
index 238d1ff8a07..3a31283053c 100644
--- a/engines/access/access.h
+++ b/engines/access/access.h
@@ -284,7 +284,7 @@ public:
 
 	const SpriteResource *getIcons();
 
-	void loadCells(Common::Array<CellIdent> &cells);
+	void loadCells(const Common::Array<CellIdent> &cells);
 
 	/**
 	* Free the sprites list
diff --git a/engines/access/animation.cpp b/engines/access/animation.cpp
index c30e4ce7488..74f71029197 100644
--- a/engines/access/animation.cpp
+++ b/engines/access/animation.cpp
@@ -42,8 +42,8 @@ AnimationResource::AnimationResource(AccessEngine *vm, Resource *res) {
 }
 
 AnimationResource::~AnimationResource() {
-	for (int i = 0; i < (int)_animations.size(); ++i)
-		delete _animations[i];
+	for (auto *animation : _animations)
+		delete animation;
 }
 
 /*------------------------------------------------------------------------*/
@@ -80,8 +80,8 @@ Animation::Animation(AccessEngine *vm, Common::SeekableReadStream *stream) : Man
 	while ((ofs = stream->readUint16LE()) != 0)
 		frameOffsets.push_back(ofs);
 
-	for (int i = 0; i < (int)frameOffsets.size(); i++) {
-		stream->seek(startOfs + frameOffsets[i]);
+	for (uint16 frameOffset : frameOffsets) {
+		stream->seek(startOfs + frameOffset);
 
 		AnimationFrame *frame = new AnimationFrame(stream, startOfs);
 		_frames.push_back(frame);
@@ -89,8 +89,8 @@ Animation::Animation(AccessEngine *vm, Common::SeekableReadStream *stream) : Man
 }
 
 Animation::~Animation() {
-	for (uint i = 0; i < _frames.size(); ++i)
-		delete _frames[i];
+	for (auto *frame : _frames)
+		delete frame;
 }
 
 typedef void(Animation::*AnimationMethodPtr)();
@@ -228,8 +228,7 @@ void Animation::setFrame1(AnimationFrame *frame) {
 	_vm->_animation->_base.y = frame->_baseY;
 
 	// Loop to add image draw requests for the parts of the frame
-	for (uint i = 0; i < frame->_parts.size(); ++i) {
-		AnimationFramePart *part = frame->_parts[i];
+	for (const AnimationFramePart *part: frame->_parts) {
 		ImageEntry ie;
 
 		// Set the flags
@@ -269,8 +268,8 @@ AnimationFrame::AnimationFrame(Common::SeekableReadStream *stream, int startOffs
 }
 
 AnimationFrame::~AnimationFrame() {
-	for (int i = 0; i < (int)_parts.size(); ++i)
-		delete _parts[i];
+	for (auto *part : _parts)
+		delete part;
 }
 
 /*------------------------------------------------------------------------*/
@@ -342,9 +341,9 @@ void AnimationManager::animate(int animId) {
 }
 
 void AnimationManager::updateTimers() {
-	for (uint idx = 0; idx < _animationTimers.size(); ++idx) {
-		if (_animationTimers[idx]->_countdownTicks > 0)
-			_animationTimers[idx]->_countdownTicks--;
+	for (auto *timer : _animationTimers) {
+		if (timer->_countdownTicks > 0)
+			timer->_countdownTicks--;
 	}
 }
 
diff --git a/engines/access/asurface.cpp b/engines/access/asurface.cpp
index fdd76f566b7..d084fa8e209 100644
--- a/engines/access/asurface.cpp
+++ b/engines/access/asurface.cpp
@@ -48,8 +48,8 @@ SpriteResource::SpriteResource(const AccessEngine *vm, Resource *res) {
 }
 
 SpriteResource::~SpriteResource() {
-	for (uint i = 0; i < _frames.size(); ++i)
-		delete _frames[i];
+	for (auto *frame : _frames)
+		delete frame;
 }
 
 SpriteFrame::SpriteFrame(const AccessEngine *vm, Common::SeekableReadStream *stream, int frameSize) {
diff --git a/engines/access/bubble_box.cpp b/engines/access/bubble_box.cpp
index 381206e2e47..4ffc6fe3329 100644
--- a/engines/access/bubble_box.cpp
+++ b/engines/access/bubble_box.cpp
@@ -62,9 +62,8 @@ void BubbleBox::load(Common::SeekableReadStream *stream) {
 
 void BubbleBox::clearBubbles() {
 	// Loop through the bubble list to restore the screen areas
-	for (uint i = 0; i < _bubbles.size(); ++i) {
+	for (Common::Rect r: _bubbles) {
 		_vm->_screen->_screenYOff = 0;
-		Common::Rect r = _bubbles[i];
 		r.left -= 2;
 		r.right = MIN(r.right, (int16)_vm->_screen->w);
 
diff --git a/engines/access/char.cpp b/engines/access/char.cpp
index f1a1cba452c..434f701cfff 100644
--- a/engines/access/char.cpp
+++ b/engines/access/char.cpp
@@ -78,11 +78,11 @@ CharEntry::CharEntry() {
 
 CharManager::CharManager(AccessEngine *vm) : Manager(vm) {
 	// Setup character list
-	for (uint idx = 0; idx < _vm->_res->CHARTBL.size(); ++idx) {
-		if (_vm->_res->CHARTBL[idx].size() == 0)
+	for (const auto &charEntry: _vm->_res->CHARTBL) {
+		if (charEntry.size() == 0)
 			_charTable.push_back(CharEntry());
 		else
-			_charTable.push_back(CharEntry(&_vm->_res->CHARTBL[idx][0], _vm));
+			_charTable.push_back(CharEntry(charEntry.data(), _vm));
 	}
 
 	_charFlag = 0;
@@ -142,8 +142,8 @@ void CharManager::loadChar(int charId) {
 
 	// Load extra cells
 	_vm->_extraCells.clear();
-	for (uint i = 0; i < ce._extraCells.size(); ++i)
-		_vm->_extraCells.push_back(ce._extraCells[i]);
+	for (const auto &extraCell : ce._extraCells)
+		_vm->_extraCells.push_back(extraCell);
 }
 
 void CharManager::charMenu() {
diff --git a/engines/access/font.cpp b/engines/access/font.cpp
index 860ea07d551..78ad580ac47 100644
--- a/engines/access/font.cpp
+++ b/engines/access/font.cpp
@@ -29,8 +29,8 @@ Font::Font(byte firstCharIndex) : _firstCharIndex(firstCharIndex), _bitWidth(0),
 }
 
 Font::~Font() {
-	for (uint i = 0; i < _chars.size(); ++i)
-		_chars[i].free();
+	for (auto &fontChar : _chars)
+		fontChar.free();
 }
 
 int Font::charWidth(char c) {
diff --git a/engines/access/resources.cpp b/engines/access/resources.cpp
index fc3a8017b34..0a5fbc183b6 100644
--- a/engines/access/resources.cpp
+++ b/engines/access/resources.cpp
@@ -65,28 +65,28 @@ bool Resources::load(Common::U32String &errorMessage) {
 	// Load in the index
 	uint count = f.readUint16LE();
 	_datIndex.resize(count);
-	for (uint idx = 0; idx < _datIndex.size(); ++idx) {
-		_datIndex[idx]._gameId = f.readByte();
-		_datIndex[idx]._discType = f.readByte();
-		_datIndex[idx]._demoType = f.readByte();
+	for (auto &datEntry : _datIndex) {
+		datEntry._gameId = f.readByte();
+		datEntry._discType = f.readByte();
+		datEntry._demoType = f.readByte();
 
 		byte language = f.readByte();
 		switch (language) {
 		case 0:
-			_datIndex[idx]._language = (Common::Language)0;
+			datEntry._language = (Common::Language)0;
 			break;
 		case 5:
-			_datIndex[idx]._language = Common::EN_ANY;
+			datEntry._language = Common::EN_ANY;
 			break;
 		case 23:
-			_datIndex[idx]._language = Common::ES_ESP;
+			datEntry._language = Common::ES_ESP;
 			break;
 		default:
 			error("Unknown language");
 			break;
 		}
 
-		_datIndex[idx]._fileOffset = f.readUint32LE();
+		datEntry._fileOffset = f.readUint32LE();
 	}
 
 	// Load in the data for the game
@@ -151,8 +151,7 @@ void Resources::load(Common::SeekableReadStream &s) {
 }
 
 uint Resources::findEntry(byte gameId, byte discType, byte demoType, Common::Language language) {
-	for (uint idx = 0; idx < _datIndex.size(); ++idx) {
-		DATEntry &de = _datIndex[idx];
+	for (const DATEntry &de : _datIndex) {
 		if (de._gameId == gameId && de._discType == discType &&
 			de._demoType == demoType && de._language == language)
 			return de._fileOffset;
diff --git a/engines/access/room.cpp b/engines/access/room.cpp
index ff9d42d5092..426d3717a87 100644
--- a/engines/access/room.cpp
+++ b/engines/access/room.cpp
@@ -338,8 +338,8 @@ void Room::loadRoomData(const byte *roomData) {
 
 	// Load extra cells
 	_vm->_extraCells.clear();
-	for (uint i = 0; i < roomInfo._extraCells.size(); ++i)
-		_vm->_extraCells.push_back(roomInfo._extraCells[i]);
+	for (const auto extraCell : roomInfo._extraCells)
+		_vm->_extraCells.push_back(extraCell);
 
 	// Load sounds for the scene
 	_vm->_sound->loadSounds(roomInfo._sounds);
@@ -881,16 +881,14 @@ bool Room::codeWalls() {
 		}
 	}
 
-	for (uint i = 0; i < _jetFrame.size(); ++i) {
-		JetFrame &jf = _jetFrame[i];
+	for (const JetFrame &jf : _jetFrame) {
 		if (checkCode(jf._wallCode, jf._wallCodeOld) ||
 			checkCode(jf._wallCode1, jf._wallCode1Old))
 			return true;
 	}
 
 	// Copy the current wall calculations to the old properties
-	for (uint i = 0; i < _jetFrame.size(); ++i) {
-		JetFrame &jf = _jetFrame[i];
+	for (JetFrame &jf : _jetFrame) {
 		jf._wallCodeOld = jf._wallCode;
 		jf._wallCode1Old = jf._wallCode1;
 	}
diff --git a/engines/access/sound.cpp b/engines/access/sound.cpp
index eb5084b7e96..54fef1255f4 100644
--- a/engines/access/sound.cpp
+++ b/engines/access/sound.cpp
@@ -46,8 +46,8 @@ SoundManager::~SoundManager() {
 void SoundManager::clearSounds() {
 	debugC(1, kDebugSound, "clearSounds()");
 
-	for (uint i = 0; i < _soundTable.size(); ++i)
-		delete _soundTable[i]._res;
+	for (auto &sound : _soundTable)
+		delete sound._res;
 
 	_soundTable.clear();
 
@@ -186,14 +186,14 @@ bool SoundManager::isSFXPlaying() {
 	return _mixer->isSoundHandleActive(*_effectsHandle);
 }
 
-void SoundManager::loadSounds(Common::Array<RoomInfo::SoundIdent> &sounds) {
+void SoundManager::loadSounds(const Common::Array<RoomInfo::SoundIdent> &sounds) {
 	debugC(1, kDebugSound, "loadSounds");
 
 	clearSounds();
 
-	for (uint i = 0; i < sounds.size(); ++i) {
-		Resource *sound = loadSound(sounds[i]._fileNum, sounds[i]._subfile);
-		_soundTable.push_back(SoundEntry(sound, sounds[i]._priority));
+	for (const auto &sound : sounds) {
+		Resource *soundRes = loadSound(sound._fileNum, sound._subfile);
+		_soundTable.push_back(SoundEntry(soundRes, sound._priority));
 	}
 }
 
diff --git a/engines/access/sound.h b/engines/access/sound.h
index 9e663da3186..7b66d86a26f 100644
--- a/engines/access/sound.h
+++ b/engines/access/sound.h
@@ -78,7 +78,7 @@ public:
 	bool isSFXPlaying();
 
 	Resource *loadSound(int fileNum, int subfile);
-	void loadSounds(Common::Array<RoomInfo::SoundIdent> &sounds);
+	void loadSounds(const Common::Array<RoomInfo::SoundIdent> &sounds);
 
 	void stopSound();
 	void freeSounds();
diff --git a/engines/access/video.cpp b/engines/access/video.cpp
index 6de588e6f34..de8ea4340df 100644
--- a/engines/access/video.cpp
+++ b/engines/access/video.cpp
@@ -183,13 +183,14 @@ void VideoPlayer::copyVideo() {
 		r.right > 0 && r.right <= 320 && r.bottom > 0 && r.bottom <= 200);
 	_vm->_newRects.push_back(r);
 
+	// Draw the clipped video to the buffer
 	int vh = r.height();
 	int vw = r.width();
 	int destIdx = r.left + r.top * _vm->_buffer2.pitch;
 	int srcIdx = _vm->_screen->_leftSkip + _vm->_screen->_topSkip * _vm->_vidBuf.pitch;
 
-	assert (srcIdx >= 0);
-	assert (destIdx >= 0);
+	assert(srcIdx >= 0);
+	assert(destIdx >= 0);
 
 	const byte *srcP = (const byte *)_vm->_vidBuf.getPixels() + srcIdx;
 	byte *destP = (byte *)_vm->_buffer2.getPixels() + destIdx;


Commit: 23643333c98ac21874f8d3c4b76d5ff41c1000c0
    https://github.com/scummvm/scummvm/commit/23643333c98ac21874f8d3c4b76d5ff41c1000c0
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Correctly check when sfx is playing in MM scripts

Changed paths:
    engines/access/martian/martian_scripts.cpp
    engines/access/sound.cpp
    engines/access/sound.h


diff --git a/engines/access/martian/martian_scripts.cpp b/engines/access/martian/martian_scripts.cpp
index 9a6fa5407c4..d2727ee2719 100644
--- a/engines/access/martian/martian_scripts.cpp
+++ b/engines/access/martian/martian_scripts.cpp
@@ -59,7 +59,7 @@ void MartianScripts::cmdSpecial0() {
 			_vm->_sound->playSound(4);
 			do {
 				_vm->_events->pollEvents();
-			} while (!_vm->shouldQuit() && _vm->_sound->_playingSound);
+			} while (!_vm->shouldQuit() && _vm->_sound->isSFXPlaying());
 			//
 			// TODO:
 			//
@@ -80,7 +80,7 @@ void MartianScripts::cmdSpecial0() {
 	_vm->_sound->playSound(4);
 	do {
 		_vm->_events->pollEvents();
-	} while (!_vm->shouldQuit() && _vm->_sound->_playingSound);
+	} while (!_vm->shouldQuit() && _vm->_sound->isSFXPlaying());
 	_vm->_midi->stopSong();
 	_vm->_midi->freeMusic();
 	warning("TODO: Pop Midi");
@@ -203,7 +203,7 @@ void MartianScripts::cmdSpecial7() {
 
 	do {
 		_vm->_events->pollEvents();
-	} while (!_vm->shouldQuit() && _vm->_sound->_playingSound);
+	} while (!_vm->shouldQuit() && _vm->_sound->isSFXPlaying());
 
 	_game->_numAnimTimers = 0;
 	_vm->_animation->freeAnimationData();
@@ -270,7 +270,7 @@ void MartianScripts::cmdSpecial7() {
 	_vm->_sound->playSound(0);
 	do {
 		_vm->_events->pollEvents();
-	} while (!_vm->shouldQuit() && _vm->_sound->_playingSound);
+	} while (!_vm->shouldQuit() && _vm->_sound->isSFXPlaying());
 
 	_vm->_events->_vbCount = 80;
 	while (!_vm->shouldQuit() && _vm->_events->_vbCount > 0)
@@ -279,7 +279,7 @@ void MartianScripts::cmdSpecial7() {
 	_vm->_sound->playSound(1);
 	do {
 		_vm->_events->pollEvents();
-	} while (!_vm->shouldQuit() && _vm->_sound->_playingSound);
+	} while (!_vm->shouldQuit() && _vm->_sound->isSFXPlaying());
 
 	_vm->_events->_vbCount = 80;
 	while (!_vm->shouldQuit() && _vm->_events->_vbCount > 0)
@@ -288,7 +288,7 @@ void MartianScripts::cmdSpecial7() {
 	_vm->_sound->playSound(2);
 	do {
 		_vm->_events->pollEvents();
-	} while (!_vm->shouldQuit() && _vm->_sound->_playingSound);
+	} while (!_vm->shouldQuit() && _vm->_sound->isSFXPlaying());
 
 	_vm->_sound->freeSounds();
 
diff --git a/engines/access/sound.cpp b/engines/access/sound.cpp
index 54fef1255f4..1601857581c 100644
--- a/engines/access/sound.cpp
+++ b/engines/access/sound.cpp
@@ -35,7 +35,6 @@ namespace Access {
 
 SoundManager::SoundManager(AccessEngine *vm, Audio::Mixer *mixer) : _vm(vm), _mixer(mixer) {
 	_effectsHandle = new Audio::SoundHandle();
-	_playingSound = false;
 }
 
 SoundManager::~SoundManager() {
diff --git a/engines/access/sound.h b/engines/access/sound.h
index 7b66d86a26f..02920f76fcd 100644
--- a/engines/access/sound.h
+++ b/engines/access/sound.h
@@ -66,7 +66,6 @@ private:
 	bool isSoundQueued(int soundId) const;
 public:
 	Common::Array<SoundEntry> _soundTable;
-	bool _playingSound;
 public:
 	SoundManager(AccessEngine *vm, Audio::Mixer *mixer);
 	~SoundManager();


Commit: 27260c8f6104b1ab5e702e9c963d9c92e9646c9a
    https://github.com/scummvm/scummvm/commit/27260c8f6104b1ab5e702e9c963d9c92e9646c9a
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Implement cmdBlock for MM

This is used for example when you bore Rhonda to sleep in the Plaza Hotel.

Changed paths:
    engines/access/scripts.cpp


diff --git a/engines/access/scripts.cpp b/engines/access/scripts.cpp
index fefba1c99a8..cb80b54675a 100644
--- a/engines/access/scripts.cpp
+++ b/engines/access/scripts.cpp
@@ -1055,11 +1055,12 @@ void Scripts::cmdCheckTravel() {
 }
 
 void Scripts::cmdBlock() {
-	error("TODO: cmdBlock");
-	/*int val1 = */_data->readSint16LE();
-	/*int val2 = */_data->readUint16LE();
-	/*int val3 = */_data->readSint16LE();
-	/*int val4 = */_data->readUint16LE();
+	int x = _data->readSint16LE();
+	int y = _data->readUint16LE();
+	int w = _data->readSint16LE();
+	int h = _data->readUint16LE();
+
+	_vm->_screen->blitFrom(_vm->_buffer2, Common::Rect(x, y, x + w, y + h), Common::Point(x, y));
 }
 
 void Scripts::cmdPlayerOff() {


Commit: 4f318593f0bdb25973d2deda042480b409b5bcbd
    https://github.com/scummvm/scummvm/commit/4f318593f0bdb25973d2deda042480b409b5bcbd
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Avoid left shift of negative numbers

Changed paths:
    engines/access/room.cpp


diff --git a/engines/access/room.cpp b/engines/access/room.cpp
index 426d3717a87..f660097a81f 100644
--- a/engines/access/room.cpp
+++ b/engines/access/room.cpp
@@ -805,7 +805,7 @@ int Room::calcLR(int yp) {
 	int yv = (yp - screen._orgY1) * (screen._orgX2 - screen._orgX1);
 	int yd = screen._orgY2 - screen._orgY1;
 
-	int rem = (yv % yd) << 1;
+	int rem = (yv % yd) * 2;
 	yv /= yd;
 	if (rem >= yd || rem < 0)
 		++yv;
@@ -819,7 +819,7 @@ int Room::calcUD(int xp) {
 	int xv = (xp - screen._orgX1) * (screen._orgY2 - screen._orgY1);
 	int xd = screen._orgX2 - screen._orgX1;
 
-	int rem = (xv % xd) << 1;
+	int rem = (xv % xd) * 2;
 	xv /= xd;
 	if (rem >= xd || rem < 0)
 		++xv;


Commit: b31cfefcb7e864470e61fead29019ef67087c3d2
    https://github.com/scummvm/scummvm/commit/b31cfefcb7e864470e61fead29019ef67087c3d2
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Fix font color before showing list box

Changed paths:
    engines/access/bubble_box.cpp


diff --git a/engines/access/bubble_box.cpp b/engines/access/bubble_box.cpp
index 4ffc6fe3329..f07c5ba6285 100644
--- a/engines/access/bubble_box.cpp
+++ b/engines/access/bubble_box.cpp
@@ -355,6 +355,7 @@ void BubbleBox::displayBoxData() {
 	_rowOff = 2;
 	_vm->_fonts._charFor._lo = 0xF7;
 	_vm->_fonts._charFor._hi = 0xFF;
+	Font::_fontColors[3] = 247;
 
 	if (_tempList[0].size() == 0)
 		return;


Commit: 4c89f8a01e74ac5a3287a17a92151115d239a316
    https://github.com/scummvm/scummvm/commit/4c89f8a01e74ac5a3287a17a92151115d239a316
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Add debug statements to all the scripts cmd functions

Changed paths:
    engines/access/scripts.cpp


diff --git a/engines/access/scripts.cpp b/engines/access/scripts.cpp
index cb80b54675a..8036e43faf4 100644
--- a/engines/access/scripts.cpp
+++ b/engines/access/scripts.cpp
@@ -249,17 +249,22 @@ void Scripts::executeCommand(int commandIndex) {
 }
 
 void Scripts::cmdObject() {
+	debugC(1, kDebugScripts, "cmdObject()");
 	_vm->_bubbleBox->load(_data);
 }
 
 void Scripts::cmdEndObject() {
+	const char *msg;
 	if (_vm->getLanguage() == Common::ES_ESP)
-		printString(ESP_GENERAL_MESSAGES[_vm->_room->_selectCommand]);
+		msg = ESP_GENERAL_MESSAGES[_vm->_room->_selectCommand];
 	else
-		printString(GENERAL_MESSAGES[_vm->_room->_selectCommand]);
+		msg = GENERAL_MESSAGES[_vm->_room->_selectCommand];
+	debugC(1, kDebugScripts, "cmdEndObject(msg=\"%s\")", msg);
+	printString(msg);
 }
 
 void Scripts::cmdJumpLook() {
+	debugC(1, kDebugScripts, "cmdJumpLook(selectCommand=%d)", _vm->_room->_selectCommand);
 	if (_vm->_room->_selectCommand == 0)
 		cmdGoto();
 	else
@@ -267,6 +272,7 @@ void Scripts::cmdJumpLook() {
 }
 
 void Scripts::cmdJumpHelp() {
+	debugC(1, kDebugScripts, "cmdJumpHelp(selectCommand=%d)", _vm->_room->_selectCommand);
 	if (_vm->_room->_selectCommand == 8)
 		cmdGoto();
 	else
@@ -274,6 +280,7 @@ void Scripts::cmdJumpHelp() {
 }
 
 void Scripts::cmdJumpGet() {
+	debugC(1, kDebugScripts, "cmdJumpGet(selectCommand=%d)", _vm->_room->_selectCommand);
 	if (_vm->_room->_selectCommand == 3)
 		cmdGoto();
 	else
@@ -281,6 +288,7 @@ void Scripts::cmdJumpGet() {
 }
 
 void Scripts::cmdJumpMove() {
+	debugC(1, kDebugScripts, "cmdJumpMove(selectCommand=%d)", _vm->_room->_selectCommand);
 	if (_vm->_room->_selectCommand == 2)
 		cmdGoto();
 	else
@@ -288,6 +296,7 @@ void Scripts::cmdJumpMove() {
 }
 
 void Scripts::cmdJumpUse() {
+	debugC(1, kDebugScripts, "cmdJumpUse(selectCommand=%d)", _vm->_room->_selectCommand);
 	if (_vm->_room->_selectCommand == 4)
 		cmdGoto();
 	else
@@ -295,6 +304,7 @@ void Scripts::cmdJumpUse() {
 }
 
 void Scripts::cmdJumpTalk() {
+	debugC(1, kDebugScripts, "cmdJumpTalk(selectCommand=%d)", _vm->_room->_selectCommand);
 	if (_vm->_room->_selectCommand == 6)
 		cmdGoto();
 	else
@@ -302,6 +312,7 @@ void Scripts::cmdJumpTalk() {
 }
 
 void Scripts::cmdNull() {
+	debugC(1, kDebugScripts, "cmdNull()");
 }
 
 #define PRINT_TIMER 25
@@ -309,6 +320,7 @@ void Scripts::cmdNull() {
 void Scripts::cmdPrint_v2() {
 	// Get a text line for display
 	Common::String msg = readString();
+	debugC(1, kDebugScripts, "cmdPrint_v2(msg=\"%s\")", msg.c_str());
 	printString(msg);
 }
 
@@ -325,6 +337,7 @@ void Scripts::doCmdPrint_v1(const Common::String &msg) {
 
 void Scripts::cmdPrint_v1() {
 	Common::String msg = readString();
+	debugC(1, kDebugScripts, "cmdPrint_v1(msg=\"%s\")", msg.c_str());
 	doCmdPrint_v1(msg);
 }
 
@@ -360,18 +373,21 @@ Common::String Scripts::readString() {
 }
 
 void Scripts::cmdRetPos() {
+	debugC(1, kDebugScripts, "cmdRetPos()");
 	_endFlag = true;
 	_returnCode = 0;
 }
 
 void Scripts::cmdAnim() {
 	int animId = _data->readByte();
+	debugC(1, kDebugScripts, "cmdAnim(animId=%d)", animId);
 	_vm->_animation->animate(animId);
 }
 
 void Scripts::cmdSetFlag() {
 	int flagNum = _data->readByte();
 	byte flagVal = _data->readByte();
+	debugC(1, kDebugScripts, "cmdSetFlag(flagNum=%d, flagVal=%d)", flagNum, flagVal);
 	assert(flagNum < 256);
 
 	_vm->_flags[flagNum] = flagVal;
@@ -380,6 +396,7 @@ void Scripts::cmdSetFlag() {
 void Scripts::cmdCheckFlag() {
 	int flagNum = _data->readUint16LE();
 	int flagVal = _data->readUint16LE();
+	debugC(1, kDebugScripts, "cmdCheckFlag(flagNum=%d, flagVal=%d)", flagNum, flagVal);
 	assert(flagNum < 256);
 
 	if (_vm->_flags[flagNum] == flagVal)
@@ -390,17 +407,19 @@ void Scripts::cmdCheckFlag() {
 
 void Scripts::cmdGoto() {
 	_sequence = _data->readUint16LE();
+	debugC(1, kDebugScripts, "cmdGoto(sequence=%d)", _sequence);
 	searchForSequence();
 }
 
 void Scripts::cmdAddScore() {
+	debugC(1, kDebugScripts, "cmdAddScore()");
 	_data->skip(1);
 }
 
 void Scripts::cmdSetInventory() {
 	int itemId = _data->readByte();
 	int itemVal = _data->readByte();
-
+	debugC(1, kDebugScripts, "cmdSetInventory(itemId=%d, itemVal=%d)", itemId, itemVal);
 	(*_vm->_inventory)[itemId] = itemVal;
 	_vm->_inventory->_startInvItem = 0;
 	_vm->_inventory->_startInvBox = 0;
@@ -410,7 +429,7 @@ void Scripts::cmdSetInventory() {
 void Scripts::cmdCheckInventory() {
 	int itemId = _data->readUint16LE();
 	int itemVal = _data->readUint16LE();
-
+	debugC(1, kDebugScripts, "cmdCheckInventory(itemId=%d, itemVal=%d)", itemId, itemVal);
 	if ((*_vm->_inventory)[itemId] == itemVal)
 		cmdGoto();
 	else
@@ -418,8 +437,11 @@ void Scripts::cmdCheckInventory() {
 }
 
 void Scripts::cmdSetTex() {
+	int xStart = _data->readSint16LE();
+	int yStart = _data->readSint16LE();
+	debugC(1, kDebugScripts, "cmdSetTex(xStart=%d, yStart=%d)", xStart, yStart);
 	_vm->_player->_playerDirection = RIGHT;
-	int posX = _data->readSint16LE() - (_vm->_player->_playerOffset.x / 2);
+	int posX = xStart - (_vm->_player->_playerOffset.x / 2);
 	if (posX <= _vm->_player->_rawPlayer.x)
 		_vm->_player->_playerDirection = LEFT;
 
@@ -428,7 +450,7 @@ void Scripts::cmdSetTex() {
 	bool scrlTemp = _vm->_player->_scrollFlag;
 
 	_vm->_player->_playerDirection = UP;
-	int posY = _data->readSint16LE();
+	int posY = yStart;
 	if (posY <= _vm->_player->_rawPlayer.y)
 		_vm->_player->_playerDirection = DOWN;
 
@@ -450,6 +472,7 @@ void Scripts::cmdSetTex() {
 
 void Scripts::cmdNewRoom() {
 	int roomNumber = _data->readByte();
+	debugC(1, kDebugScripts, "cmdNewRoom(roomNumber=%d)", roomNumber);
 	if (roomNumber != CURRENT_ROOM)
 		_vm->_player->_roomNumber = roomNumber;
 
@@ -478,6 +501,7 @@ void Scripts::converse1(int val) {
 
 void Scripts::cmdConverse() {
 	int val = _data->readUint16LE();
+	debugC(1, kDebugScripts, "cmdConverse(val=%d)", val);
 	converse1(val);
 }
 
@@ -486,6 +510,7 @@ void Scripts::cmdCheckFrame() {
 	Animation *anim = _vm->_animation->findAnimation(id);
 
 	int frame = _data->readUint16LE();
+	debugC(1, kDebugScripts, "cmdCheckFrame(id=%d, frame=%d)", id, frame);
 	if (anim->_frameNumber == frame)
 		cmdGoto();
 	else
@@ -495,7 +520,7 @@ void Scripts::cmdCheckFrame() {
 void Scripts::cmdCheckAnim() {
 	int id = _data->readUint16LE();
 	Animation *anim = _vm->_animation->findAnimation(id);
-
+	debugC(1, kDebugScripts, "cmdCheckAnim(id=%d)", id);
 	if (anim->_currentLoopCount == -1)
 		cmdGoto();
 	else
@@ -504,10 +529,12 @@ void Scripts::cmdCheckAnim() {
 
 void Scripts::cmdSnd() {
 	int id = _data->readByte();
+	debugC(1, kDebugScripts, "cmdSnd(id=%d)", id);
 	_vm->_sound->playSound(id);
 }
 
 void Scripts::cmdRetNeg() {
+	debugC(1, kDebugScripts, "cmdRetNeg()");
 	_endFlag = true;
 	_returnCode = -1;
 }
@@ -517,6 +544,7 @@ void Scripts::cmdCheckLoc() {
 	int minY = _data->readUint16LE();
 	int maxX = _data->readUint16LE();
 	int maxY = _data->readUint16LE();
+	debugC(1, kDebugScripts, "cmdCheckLoc(minX=%d, minY=%d, maxX=%d, maxY=%d)", minX, minY, maxX, maxY);
 
 	int curX = _vm->_player->_rawPlayer.x + _vm->_player->_playerOffset.x;
 	int curY = _vm->_player->_rawPlayer.y;
@@ -529,6 +557,7 @@ void Scripts::cmdCheckLoc() {
 
 void Scripts::cmdSetAnim() {
 	int animId = _data->readByte();
+	debugC(1, kDebugScripts, "cmdSetAnim(animId=%d)", animId);
 	Animation *anim = _vm->_animation->setAnimation(animId);
 
 	if (anim)
@@ -536,10 +565,12 @@ void Scripts::cmdSetAnim() {
 }
 
 void Scripts::cmdDispInv_v1() {
+	debugC(1, kDebugScripts, "cmdDispInv_v1()");
 	_vm->_inventory->displayInv();
 }
 
 void Scripts::cmdDispInv_v2() {
+	debugC(1, kDebugScripts, "cmdDispInv_v2()");
 	_vm->_inventory->newDisplayInv();
 	_vm->_events->forceSetCursor(CURSOR_ARROW);
 }
@@ -547,6 +578,7 @@ void Scripts::cmdDispInv_v2() {
 void Scripts::cmdSetAbout() {
 	int idx = _data->readByte();
 	byte val = _data->readByte();
+	debugC(1, kDebugScripts, "cmdSetAbout(idx=%d, val=%d)", idx, val);
 	_vm->_ask[idx] = val;
 	_vm->_startAboutBox = _vm->_startAboutItem = 0;
 }
@@ -554,7 +586,7 @@ void Scripts::cmdSetAbout() {
 void Scripts::cmdSetTimer() {
 	int idx = _data->readUint16LE();
 	int val = _data->readUint16LE();
-
+	debugC(1, kDebugScripts, "cmdSetTimer(idx=%d, val=%d)", idx, val);
 	++_vm->_timers[idx]._flag;
 	_vm->_timers[idx]._timer = val;
 	_vm->_timers[idx]._initTm = val;
@@ -565,6 +597,7 @@ void Scripts::cmdSetTimer() {
 
 void Scripts::cmdCheckTimer() {
 	int idx = _data->readUint16LE();
+	debugC(1, kDebugScripts, "cmdCheckTimer(idx=%d)", idx);
 
 	_vm->_canSaveLoad = true;
 	_vm->_events->pollEvents();
@@ -592,11 +625,13 @@ void Scripts::cmdCheckTimer() {
 void Scripts::cmdSetTravel() {
 	int idx = _data->readByte();
 	byte dest = _data->readByte();
+	debugC(1, kDebugScripts, "cmdSetTravel(idx=%d, dest=%d)", idx, dest);
 	_vm->_travel[idx] = dest;
 	_vm->_startTravelItem = _vm->_startTravelBox = 0;
 }
 
 void Scripts::cmdJumpGoto() {
+	debugC(1, kDebugScripts, "cmdJumpGoto(selectCommand=%d)", _vm->_room->_selectCommand);
 	if (_vm->_room->_selectCommand == 5)
 		cmdGoto();
 	else
@@ -609,11 +644,12 @@ void Scripts::cmdSetVideo() {
 	pt.y = _data->readSint16LE();
 	int cellIndex = _data->readUint16LE();
 	int rate = _data->readUint16LE();
-
+	debugC(1, kDebugScripts, "cmdSetVideo(x=%d, y=%d, cellIndex=%d, rate=%d)", pt.x, pt.y, cellIndex, rate);
 	_vm->_video->setVideo(_vm->_screen, pt, _vm->_extraCells[cellIndex]._vid, rate);
 }
 
 void Scripts::cmdPlayVideo() {
+	debugC(1, kDebugScripts, "cmdPlayVideo()");
 	_vm->_video->playVideo();
 }
 
@@ -624,27 +660,33 @@ void Scripts::cmdPlotImage() {
 	int destY = _data->readUint16LE();
 	int objId = _data->readUint16LE();
 	int imgId = _data->readUint16LE();
-
+	debugC(1, kDebugScripts, "cmdPlotImage(destX=%d, destY=%d, objId=%d, imgId=%d)", destX, destY, objId, imgId);
 	_vm->_screen->plotImage(_vm->_objectsTable[objId], imgId, Common::Point(destX, destY));
 }
 
 void Scripts::cmdSetDisplay() {
+	debugC(1, kDebugScripts, "cmdSetDisplay()");
 	_vm->_screen->setDisplayScan();
 	_vm->_current = _vm->_screen;
 }
 
 void Scripts::cmdSetBuffer() {
+	debugC(1, kDebugScripts, "cmdSetBuffer()");
 	_vm->_current = &_vm->_buffer2;
 }
 
 void Scripts::cmdSetScroll() {
-	_vm->_scrollCol = _data->readUint16LE();
-	_vm->_scrollRow = _data->readUint16LE();
+	int scrollCol = _data->readUint16LE();
+	int scrollRow = _data->readUint16LE();
+	debugC(1, kDebugScripts, "cmdSetScroll(scrollCol=%d, scrollRow=%d)", scrollCol, scrollRow);
+	_vm->_scrollCol = scrollCol;
+	_vm->_scrollRow = scrollRow;
 	_vm->_scrollX = 0;
 	_vm->_scrollY = 0;
 }
 
 void Scripts::cmdSaveRect() {
+	debugC(1, kDebugScripts, "cmdSaveRect()");
 	int x = _vm->_screen->_lastBoundsX;
 	int y = _vm->_screen->_lastBoundsY;
 	int w = _vm->_screen->_lastBoundsW;
@@ -654,6 +696,7 @@ void Scripts::cmdSaveRect() {
 }
 
 void Scripts::cmdVideoEnded() {
+	debugC(1, kDebugScripts, "cmdVideoEnded()");
 	_vm->_events->pollEventsAndWait();
 
 	if (_vm->_video->_videoEnd) {
@@ -664,24 +707,29 @@ void Scripts::cmdVideoEnded() {
 }
 
 void Scripts::cmdSetBufVid() {
-	_vm->_vidX = _data->readUint16LE();
-	_vm->_vidY = _data->readUint16LE();
+	int vidX = _data->readUint16LE();
+	int vidY = _data->readUint16LE();
 	int idx = _data->readUint16LE();
 	int rate = _data->readUint16LE();
-
+	debugC(1, kDebugScripts, "cmdSetBufVid(vidX=%d, vidY=%d, idx=%d, rate=%d)", vidX, vidY, idx, rate);
+	_vm->_vidX = vidX;
+	_vm->_vidY = vidY;
 	_vm->_video->setVideo(&_vm->_vidBuf, Common::Point(0, 0), FileIdent(_vm->_extraCells[idx]._vid._fileNum, _vm->_extraCells[idx]._vid._subfile), rate);
 }
 
 void Scripts::cmdPlayBufVid() {
+	debugC(1, kDebugScripts, "cmdPlayBufVid()");
 	_vm->_video->playVideo();
 	_vm->_video->copyVideo();
 }
 
 void Scripts::cmdRemoveLast() {
+	debugC(1, kDebugScripts, "cmdRemoveLast()");
 	--_vm->_numAnimTimers;
 }
 
 void Scripts::cmdDoTravel() {
+	debugC(1, kDebugScripts, "cmdDoTravel()");
 	while (true) {
 		_vm->_travelBox->getList(Martian::TRAVDATA, _vm->_travel);
 		int btnSelected = 0;
@@ -723,6 +771,7 @@ void Scripts::cmdDoTravel() {
 }
 
 void Scripts::cmdHelp_v1() {
+	debugC(1, kDebugScripts, "cmdHelp_v1()");
 	int idx = 0;
 	for (int i = 0; i < 40; i++) {
 		byte c = _data->readByte();
@@ -753,7 +802,7 @@ void Scripts::cmdHelp_v1() {
 void Scripts::cmdCheckAbout() {
 	int idx = _data->readSint16LE();
 	int16 val = _data->readSint16LE();
-
+	debugC(1, kDebugScripts, "cmdCheckAbout(idx=%d, val=%d)", idx, val);
 	if (_vm->_ask[idx] == val)
 		cmdGoto();
 	else
@@ -764,6 +813,7 @@ void Scripts::cmdSpecial() {
 	_specialFunction = _data->readUint16LE();
 	int p1 = _data->readUint16LE();
 	int p2 = _data->readUint16LE();
+	debugC(1, kDebugScripts, "cmdSpecial(specialFunction=%d, p1=%d, p2=%d)", _specialFunction, p1, p2);
 
 	if (_specialFunction == 1 || _vm->getGameID() == kGameMartianMemorandum) {
 		if (_vm->getGameID() == kGameAmazon && _vm->_establishTable[p2])
@@ -789,15 +839,18 @@ void Scripts::cmdSetCycle() {
 	int startCycle = _data->readUint16LE();
 	int endCycle = _data->readUint16LE();
 	int timer = _data->readUint16LE();
+	debugC(1, kDebugScripts, "cmdSetCycle(startCycle=%d, endCycle=%d, timer=%d)", startCycle, endCycle, timer);
 	_vm->_screen->setPaletteCycle(startCycle, endCycle, timer);
 }
 
 void Scripts::cmdCycle() {
+	debugC(1, kDebugScripts, "cmdCycle()");
 	if (_vm->_startup == -1)
 		_vm->_screen->cyclePaletteForward();
 }
 
 void Scripts::cmdCharSpeak() {
+	debugC(1, kDebugScripts, "cmdCharSpeak()");
 	_vm->_screen->_printOrg = _charsOrg;
 	_vm->_screen->_printStart = _charsOrg;
 
@@ -811,6 +864,7 @@ void Scripts::cmdCharSpeak() {
 }
 
 void Scripts::cmdTexSpeak() {
+	debugC(1, kDebugScripts, "cmdTexSpeak()");
 	_vm->_screen->_printOrg = _texsOrg;
 	_vm->_screen->_printStart = _texsOrg;
 	_vm->_screen->_maxChars = (_vm->getGameID() == kGameMartianMemorandum) ? 23 : 20;
@@ -827,6 +881,7 @@ void Scripts::cmdTexSpeak() {
 }
 
 void Scripts::cmdTexChoice() {
+	debugC(1, kDebugScripts, "cmdTexChoice()");
 
 	_vm->_oldRects.clear();
 	_choiceStart = _data->pos() - 1;
@@ -920,6 +975,7 @@ void Scripts::cmdTexChoice() {
 
 void Scripts::cmdWait() {
 	int time = _data->readSint16LE();
+	debugC(1, kDebugScripts, "cmdWait(time=%d)", time);
 	_vm->_timers[3]._timer = time;
 	_vm->_timers[3]._initTm = time;
 	_vm->_timers[3]._flag++;
@@ -940,6 +996,7 @@ void Scripts::cmdWait() {
 void Scripts::cmdSetConPos() {
 	int x = _data->readSint16LE();
 	int y = _data->readSint16LE();
+	debugC(1, kDebugScripts, "cmdSetConPos(x=%d, y=%d)", x, y);
 	_charsOrg = Common::Point(x, y);
 
 	x = _data->readSint16LE();
@@ -948,7 +1005,9 @@ void Scripts::cmdSetConPos() {
 }
 
 void Scripts::cmdCheckVFrame() {
-	if (_vm->_video->_videoFrame == _data->readSint16LE())
+	int vframe = _data->readSint16LE();
+	debugC(1, kDebugScripts, "cmdCheckVFrame(vframe=%d)", vframe);
+	if (_vm->_video->_videoFrame == vframe)
 		cmdGoto();
 	else
 		_data->skip(2);
@@ -956,7 +1015,7 @@ void Scripts::cmdCheckVFrame() {
 
 void Scripts::cmdJumpChoice() {
 	int val = (_data->readUint16LE() & 0xFF);
-
+	debugC(1, kDebugScripts, "cmdJumpChoice(val=%d, choice=%d)", val, _choice);
 	if (val == _choice) {
 		_sequence = _data->readUint16LE();
 		searchForSequence();
@@ -965,22 +1024,25 @@ void Scripts::cmdJumpChoice() {
 }
 
 void Scripts::cmdReturnChoice() {
+	debugC(1, kDebugScripts, "cmdReturnChoice()");
 	_data->seek(_choiceStart);
 }
 
 void Scripts::cmdClearBlock() {
+	debugC(1, kDebugScripts, "cmdClearBlock()");
 	_vm->_screen->restoreBlock();
 }
 
 void Scripts::cmdLoadSound() {
 	int idx = _data->readSint16LE();
-
+	debugC(1, kDebugScripts, "cmdLoadSound(idx=%d)", idx);
 	_vm->_sound->_soundTable.clear();
 	Resource *sound = _vm->_files->loadFile(_vm->_extraCells[idx]._vidSound);
 	_vm->_sound->_soundTable.push_back(SoundEntry(sound, 1));
 }
 
 void Scripts::cmdFreeSound() {
+	debugC(1, kDebugScripts, "cmdFreeSound()");
 	SoundManager &sound = *_vm->_sound;
 
 	if (sound._soundTable.size() > 0 && sound._soundTable[0]._res) {
@@ -998,6 +1060,7 @@ void Scripts::cmdFreeSound() {
 }
 
 void Scripts::cmdSetVideoSound() {
+	debugC(1, kDebugScripts, "cmdSetVideoSound()");
 	uint32 startPos = _data->pos();
 	_data->skip(4);
 	cmdLoadSound();
@@ -1009,6 +1072,7 @@ void Scripts::cmdSetVideoSound() {
 }
 
 void Scripts::cmdPlayVideoSound() {
+	debugC(1, kDebugScripts, "cmdPlayVideoSound()");
 	_vm->_video->playVideo();
 	if (_vm->_video->_soundFrame == _vm->_video->_videoFrame &&
 			!_vm->_video->_soundFlag) {
@@ -1020,20 +1084,20 @@ void Scripts::cmdPlayVideoSound() {
 }
 
 void Scripts::cmdPrintWatch() {
+	debugC(1, kDebugScripts, "cmdPrintWatch()");
 	printWatch();
 	findNull();
 }
 
 void Scripts::cmdDispAbout() {
+	debugC(1, kDebugScripts, "cmdDispAbout()");
 	_vm->_travelBox->getList(Martian::ASK_TBL, _vm->_ask);
 	int btnSelected = 0;
 	int boxX = _vm->_aboutBox->doBox_v1(_vm->_startAboutItem, _vm->_startAboutBox, btnSelected);
 	_vm->_startAboutItem = _vm->_boxDataStart;
 	_vm->_startAboutBox = _vm->_boxSelectY;
-
 	if (boxX == -1)
 		btnSelected = 2;
-
 	if (btnSelected == 2)
 		_vm->_useItem = -1;
 	else
@@ -1041,13 +1105,14 @@ void Scripts::cmdDispAbout() {
 }
 
 void Scripts::cmdPushLocation() {
+	debugC(1, kDebugScripts, "cmdPushLocation()");
 	_choiceStart = _data->pos() - 1;
 }
 
 void Scripts::cmdCheckTravel() {
 	int idx = _data->readSint16LE();
 	uint16 val = _data->readUint16LE();
-
+	debugC(1, kDebugScripts, "cmdCheckTravel(idx=%d, val=%d)", idx, val);
 	if (_vm->_travel[idx] == val)
 		cmdGoto();
 	else
@@ -1059,28 +1124,33 @@ void Scripts::cmdBlock() {
 	int y = _data->readUint16LE();
 	int w = _data->readSint16LE();
 	int h = _data->readUint16LE();
-
+	debugC(1, kDebugScripts, "cmdBlock(x=%d, y=%d, w=%d, h=%d)", x, y, w, h);
 	_vm->_screen->blitFrom(_vm->_buffer2, Common::Rect(x, y, x + w, y + h), Common::Point(x, y));
 }
 
 void Scripts::cmdPlayerOff() {
+	debugC(1, kDebugScripts, "cmdPlayerOff()");
 	_vm->_player->_playerOff = true;
 }
 
 void Scripts::cmdPlayerOn() {
+	debugC(1, kDebugScripts, "cmdPlayerOn()");
 	_vm->_player->_playerOff = false;
 }
 
 void Scripts::cmdDead() {
 	int deathId = _data->readByte();
+	debugC(1, kDebugScripts, "cmdDead(deathId=%d)", deathId);
 	_vm->dead(deathId);
 }
 
 void Scripts::cmdFadeOut() {
+	debugC(1, kDebugScripts, "cmdFadeOut()");
 	_vm->_screen->forceFadeOut();
 }
 
 void Scripts::cmdEndVideo() {
+	debugC(1, kDebugScripts, "cmdEndVideo()");
 	_vm->_video->closeVideo();
 	_vm->_video->_videoEnd = true;
 }


Commit: 5751e233e5f8163148c8abb4885eac1c7d20aa9b
    https://github.com/scummvm/scummvm/commit/5751e233e5f8163148c8abb4885eac1c7d20aa9b
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Enhance debugging of branching ops

Also log the result of ops that may or may not do something to make debugging
slightly easier.

Changed paths:
    engines/access/amazon/amazon_room.cpp
    engines/access/files.cpp
    engines/access/files.h
    engines/access/martian/martian_room.cpp
    engines/access/scripts.cpp
    engines/access/scripts.h


diff --git a/engines/access/amazon/amazon_room.cpp b/engines/access/amazon/amazon_room.cpp
index 5eac427372a..cfde88e3cca 100644
--- a/engines/access/amazon/amazon_room.cpp
+++ b/engines/access/amazon/amazon_room.cpp
@@ -137,7 +137,7 @@ void AmazonRoom::setupRoom() {
 
 void AmazonRoom::roomSet() {
 	_vm->_numAnimTimers = 0;
-	_vm->_scripts->_sequence = 1000;
+	_vm->_scripts->_sequence = INIT_ROOM_SCRIPT;
 	_vm->_scripts->searchForSequence();
 	_vm->_scripts->executeScript();
 }
diff --git a/engines/access/files.cpp b/engines/access/files.cpp
index 09b9cc798fa..2a74446308b 100644
--- a/engines/access/files.cpp
+++ b/engines/access/files.cpp
@@ -80,6 +80,10 @@ byte *Resource::data() {
 	return _data;
 }
 
+ const char *Resource::getFileName() const {
+		return _file.getName();
+}
+
 /*------------------------------------------------------------------------*/
 
 FileManager::FileManager(AccessEngine *vm) : _vm(vm) {
diff --git a/engines/access/files.h b/engines/access/files.h
index d1b8631bde6..bc976fa393c 100644
--- a/engines/access/files.h
+++ b/engines/access/files.h
@@ -64,6 +64,8 @@ public:
 	Resource(byte *data, int size);
 	~Resource();
 	byte *data();
+
+	const char *getFileName() const;
 };
 
 class FileManager {
diff --git a/engines/access/martian/martian_room.cpp b/engines/access/martian/martian_room.cpp
index 7267ca81bc0..51fc5853ace 100644
--- a/engines/access/martian/martian_room.cpp
+++ b/engines/access/martian/martian_room.cpp
@@ -95,7 +95,7 @@ void MartianRoom::reloadRoom1() {
 void MartianRoom::roomSet() {
 	// aka runScriptInitScript
 	_vm->_numAnimTimers = 0;
-	_vm->_scripts->_sequence = 1000;
+	_vm->_scripts->_sequence = INIT_ROOM_SCRIPT;
 	_vm->_scripts->searchForSequence();
 	_vm->_scripts->executeScript();
 
diff --git a/engines/access/scripts.cpp b/engines/access/scripts.cpp
index 8036e43faf4..0ae754b6f7c 100644
--- a/engines/access/scripts.cpp
+++ b/engines/access/scripts.cpp
@@ -135,6 +135,7 @@ void Scripts::setOpcodes_v2() {
 }
 
 void Scripts::setScript(Resource *res, bool restartFlag) {
+	debugC(1, kDebugScripts, "setScript(res=%p (%s), restartFlag=%d)", res, res->getFileName(), restartFlag);
 	_resource = res;
 	_data = res->_stream;
 	_endFlag = restartFlag;
@@ -238,6 +239,8 @@ int Scripts::executeScript() {
 		if (_scriptCommand < 0x80)
 			error("Unexpected opcode value %d", _scriptCommand);
 
+		debugCN(1, kDebugScripts, "%04X %02X ", (int)_data->pos(), _scriptCommand - 0x80);
+
 		executeCommand(_scriptCommand - 0x80);
 	} while (!_endFlag && !_vm->shouldQuitOrRestart());
 
@@ -264,51 +267,69 @@ void Scripts::cmdEndObject() {
 }
 
 void Scripts::cmdJumpLook() {
-	debugC(1, kDebugScripts, "cmdJumpLook(selectCommand=%d)", _vm->_room->_selectCommand);
-	if (_vm->_room->_selectCommand == 0)
+	debugCN(1, kDebugScripts, "cmdJumpLook(selectCommand=%d)", _vm->_room->_selectCommand);
+	if (_vm->_room->_selectCommand == 0) {
+		debugC(1, kDebugScripts, " -> True");
 		cmdGoto();
-	else
+	} else {
+		debugC(1, kDebugScripts, " -> False");
 		_data->skip(2);
+	}
 }
 
 void Scripts::cmdJumpHelp() {
-	debugC(1, kDebugScripts, "cmdJumpHelp(selectCommand=%d)", _vm->_room->_selectCommand);
-	if (_vm->_room->_selectCommand == 8)
+	debugCN(1, kDebugScripts, "cmdJumpHelp(selectCommand=%d)", _vm->_room->_selectCommand);
+	if (_vm->_room->_selectCommand == 8) {
+		debugC(1, kDebugScripts, " -> True");
 		cmdGoto();
-	else
+	} else {
+		debugC(1, kDebugScripts, " -> False");
 		_data->skip(2);
+	}
 }
 
 void Scripts::cmdJumpGet() {
-	debugC(1, kDebugScripts, "cmdJumpGet(selectCommand=%d)", _vm->_room->_selectCommand);
-	if (_vm->_room->_selectCommand == 3)
+	debugCN(1, kDebugScripts, "cmdJumpGet(selectCommand=%d)", _vm->_room->_selectCommand);
+	if (_vm->_room->_selectCommand == 3) {
+		debugC(1, kDebugScripts, " -> True");
 		cmdGoto();
-	else
+	} else {
+		debugC(1, kDebugScripts, " -> False");
 		_data->skip(2);
+	}
 }
 
 void Scripts::cmdJumpMove() {
-	debugC(1, kDebugScripts, "cmdJumpMove(selectCommand=%d)", _vm->_room->_selectCommand);
-	if (_vm->_room->_selectCommand == 2)
+	debugCN(1, kDebugScripts, "cmdJumpMove(selectCommand=%d)", _vm->_room->_selectCommand);
+	if (_vm->_room->_selectCommand == 2) {
+		debugC(1, kDebugScripts, " -> True");
 		cmdGoto();
-	else
+	} else {
+		debugC(1, kDebugScripts, " -> False");
 		_data->skip(2);
+	}
 }
 
 void Scripts::cmdJumpUse() {
-	debugC(1, kDebugScripts, "cmdJumpUse(selectCommand=%d)", _vm->_room->_selectCommand);
-	if (_vm->_room->_selectCommand == 4)
+	debugCN(1, kDebugScripts, "cmdJumpUse(selectCommand=%d)", _vm->_room->_selectCommand);
+	if (_vm->_room->_selectCommand == 4) {
+		debugC(1, kDebugScripts, " -> True");
 		cmdGoto();
-	else
+	} else {
+		debugC(1, kDebugScripts, " -> False");
 		_data->skip(2);
+	}
 }
 
 void Scripts::cmdJumpTalk() {
-	debugC(1, kDebugScripts, "cmdJumpTalk(selectCommand=%d)", _vm->_room->_selectCommand);
-	if (_vm->_room->_selectCommand == 6)
+	debugCN(1, kDebugScripts, "cmdJumpTalk(selectCommand=%d)", _vm->_room->_selectCommand);
+	if (_vm->_room->_selectCommand == 6) {
+		debugC(1, kDebugScripts, " -> True");
 		cmdGoto();
-	else
+	} else {
+		debugC(1, kDebugScripts, " -> False");
 		_data->skip(2);
+	}
 }
 
 void Scripts::cmdNull() {
@@ -388,7 +409,6 @@ void Scripts::cmdSetFlag() {
 	int flagNum = _data->readByte();
 	byte flagVal = _data->readByte();
 	debugC(1, kDebugScripts, "cmdSetFlag(flagNum=%d, flagVal=%d)", flagNum, flagVal);
-	assert(flagNum < 256);
 
 	_vm->_flags[flagNum] = flagVal;
 }
@@ -396,13 +416,16 @@ void Scripts::cmdSetFlag() {
 void Scripts::cmdCheckFlag() {
 	int flagNum = _data->readUint16LE();
 	int flagVal = _data->readUint16LE();
-	debugC(1, kDebugScripts, "cmdCheckFlag(flagNum=%d, flagVal=%d)", flagNum, flagVal);
+	debugCN(1, kDebugScripts, "cmdCheckFlag(flagNum=%d, flagVal=%d)", flagNum, flagVal);
 	assert(flagNum < 256);
 
-	if (_vm->_flags[flagNum] == flagVal)
+	if (_vm->_flags[flagNum] == flagVal) {
+		debugC(1, kDebugScripts, " -> True");
 		cmdGoto();
-	else
+	} else {
+		debugC(1, kDebugScripts, " -> False");
 		_data->skip(2);
+	}
 }
 
 void Scripts::cmdGoto() {
@@ -429,11 +452,14 @@ void Scripts::cmdSetInventory() {
 void Scripts::cmdCheckInventory() {
 	int itemId = _data->readUint16LE();
 	int itemVal = _data->readUint16LE();
-	debugC(1, kDebugScripts, "cmdCheckInventory(itemId=%d, itemVal=%d)", itemId, itemVal);
-	if ((*_vm->_inventory)[itemId] == itemVal)
+	debugCN(1, kDebugScripts, "cmdCheckInventory(itemId=%d, itemVal=%d)", itemId, itemVal);
+	if ((*_vm->_inventory)[itemId] == itemVal) {
+		debugC(1, kDebugScripts, " -> True");
 		cmdGoto();
-	else
+	} else {
+		debugC(1, kDebugScripts, " -> False");
 		_data->skip(2);
+	}
 }
 
 void Scripts::cmdSetTex() {
@@ -510,21 +536,27 @@ void Scripts::cmdCheckFrame() {
 	Animation *anim = _vm->_animation->findAnimation(id);
 
 	int frame = _data->readUint16LE();
-	debugC(1, kDebugScripts, "cmdCheckFrame(id=%d, frame=%d)", id, frame);
-	if (anim->_frameNumber == frame)
+	debugCN(1, kDebugScripts, "cmdCheckFrame(id=%d, frame=%d)", id, frame);
+	if (anim->_frameNumber == frame) {
+		debugC(1, kDebugScripts, " -> True");
 		cmdGoto();
-	else
+	} else {
+		debugC(1, kDebugScripts, " -> False");
 		_data->skip(2);
+	}
 }
 
 void Scripts::cmdCheckAnim() {
 	int id = _data->readUint16LE();
 	Animation *anim = _vm->_animation->findAnimation(id);
-	debugC(1, kDebugScripts, "cmdCheckAnim(id=%d)", id);
-	if (anim->_currentLoopCount == -1)
+	debugCN(1, kDebugScripts, "cmdCheckAnim(id=%d)", id);
+	if (anim->_currentLoopCount == -1) {
+		debugC(1, kDebugScripts, " -> True");
 		cmdGoto();
-	else
+	} else {
+		debugC(1, kDebugScripts, " -> False");
 		_data->skip(2);
+	}
 }
 
 void Scripts::cmdSnd() {
@@ -544,15 +576,18 @@ void Scripts::cmdCheckLoc() {
 	int minY = _data->readUint16LE();
 	int maxX = _data->readUint16LE();
 	int maxY = _data->readUint16LE();
-	debugC(1, kDebugScripts, "cmdCheckLoc(minX=%d, minY=%d, maxX=%d, maxY=%d)", minX, minY, maxX, maxY);
+	debugCN(1, kDebugScripts, "cmdCheckLoc(minX=%d, minY=%d, maxX=%d, maxY=%d)", minX, minY, maxX, maxY);
 
 	int curX = _vm->_player->_rawPlayer.x + _vm->_player->_playerOffset.x;
 	int curY = _vm->_player->_rawPlayer.y;
 
-	if ((curX >= minX) && (curX <= maxX) && (curY >= minY) && (curY <= maxY))
+	if ((curX >= minX) && (curX <= maxX) && (curY >= minY) && (curY <= maxY)) {
+		debugC(1, kDebugScripts, " -> True");
 		cmdGoto();
-	else
+	} else {
+		debugC(1, kDebugScripts, " -> False");
 		_data->skip(2);
+	}
 }
 
 void Scripts::cmdSetAnim() {
@@ -597,7 +632,7 @@ void Scripts::cmdSetTimer() {
 
 void Scripts::cmdCheckTimer() {
 	int idx = _data->readUint16LE();
-	debugC(1, kDebugScripts, "cmdCheckTimer(idx=%d)", idx);
+	debugCN(1, kDebugScripts, "cmdCheckTimer(idx=%d)", idx);
 
 	_vm->_canSaveLoad = true;
 	_vm->_events->pollEvents();
@@ -616,10 +651,13 @@ void Scripts::cmdCheckTimer() {
 	}
 
 	int val = _data->readUint16LE() & 0xFF;
-	if (_vm->_timers[idx]._flag == val)
+	if (_vm->_timers[idx]._flag == val) {
+		debugC(1, kDebugScripts, " -> True");
 		cmdGoto();
-	else
+	} else {
+		debugC(1, kDebugScripts, " -> False");
 		_data->skip(2);
+	}
 }
 
 void Scripts::cmdSetTravel() {
@@ -631,11 +669,14 @@ void Scripts::cmdSetTravel() {
 }
 
 void Scripts::cmdJumpGoto() {
-	debugC(1, kDebugScripts, "cmdJumpGoto(selectCommand=%d)", _vm->_room->_selectCommand);
-	if (_vm->_room->_selectCommand == 5)
+	debugCN(1, kDebugScripts, "cmdJumpGoto(selectCommand=%d)", _vm->_room->_selectCommand);
+	if (_vm->_room->_selectCommand == 5) {
+		debugC(1, kDebugScripts, " -> True");
 		cmdGoto();
-	else
+	} else {
+		debugC(1, kDebugScripts, " -> False");
 		_data->skip(2);
+	}
 }
 
 void Scripts::cmdSetVideo() {
@@ -696,12 +737,14 @@ void Scripts::cmdSaveRect() {
 }
 
 void Scripts::cmdVideoEnded() {
-	debugC(1, kDebugScripts, "cmdVideoEnded()");
+	debugCN(1, kDebugScripts, "cmdVideoEnded()");
 	_vm->_events->pollEventsAndWait();
 
 	if (_vm->_video->_videoEnd) {
+		debugC(1, kDebugScripts, " -> True");
 		cmdGoto();
 	} else {
+		debugC(1, kDebugScripts, " -> False");
 		_data->skip(2);
 	}
 }
@@ -802,11 +845,14 @@ void Scripts::cmdHelp_v1() {
 void Scripts::cmdCheckAbout() {
 	int idx = _data->readSint16LE();
 	int16 val = _data->readSint16LE();
-	debugC(1, kDebugScripts, "cmdCheckAbout(idx=%d, val=%d)", idx, val);
-	if (_vm->_ask[idx] == val)
+	debugCN(1, kDebugScripts, "cmdCheckAbout(idx=%d, val=%d)", idx, val);
+	if (_vm->_ask[idx] == val) {
+		debugC(1, kDebugScripts, " -> True");
 		cmdGoto();
-	else
+	} else {
+		debugC(1, kDebugScripts, " -> False");
 		_data->skip(2);
+	}
 }
 
 void Scripts::cmdSpecial() {
@@ -1006,21 +1052,26 @@ void Scripts::cmdSetConPos() {
 
 void Scripts::cmdCheckVFrame() {
 	int vframe = _data->readSint16LE();
-	debugC(1, kDebugScripts, "cmdCheckVFrame(vframe=%d)", vframe);
-	if (_vm->_video->_videoFrame == vframe)
+	debugCN(1, kDebugScripts, "cmdCheckVFrame(vframe=%d)", vframe);
+	if (_vm->_video->_videoFrame == vframe) {
+		debugC(1, kDebugScripts, " -> True");
 		cmdGoto();
-	else
+	} else {
+		debugC(1, kDebugScripts, " -> False");
 		_data->skip(2);
+	}
 }
 
 void Scripts::cmdJumpChoice() {
 	int val = (_data->readUint16LE() & 0xFF);
-	debugC(1, kDebugScripts, "cmdJumpChoice(val=%d, choice=%d)", val, _choice);
+	debugCN(1, kDebugScripts, "cmdJumpChoice(val=%d, choice=%d)", val, _choice);
 	if (val == _choice) {
-		_sequence = _data->readUint16LE();
-		searchForSequence();
-	} else
+		debugC(1, kDebugScripts, " -> True");
+		cmdGoto();
+	} else {
+		debugC(1, kDebugScripts, " -> False");
 		_data->skip(2);
+	}
 }
 
 void Scripts::cmdReturnChoice() {
@@ -1112,11 +1163,14 @@ void Scripts::cmdPushLocation() {
 void Scripts::cmdCheckTravel() {
 	int idx = _data->readSint16LE();
 	uint16 val = _data->readUint16LE();
-	debugC(1, kDebugScripts, "cmdCheckTravel(idx=%d, val=%d)", idx, val);
-	if (_vm->_travel[idx] == val)
+	debugCN(1, kDebugScripts, "cmdCheckTravel(idx=%d, val=%d)", idx, val);
+	if (_vm->_travel[idx] == val) {
+		debugC(1, kDebugScripts, " -> True");
 		cmdGoto();
-	else
+	} else {
+		debugC(1, kDebugScripts, " -> False");
 		_data->skip(2);
+	}
 }
 
 void Scripts::cmdBlock() {
diff --git a/engines/access/scripts.h b/engines/access/scripts.h
index 8b74a027183..c848292e2be 100644
--- a/engines/access/scripts.h
+++ b/engines/access/scripts.h
@@ -33,6 +33,7 @@ class Scripts;
 
 #define SCRIPT_START_BYTE 0xE0
 #define ROOM_SCRIPT 2000
+#define INIT_ROOM_SCRIPT 1000
 
 typedef void(Scripts::*ScriptMethodPtr)();
 


Commit: 9139a042c64bd1f88ae4945c46630faf5d4a3b80
    https://github.com/scummvm/scummvm/commit/9139a042c64bd1f88ae4945c46630faf5d4a3b80
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Add some more debugger commands

Some helpful script debug commands to check and set flags, etc.

Changed paths:
    engines/access/access.h
    engines/access/debugger.cpp
    engines/access/debugger.h
    engines/access/scripts.h


diff --git a/engines/access/access.h b/engines/access/access.h
index 3a31283053c..7cef1a6c1d0 100644
--- a/engines/access/access.h
+++ b/engines/access/access.h
@@ -122,7 +122,7 @@ private:
 
 	/**
 	 * A cache for the ICONS.LZ sprite data
-     */
+	 */
 	SpriteResource *_icons;
 
 	/**
diff --git a/engines/access/debugger.cpp b/engines/access/debugger.cpp
index 4e4ab521182..c017ee9aa62 100644
--- a/engines/access/debugger.cpp
+++ b/engines/access/debugger.cpp
@@ -68,6 +68,10 @@ Debugger::Debugger(AccessEngine *vm) : GUI::Debugger(), _vm(vm) {
 	registerCmd("scene", WRAP_METHOD(Debugger, Cmd_LoadScene));
 	registerCmd("cheat", WRAP_METHOD(Debugger, Cmd_Cheat));
 	registerCmd("playmovie", WRAP_METHOD(Debugger, Cmd_PlayMovie));
+	registerCmd("dumpscript", WRAP_METHOD(Debugger, Cmd_DumpScript));
+	registerCmd("timers", WRAP_METHOD(Debugger, Cmd_Timers));
+	registerCmd("getflag", WRAP_METHOD(Debugger, Cmd_GetFlag));
+	registerCmd("setflag", WRAP_METHOD(Debugger, Cmd_SetFlag));
 }
 
 Debugger::~Debugger() {
@@ -136,6 +140,96 @@ bool Debugger::Cmd_PlayMovie(int argc, const char **argv) {
 	return cmdExit(0, nullptr);
 }
 
+bool Debugger::Cmd_DumpScript(int argc, const char **argv) {
+	if (argc != 2) {
+		debugPrintf("Usage: %s <path>\n", argv[0]);
+		debugPrintf("Dumps the currently loaded script to the given path\n");
+		return true;
+	}
+
+	Common::SeekableReadStream *data = _vm->_scripts->_data;
+	if (!data) {
+		debugPrintf("No script loaded\n");
+		return true;
+	}
+
+	const Common::Path outpath = Common::Path(argv[1]);
+
+	Common::DumpFile dumpFile;
+
+	dumpFile.open(outpath);
+	if (!dumpFile.isOpen()) {
+		debugPrintf("Couldn't open %s\n", argv[1]);
+		return true;
+	}
+
+	int64 oldpos = data->pos();
+	data->seek(0);
+
+	dumpFile.writeStream(data);
+	dumpFile.close();
+
+	data->seek(oldpos);
+	return true;
+}
+
+bool Debugger::Cmd_GetFlag(int argc, const char **argv) {
+	if (argc != 2) {
+		debugPrintf("Usage: %s <flag number>\n", argv[0]);
+		debugPrintf("Prints the value of the given flag\n");
+		return true;
+	}
+
+	int flagNum = strToInt(argv[1]);
+	if (flagNum < 0 || flagNum >= 256) {
+		debugPrintf("Invalid flag number\n");
+		return true;
+	}
+
+	debugPrintf("Flag %d: %d\n", flagNum, _vm->_flags[flagNum]);
+	return true;
+}
+
+bool Debugger::Cmd_SetFlag(int argc, const char **argv) {
+	if (argc != 3) {
+		debugPrintf("Usage: %s <flag number> <flag value>\n", argv[0]);
+		debugPrintf("Sets the given flag to the given value\n");
+		return true;
+	}
+
+	int flagNum = strToInt(argv[1]);
+	if (flagNum < 0 || flagNum >= 256) {
+		debugPrintf("Invalid flag number\n");
+		return true;
+	}
+
+	int flagVal = strToInt(argv[2]);
+	if (flagVal < 0 || flagVal >= 256) {
+		debugPrintf("Invalid flag val, must be byte\n");
+		return true;
+	}
+	_vm->_flags[flagNum] = flagVal;
+
+	debugPrintf("Flag %d set to %d\n", flagNum, flagVal);
+	return true;
+}
+
+bool Debugger::Cmd_Timers(int argc, const char **argv) {
+	if (argc != 1) {
+		debugPrintf("Usage: %s\n", argv[0]);
+		debugPrintf("Prints the current timers\n");
+		return true;
+	}
+
+	debugPrintf("Timers:\n");
+	for (uint i = 0; i < _vm->_timers.size(); ++i) {
+		const TimerEntry te = _vm->_timers[i];
+		debugPrintf("%d: init: %d timer: %d flag: %d\n", i, te._initTm, te._timer, te._flag);
+	}
+
+	return true;
+}
+
 /*------------------------------------------------------------------------*/
 
 namespace Amazon {
diff --git a/engines/access/debugger.h b/engines/access/debugger.h
index e2f9b83ce81..af3b7c51fc4 100644
--- a/engines/access/debugger.h
+++ b/engines/access/debugger.h
@@ -39,6 +39,11 @@ protected:
 	bool Cmd_LoadScene(int argc, const char **argv);
 	bool Cmd_Cheat(int argc, const char **argv);
 	bool Cmd_PlayMovie(int argc, const char **argv);
+	bool Cmd_DumpScript(int argc, const char **argv);
+	bool Cmd_Timers(int argc, const char **argv);
+	bool Cmd_GetFlag(int argc, const char **argv);
+	bool Cmd_SetFlag(int argc, const char **argv);
+
 public:
 	static Debugger *init(AccessEngine *vm);
 	void postEnter() override;
diff --git a/engines/access/scripts.h b/engines/access/scripts.h
index c848292e2be..194ea7f5585 100644
--- a/engines/access/scripts.h
+++ b/engines/access/scripts.h
@@ -38,6 +38,8 @@ class Scripts;
 typedef void(Scripts::*ScriptMethodPtr)();
 
 class Scripts : public Manager {
+	friend class Debugger;
+
 private:
 	int _specialFunction;
 


Commit: f95e2a9d90e225d69585856d987bdc27bce20aea
    https://github.com/scummvm/scummvm/commit/f95e2a9d90e225d69585856d987bdc27bce20aea
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Fix script variable comparison to match originals

Changed paths:
    engines/access/scripts.cpp


diff --git a/engines/access/scripts.cpp b/engines/access/scripts.cpp
index 0ae754b6f7c..60190dee4d6 100644
--- a/engines/access/scripts.cpp
+++ b/engines/access/scripts.cpp
@@ -419,7 +419,12 @@ void Scripts::cmdCheckFlag() {
 	debugCN(1, kDebugScripts, "cmdCheckFlag(flagNum=%d, flagVal=%d)", flagNum, flagVal);
 	assert(flagNum < 256);
 
-	if (_vm->_flags[flagNum] == flagVal) {
+	//
+	// Although this opcode takes an int16, only the byte value (AL) is compared
+	// to flags in both MM and Amazon. This is important as some scripts compare
+	// against 255 to check for -1, so we need to make the casting the same.
+	//
+	if ((byte)_vm->_flags[flagNum] == (byte)flagVal) {
 		debugC(1, kDebugScripts, " -> True");
 		cmdGoto();
 	} else {


Commit: bbf28f6c1e356a2f32493247cda22f75ececaf4c
    https://github.com/scummvm/scummvm/commit/bbf28f6c1e356a2f32493247cda22f75ececaf4c
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Fix uninitialized variable

Fixes Coverity issue 1558839.

Changed paths:
    engines/access/events.cpp


diff --git a/engines/access/events.cpp b/engines/access/events.cpp
index 89afcf57cd2..0196e66a257 100644
--- a/engines/access/events.cpp
+++ b/engines/access/events.cpp
@@ -47,6 +47,7 @@ EventsManager::EventsManager(AccessEngine *vm) : _vm(vm) {
 	_vbCount = 0;
 	_keyCode = Common::KEYCODE_INVALID;
 	_priorTimerTime = 0;
+	_action = kActionNone;
 }
 
 EventsManager::~EventsManager() {


Commit: 1a3a7d959d3fe32c7407088cf7e79f074505a236
    https://github.com/scummvm/scummvm/commit/1a3a7d959d3fe32c7407088cf7e79f074505a236
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Remove redundant variable assignment (PVS-Studio V1048)

Changed paths:
    engines/access/amazon/amazon_logic.cpp


diff --git a/engines/access/amazon/amazon_logic.cpp b/engines/access/amazon/amazon_logic.cpp
index c5e035b2045..3622957f762 100644
--- a/engines/access/amazon/amazon_logic.cpp
+++ b/engines/access/amazon/amazon_logic.cpp
@@ -2181,7 +2181,6 @@ void Ant::doAnt() {
 						idx = antHandleRight(idx, buf);
 				} else {
 					// Handle movement based on keyboard keys
-					buf = Amazon::PITWALK;
 					if (_vm->_player->_move == UP)
 						idx = antHandleStab(idx, buf);
 					else if (_vm->_player->_move == LEFT)


Commit: 224593eb1cc9713d26cd9d15be31848018243db6
    https://github.com/scummvm/scummvm/commit/224593eb1cc9713d26cd9d15be31848018243db6
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Fix potential undefined behavior PVS-Studio V567

Changed paths:
    engines/access/bubble_box.cpp


diff --git a/engines/access/bubble_box.cpp b/engines/access/bubble_box.cpp
index f07c5ba6285..85596679430 100644
--- a/engines/access/bubble_box.cpp
+++ b/engines/access/bubble_box.cpp
@@ -134,7 +134,7 @@ void BubbleBox::calcBubble(const Common::String &msg) {
 		bounds.bottom = screen._printOrg.y + 4 + 1;
 	} else {
 		if (_type == kBoxTypeFileDialog)
-			++screen._printOrg.y += 6;
+			(++screen._printOrg.y) += 6;
 
 		// Determine the width for the area
 		width = (((_vm->_fonts._printMaxX >> 4) + 1) << 4) + 5;


Commit: 640bd437471310aa67ed7f64b4a12de879757e63
    https://github.com/scummvm/scummvm/commit/640bd437471310aa67ed7f64b4a12de879757e63
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Fix shonky box type logic (PVS-Studio V590)

Confirmed against orginal logic.

Changed paths:
    engines/access/bubble_box.cpp


diff --git a/engines/access/bubble_box.cpp b/engines/access/bubble_box.cpp
index 85596679430..80dc7be3500 100644
--- a/engines/access/bubble_box.cpp
+++ b/engines/access/bubble_box.cpp
@@ -673,7 +673,7 @@ int BubbleBox::doBox_v1(int item, int box, int &btnSelected) {
 		if (!_vm->_events->_leftButton)
 			continue;
 
-		if (((_type == TYPE_1) || (_type != TYPE_3)) && (_vm->_timers[2]._flag == 0)) {
+		if (((_type == TYPE_1) || (_type == TYPE_3)) && (_vm->_timers[2]._flag == 0)) {
 			++_vm->_timers[2]._flag;
 			if (_btnUpPos.contains(_vm->_events->_mousePos)) {
 				if (_vm->_bcnt) {


Commit: 9aa1da0dd6f2a83ee3a6ff75f363f646c832bd23
    https://github.com/scummvm/scummvm/commit/9aa1da0dd6f2a83ee3a6ff75f363f646c832bd23
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Remove redundant initializer (PVS-Studio V519)

Changed paths:
    engines/access/room.cpp


diff --git a/engines/access/room.cpp b/engines/access/room.cpp
index f660097a81f..9d05bd737b8 100644
--- a/engines/access/room.cpp
+++ b/engines/access/room.cpp
@@ -36,7 +36,6 @@ Room::Room(AccessEngine *vm) : Manager(vm) {
 	_playFieldWidth = _playFieldHeight = 0;
 	_matrixSize = 0;
 	_tile = nullptr;
-	_selectCommand = 0;
 	_conFlag = false;
 	_selectCommand = -1;
 


Commit: baed230f09efc7c9086df0aa4b50adbfa3a01edf
    https://github.com/scummvm/scummvm/commit/baed230f09efc7c9086df0aa4b50adbfa3a01edf
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Remove redundant assignment (PVS-Studio V1048)

Changed paths:
    engines/access/scripts.cpp


diff --git a/engines/access/scripts.cpp b/engines/access/scripts.cpp
index 60190dee4d6..ca19f0d3ffd 100644
--- a/engines/access/scripts.cpp
+++ b/engines/access/scripts.cpp
@@ -800,7 +800,6 @@ void Scripts::cmdDoTravel() {
 				_vm->_room->_function = FN_CLEAR1;
 				if (_vm->_res->ROOMTBL[idx]._travelPos.x == -1) {
 					// For x == -1, the y value is a script Id, not a co-ordinate
-					_vm->_player->_roomNumber = idx;
 					_vm->_room->_conFlag = true;
 					_vm->_scripts->converse1(_vm->_res->ROOMTBL[idx]._travelPos.y);
 					return;


Commit: ad8ea47924bec841788d57ce9d2fdb73c45fc3f0
    https://github.com/scummvm/scummvm/commit/ad8ea47924bec841788d57ce9d2fdb73c45fc3f0
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Remove unused variable

Changed paths:
    engines/access/screen.h


diff --git a/engines/access/screen.h b/engines/access/screen.h
index 24105cbdb30..735dd0e8b2d 100644
--- a/engines/access/screen.h
+++ b/engines/access/screen.h
@@ -62,7 +62,6 @@ private:
 	int _startCycle;
 	int _cycleStart;
 	int _endCycle;
-	Common::List<Common::Rect> _dirtyRects;
 
 	void updatePalette();
 public:


Commit: 4908744b8e59eb8bb8247e5844cd17b8573fcf85
    https://github.com/scummvm/scummvm/commit/4908744b8e59eb8bb8247e5844cd17b8573fcf85
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Add support for dropped shadow on text

Changed paths:
    engines/access/bubble_box.cpp


diff --git a/engines/access/bubble_box.cpp b/engines/access/bubble_box.cpp
index 80dc7be3500..a7891c6f587 100644
--- a/engines/access/bubble_box.cpp
+++ b/engines/access/bubble_box.cpp
@@ -347,6 +347,16 @@ void BubbleBox::setCursorPos(int posX, int posY) {
 }
 
 void BubbleBox::printString(Common::String msg) {
+
+	if (_vm->_fonts._charSet._hi & 2) {
+		// Draw a shadow for the text
+		Common::Point shadowPt = _vm->_screen->_printOrg + Common::Point(1, 1);
+		byte oldcol = Font::_fontColors[3];
+		Font::_fontColors[3] = 0;
+		_vm->_fonts._font1->drawString(_vm->_screen, msg, shadowPt);
+		Font::_fontColors[3] = oldcol;
+	}
+
 	_vm->_fonts._font1->drawString(_vm->_screen, msg, _vm->_screen->_printOrg);
 }
 


Commit: 0f3271f2d5aa70dfedc19c717bfc37dc029bc529
    https://github.com/scummvm/scummvm/commit/0f3271f2d5aa70dfedc19c717bfc37dc029bc529
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Complete special1 implementation

Changed paths:
    engines/access/martian/martian_scripts.cpp
    engines/access/martian/martian_scripts.h


diff --git a/engines/access/martian/martian_scripts.cpp b/engines/access/martian/martian_scripts.cpp
index d2727ee2719..7ae6bc50a25 100644
--- a/engines/access/martian/martian_scripts.cpp
+++ b/engines/access/martian/martian_scripts.cpp
@@ -86,7 +86,10 @@ void MartianScripts::cmdSpecial0() {
 	warning("TODO: Pop Midi");
 }
 
-void MartianScripts::cmdSpecial1(int param1) {
+void MartianScripts::cmdSpecial1(int param1, int param2) {
+	//
+	// Special 1 is a scene transition with some explanatory text
+	//
 	_vm->_events->hideCursor();
 
 	if (param1 != -1) {
@@ -97,6 +100,42 @@ void MartianScripts::cmdSpecial1(int param1) {
 	_vm->_screen->setIconPalette();
 	_vm->_screen->forceFadeIn();
 	_vm->_events->showCursor();
+
+	_vm->_fonts._charSet._hi = 10;
+	Font::_fontColors[1] = 0xf7;
+	Font::_fontColors[2] = 0xff;
+
+	_vm->_screen->_maxChars = 50;
+	_vm->_screen->_printOrg = _vm->_screen->_printStart = Common::Point(24, 18);
+
+	// TODO: Original has a small delay here.
+
+	Resource *notesRes = _vm->_files->loadFile("ETEXT.DAT");
+	/*
+	Common::DumpFile dump;
+	dump.open("/tmp/etext.dat.decomp");
+	dump.writeStream(notesRes->_stream);
+	dump.close();
+	*/
+
+	notesRes->_stream->seek(2 * param2);
+	uint16 msgOffset = notesRes->_stream->readUint16LE();
+	if (msgOffset == 0 || msgOffset >= notesRes->_stream->size()) {
+		error("MartianScripts::cmdSpecial1: Invalid message offset %d for msg %d", msgOffset, param2);
+	}
+
+	notesRes->_stream->seek(msgOffset);
+
+	Common::String msg = notesRes->_stream->readString();
+	_game->showDeathText(msg);
+
+	_vm->_events->hideCursor();
+	if (param2 != 0x3f) {
+		_vm->_screen->forceFadeOut();
+		_vm->_screen->clearScreen();
+	}
+
+	_vm->_events->showCursor();
 }
 
 void MartianScripts::cmdSpecial3() {
@@ -142,10 +181,7 @@ void MartianScripts::cmdSpecial6() {
 	notesRes->_stream->seek(72);
 
 	// Read the message
-	Common::String msg = "";
-	byte c;
-	while ((c = (char)notesRes->_stream->readByte()) != '\0')
-		msg += c;
+	Common::String msg = notesRes->_stream->readString();
 
 	//display the message
 	_game->showDeathText(msg);
@@ -316,7 +352,7 @@ void MartianScripts::executeSpecial(int commandIndex, int param1, int param2) {
 		cmdSpecial0();
 		break;
 	case 1:
-		cmdSpecial1(param1);
+		cmdSpecial1(param1, param2);
 		break;
 	case 2:
 		warning("TODO: cmdSpecial2");
diff --git a/engines/access/martian/martian_scripts.h b/engines/access/martian/martian_scripts.h
index 8aadd498a00..62778fc9cb7 100644
--- a/engines/access/martian/martian_scripts.h
+++ b/engines/access/martian/martian_scripts.h
@@ -36,7 +36,7 @@ private:
 	MartianEngine *_game;
 
 	void cmdSpecial0();
-	void cmdSpecial1(int param1);
+	void cmdSpecial1(int param1, int param2);
 	void cmdSpecial3();
 	void doIntro(int param1);
 	void cmdSpecial6();


Commit: a884280e19d29645f52ea539e2cd56a80c419104
    https://github.com/scummvm/scummvm/commit/a884280e19d29645f52ea539e2cd56a80c419104
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Add a stub midi parser for MM

Changed paths:
    engines/access/sound.cpp


diff --git a/engines/access/sound.cpp b/engines/access/sound.cpp
index 1601857581c..39895f0c8d3 100644
--- a/engines/access/sound.cpp
+++ b/engines/access/sound.cpp
@@ -304,10 +304,28 @@ void MusicManager::midiPlay() {
 
 	stop();
 
-	if (READ_BE_UINT32(_music->data()) != MKTAG('F', 'O', 'R', 'M')) {
-		warning("midiPlay() Unexpected signature");
+	uint32 magic = READ_BE_UINT32(_music->data());
+	if (magic == MKTAG('B', 'E', 'm', 'd')) {
+		warning("TODO: Implement Martian Memorandum style MIDI parsing");
 		_isPlaying = false;
-	} else {
+
+		if (_music->_size <= 16)
+			error("midiPlay() wrong BEmd music resource size");
+
+		/*uint16 unk1 = */ READ_LE_UINT32(_music->data() + 4);  // Normally 0xC0?
+		uint16 secondBlockOffset = READ_LE_UINT16(_music->data() + 6);
+		if (secondBlockOffset < 16 || secondBlockOffset >= _music->_size)
+			error("midiPlay() bad second block offset in BEmd file");
+		/*uint16 unk2 =*/ READ_LE_UINT16(_music->data() + 8);
+		//byte *midiDataBlock1 = _music->data() + 16;
+		//byte *midiDataBlock2 = _music->data() + secondBlockOffset;
+		/*
+		Common::DumpFile dumpfile;
+		dumpfile.open("/tmp/access_music_dump.bin");
+		dumpfile.write(_music->data(), _music->_size);
+		dumpfile.close();
+		*/
+	} else if (magic == MKTAG('F', 'O', 'R', 'M')) {
 		_parser = MidiParser::createParser_XMIDI();
 
 		if (!_parser->loadMusic(_music->data(), _music->_size))
@@ -324,6 +342,9 @@ void MusicManager::midiPlay() {
 
 		setVolume(127);
 		_isPlaying = true;
+	} else {
+		warning("midiPlay() Unexpected signature 0x%08x, expected 'FORM'", magic);
+		_isPlaying = false;
 	}
 }
 


Commit: 2c65459429d7b59c1c328ff3c57634e1238f025e
    https://github.com/scummvm/scummvm/commit/2c65459429d7b59c1c328ff3c57634e1238f025e
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Add footstep sounds for MM

Changed paths:
    engines/access/player.cpp


diff --git a/engines/access/player.cpp b/engines/access/player.cpp
index f45d5cb90d7..285fba90b85 100644
--- a/engines/access/player.cpp
+++ b/engines/access/player.cpp
@@ -267,9 +267,9 @@ void Player::walkUp() {
 
 		calcManScale();
 
-		// This code looks totally useless as 'si' is unconditionally set in plotCom
-		//if (_vm->_currentMan != 3 && (_frame == 17 || _frame == 21))
-		//	warning("TODO: walkUp - si = 0?");
+		// TODO: Implement step sounds also for Amazon? (_frame == 17 || _frame == 21))
+		if (_vm->getGameID() == kGameMartianMemorandum && _vm->_flags[174] == 0 && (_frame == 8 || _frame == 12))
+			_vm->_sound->playSound(0);
 
 		if (++_frame > _upWalkMax)
 			_frame = _upWalkMin;
@@ -297,9 +297,9 @@ void Player::walkDown() {
 
 		calcManScale();
 
-		// This code looks totally useless as 'si' is unconditionally set in plotCom
-		//if (_vm->_currentMan != 3 && (_frame == 10 || _frame == 14))
-		//	warning("TODO: walkDown - si = 0?");
+		// TODO: Implement step sounds also for Amazon? (_frame == 10 || _frame == 14)
+		if (_vm->getGameID() == kGameMartianMemorandum && _vm->_flags[174] == 0 && (_frame == 17 || _frame == 21))
+			_vm->_sound->playSound(0);
 
 		if (++_frame > _downWalkMax)
 			_frame = _downWalkMin;
@@ -338,9 +338,9 @@ void Player::walkLeft() {
 		_rawPlayerLow.x = _rawTempL;
 		++_frame;
 
-		// This code looks totally useless as 'si' is unconditionally set in plotCom1
-		//if (_vm->_currentMan != 3 && (_frame == 1 || _frame == 5))
-		//	warning("TODO: walkLeft - si = 0?");
+		// TODO: Implement step sounds also for Amazon? (_frame == 1 || _frame == 5)
+		if (_vm->getGameID() == kGameMartianMemorandum && _vm->_flags[174] == 0 && (_frame == 7 || _frame == 3))
+			_vm->_sound->playSound(0);
 
 		if (_frame > _sideWalkMax)
 			_frame = _sideWalkMin;
@@ -379,6 +379,10 @@ void Player::walkRight() {
 		_rawPlayerLow.x = _rawTempL;
 		++_frame;
 
+		// TODO: Implement step sounds also for Amazon
+		if (_vm->getGameID() == kGameMartianMemorandum && _vm->_flags[174] == 0 && (_frame == 7 || _frame == 3))
+			_vm->_sound->playSound(0);
+
 		// Useless check removed
 		if (_frame > _sideWalkMax)
 			_frame = _sideWalkMin;
@@ -746,8 +750,9 @@ bool Player::scrollUp(int forcedAmount) {
 		_scrollAmount = forcedAmount;
 
 	if ((_vm->_scrollRow + _vm->_screen->_vWindowHeight) >=
-			_vm->_room->_playFieldHeight)
+			_vm->_room->_playFieldHeight) {
 		return true;
+	}
 
 	_scrollFlag = true;
 	_vm->_scrollY = _vm->_scrollY + _scrollAmount;
@@ -844,7 +849,7 @@ bool Player::scrollRight(int forcedAmount) {
 		do {
 			_vm->_scrollX += TILE_WIDTH;
 			if (--_vm->_scrollCol < 0) {
-				_scrollEnd = true;
+				_scrollEnd = 1;
 				_vm->_scrollX = 0;
 				_vm->_scrollCol = 0;
 				return true;


Commit: 43b2e6e689094dc59845c325d207815fa2062369
    https://github.com/scummvm/scummvm/commit/43b2e6e689094dc59845c325d207815fa2062369
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Add Open operation for MM

Changed paths:
    engines/access/scripts.cpp
    engines/access/scripts.h


diff --git a/engines/access/scripts.cpp b/engines/access/scripts.cpp
index ca19f0d3ffd..6f7706f6261 100644
--- a/engines/access/scripts.cpp
+++ b/engines/access/scripts.cpp
@@ -50,7 +50,7 @@ void Scripts::setOpcodes() {
 	COMMAND_LIST[0] = &Scripts::cmdObject;
 	COMMAND_LIST[1] = &Scripts::cmdEndObject;
 	COMMAND_LIST[2] = &Scripts::cmdJumpLook;
-	COMMAND_LIST[3] = &Scripts::cmdJumpHelp;
+	COMMAND_LIST[3] = &Scripts::cmdJumpOpen;
 	COMMAND_LIST[4] = &Scripts::cmdJumpGet;
 	COMMAND_LIST[5] = &Scripts::cmdJumpMove;
 	COMMAND_LIST[6] = &Scripts::cmdJumpUse;
@@ -124,6 +124,7 @@ void Scripts::setOpcodes() {
 }
 
 void Scripts::setOpcodes_v2() {
+	COMMAND_LIST[3] = &Scripts::cmdJumpHelp;
 	COMMAND_LIST[9] = &Scripts::cmdPrint_v2;
 	COMMAND_LIST[15] = &Scripts::cmdSetInventory;
 	COMMAND_LIST[28] = &Scripts::cmdDispInv_v2;
@@ -236,6 +237,9 @@ int Scripts::executeScript() {
 		while ((_scriptCommand = _data->readByte()) == SCRIPT_START_BYTE)
 			_data->skip(2);
 
+		if (_data->eos()) {
+			error("Hit end of script data");
+
 		if (_scriptCommand < 0x80)
 			error("Unexpected opcode value %d", _scriptCommand);
 
@@ -277,6 +281,17 @@ void Scripts::cmdJumpLook() {
 	}
 }
 
+void Scripts::cmdJumpOpen() {
+	debugCN(1, kDebugScripts, "cmdJumpOpen(selectCommand=%d)", _vm->_room->_selectCommand);
+	if (_vm->_room->_selectCommand == 1) {
+		debugC(1, kDebugScripts, " -> True");
+		cmdGoto();
+	} else {
+		debugC(1, kDebugScripts, " -> False");
+		_data->skip(2);
+	}
+}
+
 void Scripts::cmdJumpHelp() {
 	debugCN(1, kDebugScripts, "cmdJumpHelp(selectCommand=%d)", _vm->_room->_selectCommand);
 	if (_vm->_room->_selectCommand == 8) {
diff --git a/engines/access/scripts.h b/engines/access/scripts.h
index 194ea7f5585..dd53d8ae3e4 100644
--- a/engines/access/scripts.h
+++ b/engines/access/scripts.h
@@ -64,6 +64,7 @@ protected:
 	void cmdObject();
 	void cmdEndObject();
 	void cmdJumpLook();
+	void cmdJumpOpen();
 	void cmdJumpHelp();
 	void cmdJumpGet();
 	void cmdJumpMove();


Commit: d8df21547d91153c6288a0dfa37006389ce3e4d4
    https://github.com/scummvm/scummvm/commit/d8df21547d91153c6288a0dfa37006389ce3e4d4
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Refactor slightly to share room init code

Changed paths:
    engines/access/amazon/amazon_room.cpp
    engines/access/amazon/amazon_room.h
    engines/access/martian/martian_room.cpp
    engines/access/martian/martian_room.h
    engines/access/room.cpp
    engines/access/room.h
    engines/access/scripts.cpp


diff --git a/engines/access/amazon/amazon_room.cpp b/engines/access/amazon/amazon_room.cpp
index cfde88e3cca..006ea207ea1 100644
--- a/engines/access/amazon/amazon_room.cpp
+++ b/engines/access/amazon/amazon_room.cpp
@@ -90,7 +90,7 @@ void AmazonRoom::reloadRoom1() {
 
 	_vm->_screen->fadeOut();
 	_vm->_screen->clearScreen();
-	roomSet();
+	roomInit();
 
 	if (_roomFlag != 1 && (_vm->_player->_roomNumber != 61 || !_antOutFlag)) {
 		_vm->_player->load();
@@ -135,13 +135,6 @@ void AmazonRoom::setupRoom() {
 	}
 }
 
-void AmazonRoom::roomSet() {
-	_vm->_numAnimTimers = 0;
-	_vm->_scripts->_sequence = INIT_ROOM_SCRIPT;
-	_vm->_scripts->searchForSequence();
-	_vm->_scripts->executeScript();
-}
-
 void AmazonRoom::roomMenu() {
 	const SpriteResource *icons = _vm->getIcons();
 
diff --git a/engines/access/amazon/amazon_room.h b/engines/access/amazon/amazon_room.h
index fed02b2f815..e9fabe3b8fa 100644
--- a/engines/access/amazon/amazon_room.h
+++ b/engines/access/amazon/amazon_room.h
@@ -39,7 +39,6 @@ private:
 	bool _antOutFlag;
 	const byte *_icon;
 
-	void roomSet();
 protected:
 	void loadRoom(int roomNumber) override;
 
diff --git a/engines/access/martian/martian_room.cpp b/engines/access/martian/martian_room.cpp
index 51fc5853ace..5547fbc8798 100644
--- a/engines/access/martian/martian_room.cpp
+++ b/engines/access/martian/martian_room.cpp
@@ -61,7 +61,6 @@ void MartianRoom::reloadRoom() {
 }
 
 void MartianRoom::reloadRoom1() {
-	// aka initScene
 	_selectCommand = -1;
 	_vm->_boxSelect = false; //-1
 	_vm->_player->_playerOff = false;
@@ -70,7 +69,7 @@ void MartianRoom::reloadRoom1() {
 	_vm->_events->hideCursor();
 	_vm->_screen->clearScreen();
 	_vm->_events->showCursor();
-	roomSet();
+	roomInit();
 	_vm->_player->load();
 
 	if (_vm->_player->_roomNumber != 47)
@@ -92,12 +91,8 @@ void MartianRoom::reloadRoom1() {
 	_vm->_events->clearEvents();
 }
 
-void MartianRoom::roomSet() {
-	// aka runScriptInitScript
-	_vm->_numAnimTimers = 0;
-	_vm->_scripts->_sequence = INIT_ROOM_SCRIPT;
-	_vm->_scripts->searchForSequence();
-	_vm->_scripts->executeScript();
+void MartianRoom::roomInit() {
+	Room::roomInit();
 
 	for (int i = 0; i < 30; i++)
 		_vm->_flags[200 + i] = 0;
diff --git a/engines/access/martian/martian_room.h b/engines/access/martian/martian_room.h
index 2e3f598c032..36bcf353325 100644
--- a/engines/access/martian/martian_room.h
+++ b/engines/access/martian/martian_room.h
@@ -37,11 +37,11 @@ class MartianRoom : public Room {
 private:
 	MartianEngine *_game;
 
-	void roomSet();
-
 protected:
 	void loadRoom(int roomNumber) override;
 
+	void roomInit() override;
+
 	void reloadRoom() override;
 
 	void reloadRoom1() override;
diff --git a/engines/access/room.cpp b/engines/access/room.cpp
index 9d05bd737b8..983eafcf000 100644
--- a/engines/access/room.cpp
+++ b/engines/access/room.cpp
@@ -157,6 +157,10 @@ void Room::takePicture() {
 void Room::doRoom() {
 	bool reloadFlag = false;
 
+	// Noctropolis doesn't have an icon bar at the bottom, so never set arrow cursor
+	int mouseCursorArrowYThreshold = (_vm->getGameID() == kGameMartianMemorandum) ? 184 :
+		((_vm->getGameID() == kGameAmazon) ? 177 : 1000);
+
 	while (!_vm->shouldQuit()) {
 		if (!reloadFlag) {
 			_vm->_images.clear();
@@ -213,6 +217,9 @@ void Room::doRoom() {
 			}
 
 			if (_vm->_player->_scrollFlag) {
+				// TODO: Refactor a bit - the first 8 lines here are identical
+				// in both branches, but for now maintain original logic for
+				// ease of RE comparison
 				_vm->copyBF1BF2();
 				_vm->_newRects.clear();
 				_function = FN_NONE;
@@ -224,13 +231,18 @@ void Room::doRoom() {
 				} else {
 					_vm->plotList();
 					_vm->copyRects();
+
+					if (_vm->_events->_mousePos.y < mouseCursorArrowYThreshold)
+						_vm->_events->setCursor(_vm->_events->_normalMouse);
+					else
+						_vm->_events->setCursor(CURSOR_ARROW);
+
 					_vm->copyBF2Vid();
 				}
 			} else {
 				_vm->copyBF1BF2();
 				_vm->_newRects.clear();
 				_function = FN_NONE;
-
 				roomLoop();
 				if (_vm->shouldQuitOrRestart())
 					return;
@@ -241,8 +253,7 @@ void Room::doRoom() {
 				} else {
 					_vm->plotList();
 
-					if (((_vm->getGameID() == kGameMartianMemorandum) && (_vm->_events->_mousePos.y < 184)) ||
-						((_vm->getGameID() == kGameAmazon) && (_vm->_events->_mousePos.y < 177)))
+					if (_vm->_events->_mousePos.y < mouseCursorArrowYThreshold)
 						_vm->_events->setCursor(_vm->_events->_normalMouse);
 					else
 						_vm->_events->setCursor(CURSOR_ARROW);
@@ -254,6 +265,13 @@ void Room::doRoom() {
 	}
 }
 
+void Room::roomInit() {
+	_vm->_numAnimTimers = 0;
+	_vm->_scripts->_sequence = INIT_ROOM_SCRIPT;
+	_vm->_scripts->searchForSequence();
+	_vm->_scripts->executeScript();
+}
+
 void Room::clearRoom() {
 	if (_vm->_midi->_music) {
 		_vm->_midi->stopSong();
@@ -377,8 +395,8 @@ void Room::setupRoom() {
 		_vm->_scrollRow = 0;
 	} else {
 		_vm->_scrollY = _vm->_player->_rawPlayer.y -
-			(_vm->_player->_rawPlayer.y / 16) * 16;
-		int yc = MAX((_vm->_player->_rawPlayer.y >> 4) -
+			(_vm->_player->_rawPlayer.y / TILE_HEIGHT) * TILE_HEIGHT;
+		int yc = MAX((_vm->_player->_rawPlayer.y / TILE_HEIGHT) -
 			(screen._vWindowHeight / 2), 0);
 		_vm->_scrollRow = yc;
 
diff --git a/engines/access/room.h b/engines/access/room.h
index 167de526e75..82d9a31ffa9 100644
--- a/engines/access/room.h
+++ b/engines/access/room.h
@@ -106,6 +106,8 @@ protected:
 
 	void clearCamera();
 
+	virtual void roomInit();
+
 	virtual void reloadRoom() = 0;
 
 	virtual void reloadRoom1() = 0;
diff --git a/engines/access/scripts.cpp b/engines/access/scripts.cpp
index 6f7706f6261..a28556cca48 100644
--- a/engines/access/scripts.cpp
+++ b/engines/access/scripts.cpp
@@ -237,7 +237,7 @@ int Scripts::executeScript() {
 		while ((_scriptCommand = _data->readByte()) == SCRIPT_START_BYTE)
 			_data->skip(2);
 
-		if (_data->eos()) {
+		if (_data->eos())
 			error("Hit end of script data");
 
 		if (_scriptCommand < 0x80)


Commit: a16115f8c0fd293f411057e10d6ce1f00697379c
    https://github.com/scummvm/scummvm/commit/a16115f8c0fd293f411057e10d6ce1f00697379c
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Fix MM establishing shots

Changed paths:
    engines/access/char.cpp
    engines/access/martian/martian_game.cpp
    engines/access/martian/martian_game.h
    engines/access/martian/martian_resources.cpp
    engines/access/martian/martian_resources.h
    engines/access/martian/martian_scripts.cpp
    engines/access/scripts.cpp


diff --git a/engines/access/char.cpp b/engines/access/char.cpp
index 434f701cfff..affd39ccbb4 100644
--- a/engines/access/char.cpp
+++ b/engines/access/char.cpp
@@ -89,11 +89,12 @@ CharManager::CharManager(AccessEngine *vm) : Manager(vm) {
 }
 
 void CharManager::loadChar(int charId) {
-	CharEntry &ce = _charTable[charId];
+	const CharEntry &ce = _charTable[charId];
 	_charFlag = ce._charFlag;
 
+	// Amazon calls "establish" before loading the screen, but MM does it after.
 	_vm->_establishFlag = false;
-	if (ce._estabIndex != -1) {
+	if (_vm->getGameID() == kGameAmazon && ce._estabIndex != -1) {
 		_vm->_establishFlag = true;
 		if (!_vm->_establishTable[ce._estabIndex]) {
 			_vm->_establishTable[ce._estabIndex] = true;
@@ -114,6 +115,15 @@ void CharManager::loadChar(int charId) {
 	_vm->_buffer2.blitFrom(*_vm->_screen);
 	_vm->_screen->setDisplayScan();
 
+	if (_vm->getGameID() == kGameMartianMemorandum && ce._estabIndex != -1) {
+		_vm->_establishFlag = true;
+		if (!_vm->_establishTable[ce._estabIndex]) {
+			_vm->_establishTable[ce._estabIndex] = true;
+			_vm->establish(0, ce._estabIndex);
+			_vm->_screen->blitFrom(_vm->_buffer1);
+		}
+	}
+
 	if (_charFlag != 2 && _charFlag != 3) {
 		charMenu();
 	}
@@ -121,7 +131,8 @@ void CharManager::loadChar(int charId) {
 	_vm->_screen->_startColor = ce._startColor;
 	_vm->_screen->_numColors = ce._numColors;
 	if (ce._paletteFile._fileNum != -1) {
-		_vm->_screen->loadPalette(ce._paletteFile._fileNum, ce._paletteFile._subfile);
+		int srcOffset = (_vm->getGameID() == kGameMartianMemorandum ? ce._startColor * 3 : 0);
+		_vm->_screen->loadPalette(ce._paletteFile._fileNum, ce._paletteFile._subfile, srcOffset);
 	}
 	_vm->_screen->setIconPalette();
 	_vm->_screen->setPalette();
diff --git a/engines/access/martian/martian_game.cpp b/engines/access/martian/martian_game.cpp
index 8600ac17102..2fecef95387 100644
--- a/engines/access/martian/martian_game.cpp
+++ b/engines/access/martian/martian_game.cpp
@@ -298,7 +298,7 @@ void MartianEngine::setupGame() {
 	_player->_playerY = _player->_rawPlayer.y = _res->ROOMTBL[_player->_roomNumber]._travelPos.y;
 }
 
-void MartianEngine::showDeathText(Common::String msg) {
+void MartianEngine::showExpositionText(Common::String msg) {
 	Common::String line = "";
 	int width = 0;
 	bool lastLine;
@@ -339,7 +339,7 @@ void MartianEngine::dead(int deathId) {
 	_screen->_printStart = Common::Point(24, 18);
 
 	// Display death message
-	showDeathText(_deaths[deathId]._msg);
+	showExpositionText(_deaths[deathId]._msg);
 
 	_screen->forceFadeOut();
 	_room->clearRoom();
@@ -350,6 +350,37 @@ void MartianEngine::dead(int deathId) {
 	_events->pollEvents();
 }
 
+void MartianEngine::establish(int esatabIndex, int sub) {
+	_fonts._charSet._hi = 10;
+	Font::_fontColors[1] = 0xf7;
+	Font::_fontColors[2] = 0xff;
+
+	_screen->_maxChars = 50;
+	_screen->_printOrg = _screen->_printStart = Common::Point(24, 18);
+
+	// TODO: Original has a small delay here.
+
+	Resource *notesRes = _files->loadFile("ETEXT.DAT");
+	notesRes->_stream->seek(2 * sub);
+	uint16 msgOffset = notesRes->_stream->readUint16LE();
+	if (msgOffset == 0 || msgOffset >= notesRes->_stream->size()) {
+		error("MartianEngine::establish: Invalid message offset %d for msg %d", msgOffset, sub);
+	}
+
+	notesRes->_stream->seek(msgOffset);
+
+	Common::String msg = notesRes->_stream->readString();
+	showExpositionText(msg);
+
+	_events->hideCursor();
+	if (sub != 0x3f) {
+		_screen->forceFadeOut();
+		_screen->clearScreen();
+	}
+
+	_events->showCursor();
+}
+
 void MartianEngine::synchronize(Common::Serializer &s) {
 	AccessEngine::synchronize(s);
 
diff --git a/engines/access/martian/martian_game.h b/engines/access/martian/martian_game.h
index 3db1b19af60..3f1c94cb032 100644
--- a/engines/access/martian/martian_game.h
+++ b/engines/access/martian/martian_game.h
@@ -67,8 +67,8 @@ public:
 	~MartianEngine() override;
 
 	void doSpecial5(int param1);
-	void showDeathText(Common::String msg);
-	void establish(int esatabIndex, int sub) override {};
+	void showExpositionText(Common::String msg);
+	void establish(int esatabIndex, int sub) override;
 
 	/**
 	* Synchronize savegame data
diff --git a/engines/access/martian/martian_resources.cpp b/engines/access/martian/martian_resources.cpp
index 5bdc17867b9..ee50c564d74 100644
--- a/engines/access/martian/martian_resources.cpp
+++ b/engines/access/martian/martian_resources.cpp
@@ -133,7 +133,7 @@ const char *const SPEC7MESSAGE = {
 	"FAREWELL...'"
 };
 
-const byte _byte1EEB5[] = {
+const byte CAN_TRAVEL_MATRIX[] = {
 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 	0, 0, 0, 0, 0, 0, 0, 1, 1, 1,
 	1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
diff --git a/engines/access/martian/martian_resources.h b/engines/access/martian/martian_resources.h
index 1028d09cc08..30bd8ef6138 100644
--- a/engines/access/martian/martian_resources.h
+++ b/engines/access/martian/martian_resources.h
@@ -49,7 +49,7 @@ extern const char *const TRAVDATA[];
 
 extern const char *const SPEC7MESSAGE;
 
-extern const byte _byte1EEB5[];
+extern const byte CAN_TRAVEL_MATRIX[];
 extern const int PICTURERANGE[][2];
 
 class MartianResources : public Resources {
diff --git a/engines/access/martian/martian_scripts.cpp b/engines/access/martian/martian_scripts.cpp
index 7ae6bc50a25..c7904745537 100644
--- a/engines/access/martian/martian_scripts.cpp
+++ b/engines/access/martian/martian_scripts.cpp
@@ -101,41 +101,7 @@ void MartianScripts::cmdSpecial1(int param1, int param2) {
 	_vm->_screen->forceFadeIn();
 	_vm->_events->showCursor();
 
-	_vm->_fonts._charSet._hi = 10;
-	Font::_fontColors[1] = 0xf7;
-	Font::_fontColors[2] = 0xff;
-
-	_vm->_screen->_maxChars = 50;
-	_vm->_screen->_printOrg = _vm->_screen->_printStart = Common::Point(24, 18);
-
-	// TODO: Original has a small delay here.
-
-	Resource *notesRes = _vm->_files->loadFile("ETEXT.DAT");
-	/*
-	Common::DumpFile dump;
-	dump.open("/tmp/etext.dat.decomp");
-	dump.writeStream(notesRes->_stream);
-	dump.close();
-	*/
-
-	notesRes->_stream->seek(2 * param2);
-	uint16 msgOffset = notesRes->_stream->readUint16LE();
-	if (msgOffset == 0 || msgOffset >= notesRes->_stream->size()) {
-		error("MartianScripts::cmdSpecial1: Invalid message offset %d for msg %d", msgOffset, param2);
-	}
-
-	notesRes->_stream->seek(msgOffset);
-
-	Common::String msg = notesRes->_stream->readString();
-	_game->showDeathText(msg);
-
-	_vm->_events->hideCursor();
-	if (param2 != 0x3f) {
-		_vm->_screen->forceFadeOut();
-		_vm->_screen->clearScreen();
-	}
-
-	_vm->_events->showCursor();
+	_vm->establish(0, param2);
 }
 
 void MartianScripts::cmdSpecial3() {
@@ -184,7 +150,7 @@ void MartianScripts::cmdSpecial6() {
 	Common::String msg = notesRes->_stream->readString();
 
 	//display the message
-	_game->showDeathText(msg);
+	_game->showExpositionText(msg);
 
 	delete notesRes;
 	delete _vm->_objectsTable[0];
@@ -269,7 +235,7 @@ void MartianScripts::cmdSpecial7() {
 	_vm->_screen->_printStart = Common::Point(24, 18);
 
 	// Display death message
-	_game->showDeathText(Common::String(SPEC7MESSAGE));
+	_game->showExpositionText(Common::String(SPEC7MESSAGE));
 
 	_vm->_events->showCursor();
 	_vm->_screen->copyBuffer(&_vm->_buffer1);
diff --git a/engines/access/scripts.cpp b/engines/access/scripts.cpp
index a28556cca48..6c7c8d670d2 100644
--- a/engines/access/scripts.cpp
+++ b/engines/access/scripts.cpp
@@ -537,6 +537,7 @@ void Scripts::converse1(int val) {
 
 	_vm->_images.clear();
 	_vm->_oldRects.clear();
+	// TODO? also set SHORT_1950_88a9 = 0 here?
 	_sequence = 0;
 	searchForSequence();
 
@@ -804,22 +805,22 @@ void Scripts::cmdDoTravel() {
 			btnSelected = 2;
 
 		if (btnSelected != 2) {
-			int idx = _vm->_travelBox->_tempListIdx[boxX];
-			if (Martian::_byte1EEB5[idx] != _vm->_byte26CB5) {
-				_vm->_bubbleBox->_bubbleTitle = "_travel";
+			int newRoomNum = _vm->_travelBox->_tempListIdx[boxX];
+			if (Martian::CAN_TRAVEL_MATRIX[newRoomNum] != _vm->_flags[171]) {
+				_vm->_bubbleBox->_bubbleTitle = "TRAVEL";
 				_vm->_bubbleBox->printString(_vm->_res->CANT_GET_THERE);
 				continue;
 			}
-			if (_vm->_player->_roomNumber != idx) {
-				_vm->_player->_roomNumber = idx;
+			if (_vm->_player->_roomNumber != newRoomNum) {
+				_vm->_player->_roomNumber = newRoomNum;
 				_vm->_room->_function = FN_CLEAR1;
-				if (_vm->_res->ROOMTBL[idx]._travelPos.x == -1) {
+				if (_vm->_res->ROOMTBL[newRoomNum]._travelPos.x == -1) {
 					// For x == -1, the y value is a script Id, not a co-ordinate
 					_vm->_room->_conFlag = true;
-					_vm->_scripts->converse1(_vm->_res->ROOMTBL[idx]._travelPos.y);
+					_vm->_scripts->converse1(_vm->_res->ROOMTBL[newRoomNum]._travelPos.y);
 					return;
 				}
-				_vm->_player->_rawPlayer = _vm->_res->ROOMTBL[idx]._travelPos;
+				_vm->_player->_rawPlayer = _vm->_res->ROOMTBL[newRoomNum]._travelPos;
 				cmdRetPos();
 				return;
 			}


Commit: 4bfe985f47731f6d5dd674cd6918d8fdc3584fb0
    https://github.com/scummvm/scummvm/commit/4bfe985f47731f6d5dd674cd6918d8fdc3584fb0
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Fix palette loading for MM videos

Changed paths:
    engines/access/access.cpp
    engines/access/screen.cpp
    engines/access/screen.h
    engines/access/video.cpp


diff --git a/engines/access/access.cpp b/engines/access/access.cpp
index 706bb3e9637..9759c0c0189 100644
--- a/engines/access/access.cpp
+++ b/engines/access/access.cpp
@@ -461,6 +461,7 @@ void AccessEngine::freeChar() {
 	_scripts->freeScriptData();
 	_animation->clearTimers();
 	_animation->freeAnimationData();
+	_player->freeSprites();
 }
 
 Common::Error AccessEngine::saveGameState(int slot, const Common::String &desc, bool isAutosave) {
diff --git a/engines/access/screen.cpp b/engines/access/screen.cpp
index 7c3f7fe0900..f2945b78b51 100644
--- a/engines/access/screen.cpp
+++ b/engines/access/screen.cpp
@@ -31,6 +31,17 @@
 #include "access/resources.h"
 #include "access/martian/martian_resources.h"
 
+
+// for frame contents debugging
+//#define DEBUG_FRAME_DUMP 1
+
+#ifdef DEBUG_FRAME_DUMP
+#include "graphics/paletteman.h"
+#include "image/png.h"
+#include "common/path.h"
+#include "common/file.h"
+#endif
+
 namespace Access {
 
 ScreenSave::ScreenSave(){
@@ -118,12 +129,14 @@ void Screen::setInitialPalettte() {
 }
 
 void Screen::setManPalette() {
+	// Player palette is colors 224~246
 	for (int i = 0; i < 0x42; i++) {
 		_rawPalette[672 + i] = PALETTE_6BIT_TO_8BIT(_manPal[i]);
 	}
 }
 
 void Screen::setIconPalette() {
+	// Icon palette is colors 247~255
 	if (_vm->getGameID() == kGameMartianMemorandum) {
 		for (int i = 0; i < 0x1B; i++) {
 			_rawPalette[741 + i] = PALETTE_6BIT_TO_8BIT(Martian::ICON_PALETTE[i]);
@@ -131,10 +144,17 @@ void Screen::setIconPalette() {
 	}
 }
 
-void Screen::loadPalette(int fileNum, int subfile) {
+void Screen::loadPalette(int fileNum, int subfile, int srcOffset) {
 	Resource *res = _vm->_files->loadFile(fileNum, subfile);
-	const byte *palette = res->data();
-	Common::copy(palette, palette + (_numColors * 3), &_rawPalette[_startColor * 3]);
+	const byte *palette = res->data() + srcOffset;
+
+	if (_vm->getGameID() == kGameMartianMemorandum) {
+		for (int i = 0; i < _numColors * 3; i++)
+			_rawPalette[_startColor * 3 + i] = PALETTE_6BIT_TO_8BIT(palette[i]);
+	} else {
+		// TODO: is this right for Amaazon?  Surely it should be converted?  Maybe never used..
+		Common::copy(palette, palette + (_numColors * 3), &_rawPalette[_startColor * 3]);
+	}
 	delete res;
 }
 
@@ -334,4 +354,15 @@ void Screen::flashPalette(int count) {
 	// No implementation needed in ScummVM
 }
 
+void Screen::dump(const char *fname) const {
+#ifdef DEBUG_FRAME_DUMP
+	/* For debugging, dump the frame contents.. */
+	::Common::DumpFile outf;
+	uint32 now = g_system->getMillis();
+	outf.open(::Common::Path(::Common::String::format("/tmp/%07d-%s.png", now, fname)));
+	::Image::writePNG(outf, *this, _rawPalette);
+	outf.close();
+#endif
+}
+
 } // End of namespace Access
diff --git a/engines/access/screen.h b/engines/access/screen.h
index 735dd0e8b2d..7e5e94a6280 100644
--- a/engines/access/screen.h
+++ b/engines/access/screen.h
@@ -133,7 +133,7 @@ public:
 	 */
 	void setManPalette();
 
-	void loadPalette(int fileNum, int subfile);
+	void loadPalette(int fileNum, int subfile, int srcOffset = 0);
 
 	void setPalette();
 
@@ -171,6 +171,8 @@ public:
 	void cyclePaletteForward();
 
 	void cyclePaletteBackwards();
+
+	void dump(const char *fname) const;
 };
 
 } // End of namespace Access
diff --git a/engines/access/video.cpp b/engines/access/video.cpp
index de8ea4340df..5fd56e203a3 100644
--- a/engines/access/video.cpp
+++ b/engines/access/video.cpp
@@ -121,6 +121,9 @@ void VideoPlayer::playVideo() {
 	byte *pLine = _startCoord;
 	uint32 frameEnd = _videoData->_stream->pos() + _frameSize;
 
+	if (frameEnd > _videoData->_stream->size())
+		error("VideoPlayer::playVideo: Frame end %d > stream size %d", frameEnd, (int)_videoData->_stream->size());
+
 	while ((uint32)_videoData->_stream->pos() < frameEnd) {
 		int count = _videoData->_stream->readByte();
 
@@ -161,6 +164,8 @@ void VideoPlayer::playVideo() {
 	if (_vidSurface == _vm->_screen)
 		_vm->_screen->markAllDirty();
 
+	_vm->_screen->dump("vidframe");
+
 	getFrame();
 	if (++_videoFrame == _frameCount) {
 		closeVideo();


Commit: 56b224c628e24d7121e1fcc02e17360afe77fae7
    https://github.com/scummvm/scummvm/commit/56b224c628e24d7121e1fcc02e17360afe77fae7
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Restore footstep noises in Amazon too

Changed paths:
    engines/access/player.cpp


diff --git a/engines/access/player.cpp b/engines/access/player.cpp
index 285fba90b85..44d5ac4c0b2 100644
--- a/engines/access/player.cpp
+++ b/engines/access/player.cpp
@@ -267,9 +267,10 @@ void Player::walkUp() {
 
 		calcManScale();
 
-		// TODO: Implement step sounds also for Amazon? (_frame == 17 || _frame == 21))
 		if (_vm->getGameID() == kGameMartianMemorandum && _vm->_flags[174] == 0 && (_frame == 8 || _frame == 12))
 			_vm->_sound->playSound(0);
+		else if (_vm->getGameID() == kGameAmazon && _vm->_currentMan != 3 && (_frame == 17 || _frame == 21))
+			_vm->_sound->playSound(0);
 
 		if (++_frame > _upWalkMax)
 			_frame = _upWalkMin;
@@ -300,6 +301,8 @@ void Player::walkDown() {
 		// TODO: Implement step sounds also for Amazon? (_frame == 10 || _frame == 14)
 		if (_vm->getGameID() == kGameMartianMemorandum && _vm->_flags[174] == 0 && (_frame == 17 || _frame == 21))
 			_vm->_sound->playSound(0);
+		else if (_vm->getGameID() == kGameAmazon && _vm->_currentMan != 3 && (_frame == 10 || _frame == 14))
+			_vm->_sound->playSound(0);
 
 		if (++_frame > _downWalkMax)
 			_frame = _downWalkMin;
@@ -338,9 +341,10 @@ void Player::walkLeft() {
 		_rawPlayerLow.x = _rawTempL;
 		++_frame;
 
-		// TODO: Implement step sounds also for Amazon? (_frame == 1 || _frame == 5)
 		if (_vm->getGameID() == kGameMartianMemorandum && _vm->_flags[174] == 0 && (_frame == 7 || _frame == 3))
 			_vm->_sound->playSound(0);
+		else if (_vm->getGameID() == kGameAmazon && _vm->_currentMan != 3 && (_frame == 1 || _frame == 5))
+			_vm->_sound->playSound(0);
 
 		if (_frame > _sideWalkMax)
 			_frame = _sideWalkMin;
@@ -379,9 +383,10 @@ void Player::walkRight() {
 		_rawPlayerLow.x = _rawTempL;
 		++_frame;
 
-		// TODO: Implement step sounds also for Amazon
 		if (_vm->getGameID() == kGameMartianMemorandum && _vm->_flags[174] == 0 && (_frame == 7 || _frame == 3))
 			_vm->_sound->playSound(0);
+		else if (_vm->getGameID() == kGameAmazon && _vm->_currentMan != 3 && (_frame == 1 || _frame == 5))
+			_vm->_sound->playSound(0);
 
 		// Useless check removed
 		if (_frame > _sideWalkMax)
@@ -431,9 +436,8 @@ void Player::walkUpLeft() {
 		++_frame;
 		calcManScale();
 
-		// This code looks totally useless as 'si' is unconditionally set in plotCom1
-		//if (_vm->_currentMan != 3 && (_frame == 1 || _frame == 5))
-		//	warning("TODO: walkUpLeft - si = 0?");
+		if (_vm->_currentMan != 3 && (_frame == 1 || _frame == 5))
+			_vm->_sound->playSound(0);
 
 		if (_frame > _diagUpWalkMax)
 			_frame = _diagUpWalkMin;
@@ -482,9 +486,8 @@ void Player::walkDownLeft() {
 		++_frame;
 		calcManScale();
 
-		// This code looks totally useless as 'si' is unconditionally set in plotCom1
-		//if (_vm->_currentMan != 3 && (_frame == 1 || _frame == 5))
-		//	warning("TODO: walkDownLeft - si = 0?");
+		if (_vm->_currentMan != 3 && (_frame == 1 || _frame == 5))
+			_vm->_sound->playSound(0);
 
 		if (_frame > _diagDownWalkMax)
 			_frame = _diagDownWalkMin;
@@ -533,9 +536,8 @@ void Player::walkUpRight() {
 		++_frame;
 		calcManScale();
 
-		// This code looks totally useless as 'si' is unconditionally set in plotCom
-		//if (_vm->_currentMan != 3 && (_frame == 1 || _frame == 5))
-		//	warning("TODO: walkUpRight - si = 0?");
+		if (_vm->_currentMan != 3 && (_frame == 1 || _frame == 5))
+			_vm->_sound->playSound(0);
 
 		if (_frame > _diagUpWalkMax)
 			_frame = _diagUpWalkMin;
@@ -583,9 +585,8 @@ void Player::walkDownRight() {
 
 		calcManScale();
 
-		// This code looks totally useless as 'si' is unconditionally set in plotCom1
-		//if (_vm->_currentMan != 3 && (_frame == 1 || _frame == 5))
-		//	warning("TODO: walkDownRight - si = 0?");
+		if (_vm->_currentMan != 3 && (_frame == 1 || _frame == 5))
+			_vm->_sound->playSound(0);
 
 		++_frame;
 		if (_frame > _diagDownWalkMax)


Commit: 4194288e4509d53d4b8726f88cd5df7938180545
    https://github.com/scummvm/scummvm/commit/4194288e4509d53d4b8726f88cd5df7938180545
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Fix variable name

Changed paths:
    engines/access/martian/martian_game.cpp
    engines/access/martian/martian_game.h


diff --git a/engines/access/martian/martian_game.cpp b/engines/access/martian/martian_game.cpp
index 2fecef95387..583c7eb71a0 100644
--- a/engines/access/martian/martian_game.cpp
+++ b/engines/access/martian/martian_game.cpp
@@ -350,7 +350,7 @@ void MartianEngine::dead(int deathId) {
 	_events->pollEvents();
 }
 
-void MartianEngine::establish(int esatabIndex, int sub) {
+void MartianEngine::establish(int estabIndex, int sub) {
 	_fonts._charSet._hi = 10;
 	Font::_fontColors[1] = 0xf7;
 	Font::_fontColors[2] = 0xff;
diff --git a/engines/access/martian/martian_game.h b/engines/access/martian/martian_game.h
index 3f1c94cb032..1111fae53e1 100644
--- a/engines/access/martian/martian_game.h
+++ b/engines/access/martian/martian_game.h
@@ -68,7 +68,7 @@ public:
 
 	void doSpecial5(int param1);
 	void showExpositionText(Common::String msg);
-	void establish(int esatabIndex, int sub) override;
+	void establish(int estabIndex, int sub) override;
 
 	/**
 	* Synchronize savegame data


Commit: 34c14e20a7e8840071a1ff677ed00c89eb54c016
    https://github.com/scummvm/scummvm/commit/34c14e20a7e8840071a1ff677ed00c89eb54c016
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Fix rendering of camera scene in MM

Changed paths:
    engines/access/asurface.cpp
    engines/access/asurface.h
    engines/access/player.cpp
    engines/access/scripts.cpp


diff --git a/engines/access/asurface.cpp b/engines/access/asurface.cpp
index d084fa8e209..4c820a5c0bb 100644
--- a/engines/access/asurface.cpp
+++ b/engines/access/asurface.cpp
@@ -109,6 +109,12 @@ void ImageEntryList::addToList(ImageEntry &ie) {
 int BaseSurface::_clipWidth;
 int BaseSurface::_clipHeight;
 
+int BaseSurface::_lastBoundsX;
+int BaseSurface::_lastBoundsY;
+int BaseSurface::_lastBoundsW;
+int BaseSurface::_lastBoundsH;
+
+
 BaseSurface::BaseSurface(): Graphics::Screen(0, 0) {
 	free();		// Free the 0x0 surface allocated by Graphics::Screen
 	_leftSkip = _rightSkip = 0;
diff --git a/engines/access/asurface.h b/engines/access/asurface.h
index fdda2906548..99d24bfe7f6 100644
--- a/engines/access/asurface.h
+++ b/engines/access/asurface.h
@@ -49,8 +49,6 @@ protected:
 public:
 	int _leftSkip, _rightSkip;
 	int _topSkip, _bottomSkip;
-	int _lastBoundsX, _lastBoundsY;
-	int _lastBoundsW, _lastBoundsH;
 	int _orgX1, _orgY1;
 	int _orgX2, _orgY2;
 	int _lColor;
@@ -59,6 +57,9 @@ public:
 	Common::Point _printStart;
 	int _maxChars;
 public:
+	// These values need to be shared between the buffers
+	static int _lastBoundsX, _lastBoundsY;
+	static int _lastBoundsW, _lastBoundsH;
 	static int _clipWidth, _clipHeight;
 public:
 	BaseSurface();
diff --git a/engines/access/player.cpp b/engines/access/player.cpp
index 44d5ac4c0b2..904348d9878 100644
--- a/engines/access/player.cpp
+++ b/engines/access/player.cpp
@@ -298,7 +298,6 @@ void Player::walkDown() {
 
 		calcManScale();
 
-		// TODO: Implement step sounds also for Amazon? (_frame == 10 || _frame == 14)
 		if (_vm->getGameID() == kGameMartianMemorandum && _vm->_flags[174] == 0 && (_frame == 17 || _frame == 21))
 			_vm->_sound->playSound(0);
 		else if (_vm->getGameID() == kGameAmazon && _vm->_currentMan != 3 && (_frame == 10 || _frame == 14))
diff --git a/engines/access/scripts.cpp b/engines/access/scripts.cpp
index 6c7c8d670d2..dcf07f5d346 100644
--- a/engines/access/scripts.cpp
+++ b/engines/access/scripts.cpp
@@ -161,7 +161,7 @@ void Scripts::searchForSequence() {
 
 void Scripts::charLoop() {
 	bool endFlag = _endFlag;
-	int pos = _data->pos();
+	int64 pos = _data->pos();
 
 	_sequence = 2000;
 	searchForSequence();
@@ -232,6 +232,7 @@ int Scripts::executeScript() {
 	_endFlag = false;
 	_returnCode = 0;
 
+	debugC(1, kDebugScripts, "** Start script execution (at %d/%d bytes) **", (int)_data->pos(), (int)_data->size());
 	do {
 		// Get next command, skipping over script start start if it's being pointed to
 		while ((_scriptCommand = _data->readByte()) == SCRIPT_START_BYTE)
@@ -248,6 +249,11 @@ int Scripts::executeScript() {
 		executeCommand(_scriptCommand - 0x80);
 	} while (!_endFlag && !_vm->shouldQuitOrRestart());
 
+	if (_data)
+		debugC(1, kDebugScripts, "** End script execution (return %d, at %d/%d bytes) **", _returnCode, (int)_data->pos(), (int)_data->size());
+	else
+		debugC(1, kDebugScripts, "** End script execution (return %d, data cleared) **", _returnCode);
+
 	return _returnCode;
 }
 
@@ -537,11 +543,12 @@ void Scripts::converse1(int val) {
 
 	_vm->_images.clear();
 	_vm->_oldRects.clear();
-	// TODO? also set SHORT_1950_88a9 = 0 here?
+	// game also clears screen sprites here which is redundant, done by clearRoom above.
 	_sequence = 0;
 	searchForSequence();
 
 	if (_vm->_screen->_vesaMode) {
+		// This is not in MM, but _vesaMode is also never set there
 		_vm->_converseMode = 1;
 	}
 }
@@ -723,7 +730,8 @@ void Scripts::cmdPlotImage() {
 	int objId = _data->readUint16LE();
 	int imgId = _data->readUint16LE();
 	debugC(1, kDebugScripts, "cmdPlotImage(destX=%d, destY=%d, objId=%d, imgId=%d)", destX, destY, objId, imgId);
-	_vm->_screen->plotImage(_vm->_objectsTable[objId], imgId, Common::Point(destX, destY));
+
+	_vm->_current->plotImage(_vm->_objectsTable[objId], imgId, Common::Point(destX, destY));
 }
 
 void Scripts::cmdSetDisplay() {
@@ -754,7 +762,7 @@ void Scripts::cmdSaveRect() {
 	int w = _vm->_screen->_lastBoundsW;
 	int h = _vm->_screen->_lastBoundsH;
 	assert(x >= 0 && y >= 0 && x < 320 && y < 200 && w > 0 && h > 0 && w <= 320 && h <= 200);
-	_vm->_newRects.push_back(Common::Rect(x, y, x + w, x + h));
+	_vm->_newRects.push_back(Common::Rect(x, y, x + w, y + h));
 }
 
 void Scripts::cmdVideoEnded() {
@@ -1119,7 +1127,7 @@ void Scripts::cmdFreeSound() {
 	if (sound._soundTable.size() > 0 && sound._soundTable[0]._res) {
 		// Keep doing char display loop if playing sound for it
 		do {
-			if (_vm->_flags[236] == 1)
+			if (_vm->getGameID() == kGameAmazon && _vm->_flags[236] == 1)
 				charLoop();
 
 			_vm->_events->pollEvents();


Commit: 29d8433aa44bddc5a6deeef9200c612fc57875fc
    https://github.com/scummvm/scummvm/commit/29d8433aa44bddc5a6deeef9200c612fc57875fc
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Add debugger commands for travel table

Changed paths:
    engines/access/debugger.cpp
    engines/access/debugger.h


diff --git a/engines/access/debugger.cpp b/engines/access/debugger.cpp
index c017ee9aa62..34cf1276276 100644
--- a/engines/access/debugger.cpp
+++ b/engines/access/debugger.cpp
@@ -72,6 +72,8 @@ Debugger::Debugger(AccessEngine *vm) : GUI::Debugger(), _vm(vm) {
 	registerCmd("timers", WRAP_METHOD(Debugger, Cmd_Timers));
 	registerCmd("getflag", WRAP_METHOD(Debugger, Cmd_GetFlag));
 	registerCmd("setflag", WRAP_METHOD(Debugger, Cmd_SetFlag));
+	registerCmd("gettravel", WRAP_METHOD(Debugger, Cmd_GetTravel));
+	registerCmd("settravel", WRAP_METHOD(Debugger, Cmd_SetTravel));
 }
 
 Debugger::~Debugger() {
@@ -143,7 +145,7 @@ bool Debugger::Cmd_PlayMovie(int argc, const char **argv) {
 bool Debugger::Cmd_DumpScript(int argc, const char **argv) {
 	if (argc != 2) {
 		debugPrintf("Usage: %s <path>\n", argv[0]);
-		debugPrintf("Dumps the currently loaded script to the given path\n");
+		debugPrintf("Dumps the currently loaded script data to the given path\n");
 		return true;
 	}
 
@@ -197,20 +199,20 @@ bool Debugger::Cmd_SetFlag(int argc, const char **argv) {
 		return true;
 	}
 
-	int flagNum = strToInt(argv[1]);
-	if (flagNum < 0 || flagNum >= 256) {
+	int num = strToInt(argv[1]);
+	if (num < 0 || num >= ARRAYSIZE(_vm->_flags)) {
 		debugPrintf("Invalid flag number\n");
 		return true;
 	}
 
-	int flagVal = strToInt(argv[2]);
-	if (flagVal < 0 || flagVal >= 256) {
+	int val = strToInt(argv[2]);
+	if (val < 0 || val >= 256) {
 		debugPrintf("Invalid flag val, must be byte\n");
 		return true;
 	}
-	_vm->_flags[flagNum] = flagVal;
+	_vm->_flags[num] = val;
 
-	debugPrintf("Flag %d set to %d\n", flagNum, flagVal);
+	debugPrintf("Flag %d set to %d\n", num, val);
 	return true;
 }
 
@@ -230,6 +232,45 @@ bool Debugger::Cmd_Timers(int argc, const char **argv) {
 	return true;
 }
 
+bool Debugger::Cmd_GetTravel(int argc, const char **argv) {
+	debugPrintf("Travel table:\n");
+
+	const int ncols = ARRAYSIZE(_vm->_travel) / 10;
+	for (int row = 0; row < 10; ++row) {
+		for (int col = 0; col < ncols; ++col) {
+			debugPrintf("%d ", _vm->_travel[row * ncols + col]);
+		}
+		debugPrintf("\n");
+	}
+
+	return true;
+}
+
+bool Debugger::Cmd_SetTravel(int argc, const char **argv) {
+	if (argc != 3) {
+		debugPrintf("Usage: %s <travel number> <travel value>\n", argv[0]);
+		debugPrintf("Sets the given travel table entry to the given value\n");
+		return true;
+	}
+
+	int num = strToInt(argv[1]);
+	if (num < 0 || num >= ARRAYSIZE(_vm->_travel)) {
+		debugPrintf("Invalid travel number\n");
+		return true;
+	}
+
+	int val = strToInt(argv[2]);
+	if (val < 0 || val >= 256) {
+		debugPrintf("Invalid travel val, must be byte\n");
+		return true;
+	}
+	_vm->_flags[num] = val;
+
+	debugPrintf("Travel %d set to %d\n", num, val);
+	return true;
+}
+
+
 /*------------------------------------------------------------------------*/
 
 namespace Amazon {
diff --git a/engines/access/debugger.h b/engines/access/debugger.h
index af3b7c51fc4..db1bdadf60c 100644
--- a/engines/access/debugger.h
+++ b/engines/access/debugger.h
@@ -43,6 +43,8 @@ protected:
 	bool Cmd_Timers(int argc, const char **argv);
 	bool Cmd_GetFlag(int argc, const char **argv);
 	bool Cmd_SetFlag(int argc, const char **argv);
+	bool Cmd_GetTravel(int argc, const char **argv);
+	bool Cmd_SetTravel(int argc, const char **argv);
 
 public:
 	static Debugger *init(AccessEngine *vm);


Commit: 4c9f2cb6fb66fd45cf8c35a9cf2a0fc14569c910
    https://github.com/scummvm/scummvm/commit/4c9f2cb6fb66fd45cf8c35a9cf2a0fc14569c910
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Use common string reading code

There were lots of different places where string reading was defined, but they
all did the same thing as ReadStream::readString(), so call that instead and
delete the duplicate code.

Changed paths:
    engines/access/access.cpp
    engines/access/amazon/amazon_resources.cpp
    engines/access/amazon/amazon_scripts.cpp
    engines/access/resources.cpp
    engines/access/resources.h
    engines/access/scripts.cpp
    engines/access/scripts.h


diff --git a/engines/access/access.cpp b/engines/access/access.cpp
index 9759c0c0189..32f333780c7 100644
--- a/engines/access/access.cpp
+++ b/engines/access/access.cpp
@@ -549,10 +549,7 @@ WARN_UNUSED_RESULT bool AccessEngine::readSavegameHeader(Common::InSaveFile *in,
 		return false;
 
 	// Read in the string
-	header._saveName.clear();
-	char ch;
-	while ((ch = (char)in->readByte()) != '\0')
-		header._saveName += ch;
+	header._saveName = in->readString();
 
 	// Get the thumbnail
 	if (!Graphics::loadThumbnail(*in, header._thumbnail, skipThumbnail)) {
diff --git a/engines/access/amazon/amazon_resources.cpp b/engines/access/amazon/amazon_resources.cpp
index 0beb2621caa..741b2c49ba1 100644
--- a/engines/access/amazon/amazon_resources.cpp
+++ b/engines/access/amazon/amazon_resources.cpp
@@ -45,18 +45,18 @@ void AmazonResources::load(Common::SeekableReadStream &s) {
 	uint count;
 
 	// Load the version specific data
-	NO_HELP_MESSAGE = readString(s);
-	NO_HINTS_MESSAGE = readString(s);
-	RIVER_HIT1 = readString(s);
-	RIVER_HIT2 = readString(s);
-	BAR_MESSAGE = readString(s);
+	NO_HELP_MESSAGE = s.readString();
+	NO_HINTS_MESSAGE = s.readString();
+	RIVER_HIT1 = s.readString();
+	RIVER_HIT2 = s.readString();
+	BAR_MESSAGE = s.readString();
 
 	for (int idx = 0; idx < 3; ++idx)
-		HELPLVLTXT[idx] = readString(s);
+		HELPLVLTXT[idx] = s.readString();
 	for (int idx = 0; idx < 9; ++idx)
-		IQLABELS[idx] = readString(s);
+		IQLABELS[idx] = s.readString();
 
-	CANT_GET_THERE = readString(s);
+	CANT_GET_THERE = s.readString();
 
 	// Get the offset of the general shared data for the game
 	uint entryOffset = findEntry(_vm->getGameID(), 2, 0, (Common::Language)0);
diff --git a/engines/access/amazon/amazon_scripts.cpp b/engines/access/amazon/amazon_scripts.cpp
index 00d0845b786..66be4fbb8ff 100644
--- a/engines/access/amazon/amazon_scripts.cpp
+++ b/engines/access/amazon/amazon_scripts.cpp
@@ -393,7 +393,7 @@ void AmazonScripts::executeCommand(int commandIndex) {
 }
 
 void AmazonScripts::cmdHelp_v2() {
-	Common::String helpMessage = readString();
+	Common::String helpMessage = _data->readString();
 
 	if (_game->_helpLevel == 0) {
 		_game->_timers.saveTimers();
diff --git a/engines/access/resources.cpp b/engines/access/resources.cpp
index 0a5fbc183b6..2fb34396f29 100644
--- a/engines/access/resources.cpp
+++ b/engines/access/resources.cpp
@@ -107,7 +107,7 @@ void Resources::load(Common::SeekableReadStream &s) {
 	count = s.readUint16LE();
 	FILENAMES.resize(count);
 	for (uint idx = 0; idx < count; ++idx)
-		FILENAMES[idx] = readString(s);
+		FILENAMES[idx] = s.readString();
 
 	// Load the character data
 	count = s.readUint16LE();
@@ -123,7 +123,7 @@ void Resources::load(Common::SeekableReadStream &s) {
 	count = s.readUint16LE();
 	ROOMTBL.resize(count);
 	for (uint idx = 0; idx < count; ++idx) {
-		ROOMTBL[idx]._desc = readString(s);
+		ROOMTBL[idx]._desc = s.readString();
 		ROOMTBL[idx]._travelPos.x = s.readSint16LE();
 		ROOMTBL[idx]._travelPos.y = s.readSint16LE();
 		uint count2 = s.readUint16LE();
@@ -137,14 +137,14 @@ void Resources::load(Common::SeekableReadStream &s) {
 	DEATHS.resize(count);
 	for (uint idx = 0; idx < count; ++idx) {
 		DEATHS[idx]._screenId = s.readByte();
-		DEATHS[idx]._msg = readString(s);
+		DEATHS[idx]._msg = s.readString();
 	}
 
 	// Load in the inventory list
 	count = s.readUint16LE();
 	INVENTORY.resize(count);
 	for (uint idx = 0; idx < count; ++idx) {
-		INVENTORY[idx]._desc = readString(s);
+		INVENTORY[idx]._desc = s.readString();
 		for (uint idx2 = 0; idx2 < 4; ++idx2)
 			INVENTORY[idx]._combo[idx2] = s.readSint16LE();
 	}
@@ -160,16 +160,6 @@ uint Resources::findEntry(byte gameId, byte discType, byte demoType, Common::Lan
 	error("Could not locate appropriate access.dat entry");
 }
 
-Common::String Resources::readString(Common::SeekableReadStream &s) {
-	Common::String result;
-	char c;
-
-	while ((c = s.readByte()) != 0)
-		result += c;
-
-	return result;
-}
-
 /*------------------------------------------------------------------------*/
 
 const byte INITIAL_PALETTE[18 * 3] = {
diff --git a/engines/access/resources.h b/engines/access/resources.h
index ffab7743846..f153f5b8e98 100644
--- a/engines/access/resources.h
+++ b/engines/access/resources.h
@@ -71,11 +71,6 @@ protected:
 	 */
 	uint findEntry(byte gameId, byte discType, byte demoType, Common::Language language);
 
-	/**
-	 * Read a string in from the passed stream
-	 */
-	Common::String readString(Common::SeekableReadStream &s);
-
 	/**
 	 * Load data from the access.dat file
 	 */
diff --git a/engines/access/scripts.cpp b/engines/access/scripts.cpp
index dcf07f5d346..ac342b702c8 100644
--- a/engines/access/scripts.cpp
+++ b/engines/access/scripts.cpp
@@ -201,7 +201,7 @@ void Scripts::printWatch() {
 	_vm->_screen->_printStart = Common::Point(128, 58);
 	clearWatch();
 
-	Common::String msg = readString();
+	Common::String msg = _data->readString();
 	Common::String line = "";
 	int width = 0;
 	bool lastLine;
@@ -238,9 +238,6 @@ int Scripts::executeScript() {
 		while ((_scriptCommand = _data->readByte()) == SCRIPT_START_BYTE)
 			_data->skip(2);
 
-		if (_data->eos())
-			error("Hit end of script data");
-
 		if (_scriptCommand < 0x80)
 			error("Unexpected opcode value %d", _scriptCommand);
 
@@ -361,7 +358,7 @@ void Scripts::cmdNull() {
 
 void Scripts::cmdPrint_v2() {
 	// Get a text line for display
-	Common::String msg = readString();
+	Common::String msg = _data->readString();
 	debugC(1, kDebugScripts, "cmdPrint_v2(msg=\"%s\")", msg.c_str());
 	printString(msg);
 }
@@ -378,7 +375,7 @@ void Scripts::doCmdPrint_v1(const Common::String &msg) {
 }
 
 void Scripts::cmdPrint_v1() {
-	Common::String msg = readString();
+	Common::String msg = _data->readString();
 	debugC(1, kDebugScripts, "cmdPrint_v1(msg=\"%s\")", msg.c_str());
 	doCmdPrint_v1(msg);
 }
@@ -405,15 +402,6 @@ void Scripts::printString(const Common::String &msg) {
 	_vm->_screen->restoreBlock();
 }
 
-Common::String Scripts::readString() {
-	Common::String msg;
-	byte c;
-	while ((c = (char)_data->readByte()) != '\0')
-		msg += c;
-
-	return msg;
-}
-
 void Scripts::cmdRetPos() {
 	debugC(1, kDebugScripts, "cmdRetPos()");
 	_endFlag = true;
@@ -801,6 +789,7 @@ void Scripts::cmdRemoveLast() {
 }
 
 void Scripts::cmdDoTravel() {
+	// MM only
 	debugC(1, kDebugScripts, "cmdDoTravel()");
 	while (true) {
 		_vm->_travelBox->getList(Martian::TRAVDATA, _vm->_travel);
@@ -847,7 +836,7 @@ void Scripts::cmdHelp_v1() {
 	for (int i = 0; i < 40; i++) {
 		byte c = _data->readByte();
 		if (c != 0xFF) {
-			Common::String tmpStr = c + readString();
+			Common::String tmpStr = c + _data->readString();
 			if (Martian::HELP[i]) {
 				_vm->_helpBox->_tempList[idx] = tmpStr;
 				_vm->_helpBox->_tempListIdx[idx] = i;
@@ -924,33 +913,25 @@ void Scripts::cmdCycle() {
 }
 
 void Scripts::cmdCharSpeak() {
-	debugC(1, kDebugScripts, "cmdCharSpeak()");
 	_vm->_screen->_printOrg = _charsOrg;
 	_vm->_screen->_printStart = _charsOrg;
 
-	byte v;
-	Common::String tmpStr = "";
-	while ((v = _data->readByte()) != 0)
-		tmpStr += (char)v;
-
-	_vm->_bubbleBox->placeBubble(tmpStr);
+	Common::String str = _data->readString();
+	debugC(1, kDebugScripts, "cmdCharSpeak(str=\"%s\")", str.c_str());
+	_vm->_bubbleBox->placeBubble(str);
 	findNull();
 }
 
 void Scripts::cmdTexSpeak() {
-	debugC(1, kDebugScripts, "cmdTexSpeak()");
 	_vm->_screen->_printOrg = _texsOrg;
 	_vm->_screen->_printStart = _texsOrg;
 	_vm->_screen->_maxChars = (_vm->getGameID() == kGameMartianMemorandum) ? 23 : 20;
 
-	byte v;
-	Common::String tmpStr = "";
-	while ((v = _data->readByte()) != 0)
-		tmpStr += (char)v;
+	Common::String str = _data->readString();
+	debugC(1, kDebugScripts, "cmdTexSpeak(str=\"%s\")", str.c_str());
 
 	_vm->_bubbleBox->_bubbleDisplStr = _vm->_res->getEgoName();
-
-	_vm->_bubbleBox->placeBubble1(tmpStr);
+	_vm->_bubbleBox->placeBubble1(str);
 	findNull();
 }
 
@@ -977,10 +958,7 @@ void Scripts::cmdTexChoice() {
 	_vm->_bubbleBox->clearBubbles();
 	_vm->_bubbleBox->_bubbleDisplStr = "RESPONSE 1";
 
-	byte v;
-	Common::String tmpStr = "";
-	while ((v = _data->readByte()) != 0)
-		tmpStr += (char)v;
+	Common::String tmpStr = _data->readString();
 
 	_vm->_bubbleBox->calcBubble(tmpStr);
 	_vm->_bubbleBox->printBubble(tmpStr);
@@ -993,11 +971,9 @@ void Scripts::cmdTexChoice() {
 
 	findNull();
 
-	tmpStr.clear();
-	while ((v = _data->readByte()) != 0)
-		tmpStr += (char)v;
+	tmpStr = _data->readString();
 
-	if (tmpStr.size() != 0) {
+	if (!tmpStr.empty()) {
 		_vm->_bubbleBox->_bubbleDisplStr = "RESPONSE 2";
 		_vm->_bubbleBox->calcBubble(tmpStr);
 		_vm->_bubbleBox->printBubble(tmpStr);
@@ -1008,11 +984,9 @@ void Scripts::cmdTexChoice() {
 	findNull();
 
 	bool choice3Fl = false;
-	tmpStr.clear();
-	while ((v = _data->readByte()) != 0)
-		tmpStr += (char)v;
+	tmpStr = _data->readString();
 
-	if (tmpStr.size() != 0) {
+	if (!tmpStr.empty()) {
 		_vm->_bubbleBox->_bubbleDisplStr = "RESPONSE 3";
 		_vm->_bubbleBox->calcBubble(tmpStr);
 		_vm->_bubbleBox->printBubble(tmpStr);
diff --git a/engines/access/scripts.h b/engines/access/scripts.h
index dd53d8ae3e4..bd5174a17a9 100644
--- a/engines/access/scripts.h
+++ b/engines/access/scripts.h
@@ -56,11 +56,6 @@ protected:
 
 	void charLoop();
 
-	/**
-	 * Read a null terminated string from the script
-	 */
-	Common::String readString();
-
 	void cmdObject();
 	void cmdEndObject();
 	void cmdJumpLook();


Commit: 6966144e7747c6ae83e56fbf9a9bfc2413166061
    https://github.com/scummvm/scummvm/commit/6966144e7747c6ae83e56fbf9a9bfc2413166061
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Fix MM room num in convo-only rooms

This finally fixes the crash if we cancel travel after someone like Chantal
tells Tex to go away.

Changed paths:
    engines/access/scripts.cpp


diff --git a/engines/access/scripts.cpp b/engines/access/scripts.cpp
index ac342b702c8..daab719c387 100644
--- a/engines/access/scripts.cpp
+++ b/engines/access/scripts.cpp
@@ -467,7 +467,7 @@ void Scripts::cmdCheckInventory() {
 	int itemId = _data->readUint16LE();
 	int itemVal = _data->readUint16LE();
 	debugCN(1, kDebugScripts, "cmdCheckInventory(itemId=%d, itemVal=%d)", itemId, itemVal);
-	if ((*_vm->_inventory)[itemId] == itemVal) {
+	if ((byte)(*_vm->_inventory)[itemId] == (byte)itemVal) {
 		debugC(1, kDebugScripts, " -> True");
 		cmdGoto();
 	} else {
@@ -660,13 +660,17 @@ void Scripts::cmdCheckTimer() {
 	if (_endFlag)
 		return;
 
-	if ((idx == 9) && _vm->_events->isKeyActionPending()) {
+	if (_vm->getGameID() == kGameAmazon && idx == 9 && _vm->_events->isKeyActionPending()) {
 		_vm->_events->zeroKeysActions();
 		_vm->_timers[9]._timer = 0;
 		_vm->_timers[9]._flag = 0;
 	}
 
-	int val = _data->readUint16LE() & 0xFF;
+	byte val = (byte)_data->readUint16LE();
+
+	if (val != 0 && val != 1)
+        warning("Invalid check value %d in cmdCheckTimer - expect only 1 or 0??", val);
+
 	if (_vm->_timers[idx]._flag == val) {
 		debugC(1, kDebugScripts, " -> True");
 		cmdGoto();
@@ -809,14 +813,15 @@ void Scripts::cmdDoTravel() {
 				continue;
 			}
 			if (_vm->_player->_roomNumber != newRoomNum) {
-				_vm->_player->_roomNumber = newRoomNum;
 				_vm->_room->_function = FN_CLEAR1;
 				if (_vm->_res->ROOMTBL[newRoomNum]._travelPos.x == -1) {
 					// For x == -1, the y value is a script Id, not a co-ordinate
 					_vm->_room->_conFlag = true;
+					_vm->_player->_roomNumber = -1;
 					_vm->_scripts->converse1(_vm->_res->ROOMTBL[newRoomNum]._travelPos.y);
 					return;
 				}
+				_vm->_player->_roomNumber = newRoomNum;
 				_vm->_player->_rawPlayer = _vm->_res->ROOMTBL[newRoomNum]._travelPos;
 				cmdRetPos();
 				return;
@@ -863,7 +868,7 @@ void Scripts::cmdCheckAbout() {
 	int idx = _data->readSint16LE();
 	int16 val = _data->readSint16LE();
 	debugCN(1, kDebugScripts, "cmdCheckAbout(idx=%d, val=%d)", idx, val);
-	if (_vm->_ask[idx] == val) {
+	if ((byte)_vm->_ask[idx] == (byte)val) {
 		debugC(1, kDebugScripts, " -> True");
 		cmdGoto();
 	} else {
@@ -1065,9 +1070,9 @@ void Scripts::cmdCheckVFrame() {
 }
 
 void Scripts::cmdJumpChoice() {
-	int val = (_data->readUint16LE() & 0xFF);
+	int val = _data->readUint16LE();
 	debugCN(1, kDebugScripts, "cmdJumpChoice(val=%d, choice=%d)", val, _choice);
-	if (val == _choice) {
+	if ((byte)val == (byte)_choice) {
 		debugC(1, kDebugScripts, " -> True");
 		cmdGoto();
 	} else {
@@ -1166,7 +1171,8 @@ void Scripts::cmdCheckTravel() {
 	int idx = _data->readSint16LE();
 	uint16 val = _data->readUint16LE();
 	debugCN(1, kDebugScripts, "cmdCheckTravel(idx=%d, val=%d)", idx, val);
-	if (_vm->_travel[idx] == val) {
+
+	if ((byte)_vm->_travel[idx] == (byte)val) {
 		debugC(1, kDebugScripts, " -> True");
 		cmdGoto();
 	} else {


Commit: 9676eb21574d665b3dbdde66fdb27bb65b58137f
    https://github.com/scummvm/scummvm/commit/9676eb21574d665b3dbdde66fdb27bb65b58137f
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Add debug commands to control ask table

Changed paths:
    engines/access/debugger.cpp
    engines/access/debugger.h


diff --git a/engines/access/debugger.cpp b/engines/access/debugger.cpp
index 34cf1276276..68aca430a9b 100644
--- a/engines/access/debugger.cpp
+++ b/engines/access/debugger.cpp
@@ -74,6 +74,8 @@ Debugger::Debugger(AccessEngine *vm) : GUI::Debugger(), _vm(vm) {
 	registerCmd("setflag", WRAP_METHOD(Debugger, Cmd_SetFlag));
 	registerCmd("gettravel", WRAP_METHOD(Debugger, Cmd_GetTravel));
 	registerCmd("settravel", WRAP_METHOD(Debugger, Cmd_SetTravel));
+	registerCmd("getask", WRAP_METHOD(Debugger, Cmd_GetAsk));
+	registerCmd("setask", WRAP_METHOD(Debugger, Cmd_SetAsk));
 }
 
 Debugger::~Debugger() {
@@ -237,6 +239,7 @@ bool Debugger::Cmd_GetTravel(int argc, const char **argv) {
 
 	const int ncols = ARRAYSIZE(_vm->_travel) / 10;
 	for (int row = 0; row < 10; ++row) {
+		debugPrintf("%2d: ", row * ncols);
 		for (int col = 0; col < ncols; ++col) {
 			debugPrintf("%d ", _vm->_travel[row * ncols + col]);
 		}
@@ -270,6 +273,45 @@ bool Debugger::Cmd_SetTravel(int argc, const char **argv) {
 	return true;
 }
 
+bool Debugger::Cmd_GetAsk(int argc, const char **argv) {
+	debugPrintf("Ask table:\n");
+
+	const int ncols = ARRAYSIZE(_vm->_ask) / 10;
+	for (int row = 0; row < 10; ++row) {
+		debugPrintf("%2d: ", row * ncols);
+		for (int col = 0; col < ncols; ++col) {
+			debugPrintf("%d ", _vm->_ask[row * ncols + col]);
+		}
+		debugPrintf("\n");
+	}
+
+	return true;
+}
+
+bool Debugger::Cmd_SetAsk(int argc, const char **argv) {
+	if (argc != 3) {
+		debugPrintf("Usage: %s <ask number> <ask value>\n", argv[0]);
+		debugPrintf("Sets the given ask table entry to the given value\n");
+		return true;
+	}
+
+	int num = strToInt(argv[1]);
+	if (num < 0 || num >= ARRAYSIZE(_vm->_ask)) {
+		debugPrintf("Invalid ask number\n");
+		return true;
+	}
+
+	int val = strToInt(argv[2]);
+	if (val < 0 || val >= 256) {
+		debugPrintf("Invalid ask val, must be byte\n");
+		return true;
+	}
+	_vm->_flags[num] = val;
+
+	debugPrintf("Ask %d set to %d\n", num, val);
+	return true;
+}
+
 
 /*------------------------------------------------------------------------*/
 
diff --git a/engines/access/debugger.h b/engines/access/debugger.h
index db1bdadf60c..3e8c2e911da 100644
--- a/engines/access/debugger.h
+++ b/engines/access/debugger.h
@@ -45,6 +45,8 @@ protected:
 	bool Cmd_SetFlag(int argc, const char **argv);
 	bool Cmd_GetTravel(int argc, const char **argv);
 	bool Cmd_SetTravel(int argc, const char **argv);
+	bool Cmd_GetAsk(int argc, const char **argv);
+	bool Cmd_SetAsk(int argc, const char **argv);
 
 public:
 	static Debugger *init(AccessEngine *vm);


Commit: 3ab11f9a4b5e2b7ca018baadbc026830910e5902
    https://github.com/scummvm/scummvm/commit/3ab11f9a4b5e2b7ca018baadbc026830910e5902
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Small cleanups

* Improve const correctness
* Use initializers instead of assignment in constructors

Changed paths:
    engines/access/access.cpp
    engines/access/access.h
    engines/access/animation.cpp
    engines/access/animation.h
    engines/access/asurface.cpp
    engines/access/char.cpp
    engines/access/data.h
    engines/access/events.h
    engines/access/font.cpp
    engines/access/font.h
    engines/access/inventory.cpp
    engines/access/inventory.h
    engines/access/screen.cpp
    engines/access/scripts.cpp


diff --git a/engines/access/access.cpp b/engines/access/access.cpp
index 32f333780c7..5456487c49b 100644
--- a/engines/access/access.cpp
+++ b/engines/access/access.cpp
@@ -373,7 +373,7 @@ void AccessEngine::plotList1() {
 
 		_imgUnscaled = (ie._flags & IMGFLAG_UNSCALED) != 0;
 		Common::Point pt = ie._position - _screen->_bufferStart;
-		SpriteResource *sprites = ie._spritesPtr;
+		const SpriteResource *sprites = ie._spritesPtr;
 		const SpriteFrame *frame = sprites->getFrame(ie._frameNumber);
 
 		Common::Rect bounds(pt.x, pt.y, pt.x + frame->w, pt.y + frame->h);
diff --git a/engines/access/access.h b/engines/access/access.h
index 7cef1a6c1d0..56e8fd3d913 100644
--- a/engines/access/access.h
+++ b/engines/access/access.h
@@ -189,7 +189,6 @@ public:
 	ASurface _buffer2;
 	ASurface _vidBuf;
 	int _vidX, _vidY;
-	Common::Array<CharEntry *> _charTable;
 	SpriteResource *_objectsTable[100];
 	bool _establishTable[100];
 	bool _establishFlag;
diff --git a/engines/access/animation.cpp b/engines/access/animation.cpp
index 74f71029197..92e62ddfac6 100644
--- a/engines/access/animation.cpp
+++ b/engines/access/animation.cpp
@@ -111,7 +111,7 @@ void Animation::anim0() {
 		} else {
 			_countdownTicks = _initialTicks;
 			++_frameNumber;
-			AnimationFrame *frame = calcFrame();
+			const AnimationFrame *frame = calcFrame();
 
 			if (frame == nullptr) {
 				_frameNumber = 0;
@@ -130,7 +130,7 @@ void Animation::anim1() {
 	} else {
 		_countdownTicks = _initialTicks;
 		++_frameNumber;
-		AnimationFrame *frame = calcFrame();
+		const AnimationFrame *frame = calcFrame();
 
 		if (frame == nullptr) {
 			--_frameNumber;
@@ -148,7 +148,7 @@ void Animation::anim2() {
 	} else {
 		_countdownTicks = _initialTicks;
 		++_frameNumber;
-		AnimationFrame *frame = calcFrame();
+		const AnimationFrame *frame = calcFrame();
 
 		if (frame == nullptr) {
 			_frameNumber = 0;
@@ -166,7 +166,7 @@ void Animation::anim3() {
 		} else {
 			_countdownTicks = _initialTicks;
 			++_frameNumber;
-			AnimationFrame *frame = calcFrame();
+			const AnimationFrame *frame = calcFrame();
 
 			if (frame == nullptr) {
 				--_currentLoopCount;
@@ -185,7 +185,7 @@ void Animation::anim4() {
 	} else {
 		_countdownTicks = _initialTicks;
 		++_frameNumber;
-		AnimationFrame *frame = calcFrame();
+		const AnimationFrame *frame = calcFrame();
 
 		if (frame == nullptr) {
 			if (--_currentLoopCount == -1) {
@@ -209,38 +209,38 @@ void Animation::anim7() {
 	setFrame(calcFrame1());
 }
 
-AnimationFrame *Animation::calcFrame() {
+const AnimationFrame *Animation::calcFrame() {
 	return (_frameNumber < (int)_frames.size()) ? _frames[_frameNumber] : nullptr;
 }
 
-AnimationFrame *Animation::calcFrame1() {
+const AnimationFrame *Animation::calcFrame1() {
 	return _frames[0];
 }
 
-void Animation::setFrame(AnimationFrame *frame) {
+void Animation::setFrame(const AnimationFrame *frame) {
 	assert(frame);
 	_countdownTicks += frame->_frameDelay;
 	setFrame1(frame);
 }
 
-void Animation::setFrame1(AnimationFrame *frame) {
+void Animation::setFrame1(const AnimationFrame *frame) {
 	_vm->_animation->_base.x = frame->_baseX;
 	_vm->_animation->_base.y = frame->_baseY;
 
 	// Loop to add image draw requests for the parts of the frame
-	for (const AnimationFramePart *part: frame->_parts) {
+	for (const AnimationFramePart &part: frame->_parts) {
 		ImageEntry ie;
 
 		// Set the flags
-		ie._flags = part->_flags & ~IMGFLAG_UNSCALED;
+		ie._flags = part._flags & ~IMGFLAG_UNSCALED;
 		if (_vm->_animation->_frameScale == -1)
 			ie._flags |= IMGFLAG_UNSCALED;
 
 		// Set the other fields
-		ie._spritesPtr = _vm->_objectsTable[part->_spritesIndex];
-		ie._frameNumber = part->_frameIndex;
-		ie._position = part->_position + _vm->_animation->_base;
-		ie._offsetY = part->_offsetY - ie._position.y;
+		ie._spritesPtr = _vm->_objectsTable[part._spritesIndex];
+		ie._frameNumber = part._frameIndex;
+		ie._position = part._position + _vm->_animation->_base;
+		ie._offsetY = part._offsetY - ie._position.y;
 
 		_vm->_images.addToList(ie);
 	}
@@ -260,7 +260,7 @@ AnimationFrame::AnimationFrame(Common::SeekableReadStream *stream, int startOffs
 	while (nextOffset != 0) {
 		stream->seek(startOffset + nextOffset);
 
-		AnimationFramePart *framePart = new AnimationFramePart(stream);
+		AnimationFramePart framePart(stream);
 		_parts.push_back(framePart);
 
 		nextOffset = stream->readUint16LE();
@@ -268,8 +268,6 @@ AnimationFrame::AnimationFrame(Common::SeekableReadStream *stream, int startOffs
 }
 
 AnimationFrame::~AnimationFrame() {
-	for (auto *part : _parts)
-		delete part;
 }
 
 /*------------------------------------------------------------------------*/
diff --git a/engines/access/animation.h b/engines/access/animation.h
index 22c6b36d67d..f0e3392fd3a 100644
--- a/engines/access/animation.h
+++ b/engines/access/animation.h
@@ -77,7 +77,7 @@ public:
 	AnimationResource(AccessEngine *vm, Resource *res);
 	~AnimationResource();
 
-	int getCount() { return _animations.size(); }
+	int getCount() const { return _animations.size(); }
 	Animation *getAnimation(int idx) { return _animations[idx]; }
 };
 
@@ -93,10 +93,10 @@ private:
 	void animNone();
 	void anim7();
 
-	AnimationFrame *calcFrame();
-	AnimationFrame *calcFrame1();
-	void setFrame(AnimationFrame *frame);
-	void setFrame1(AnimationFrame *frame);
+	const AnimationFrame *calcFrame();
+	const AnimationFrame *calcFrame1();
+	void setFrame(const AnimationFrame *frame);
+	void setFrame1(const AnimationFrame *frame);
 public:
 	int _type;
 	int _scaling;
@@ -116,7 +116,7 @@ class AnimationFrame {
 public:
 	int _baseX, _baseY;
 	int _frameDelay;
-	Common::Array<AnimationFramePart *> _parts;
+	Common::Array<AnimationFramePart> _parts;
 public:
 	AnimationFrame(Common::SeekableReadStream *stream, int startOffset);
 	~AnimationFrame();
diff --git a/engines/access/asurface.cpp b/engines/access/asurface.cpp
index 4c820a5c0bb..f01a5542a60 100644
--- a/engines/access/asurface.cpp
+++ b/engines/access/asurface.cpp
@@ -84,11 +84,7 @@ SpriteFrame::~SpriteFrame() {
 
 /*------------------------------------------------------------------------*/
 
-ImageEntry::ImageEntry() {
-	_frameNumber = 0;
-	_spritesPtr = nullptr;
-	_offsetY = 0;
-	_flags = 0;
+ImageEntry::ImageEntry() : _frameNumber(0), _spritesPtr(nullptr), _offsetY(0), _flags(0) {
 }
 
 /*------------------------------------------------------------------------*/
@@ -114,13 +110,10 @@ int BaseSurface::_lastBoundsY;
 int BaseSurface::_lastBoundsW;
 int BaseSurface::_lastBoundsH;
 
-
 BaseSurface::BaseSurface(): Graphics::Screen(0, 0) {
 	free();		// Free the 0x0 surface allocated by Graphics::Screen
 	_leftSkip = _rightSkip = 0;
 	_topSkip = _bottomSkip = 0;
-	_lastBoundsX = _lastBoundsY = 0;
-	_lastBoundsW = _lastBoundsH = 0;
 	_orgX1 = _orgY1 = 0;
 	_orgX2 = _orgY2 = 0;
 	_lColor = 0;
diff --git a/engines/access/char.cpp b/engines/access/char.cpp
index affd39ccbb4..c5d4498dc4d 100644
--- a/engines/access/char.cpp
+++ b/engines/access/char.cpp
@@ -68,10 +68,7 @@ CharEntry::CharEntry(const byte *data, AccessEngine *vm) {
 	}
 }
 
-CharEntry::CharEntry() {
-	_charFlag = 0;
-	_estabIndex = 0;
-	_startColor = _numColors = 0;
+CharEntry::CharEntry() : _charFlag(0), _estabIndex(0), _startColor(0), _numColors(0) {
 }
 
 /*------------------------------------------------------------------------*/
diff --git a/engines/access/data.h b/engines/access/data.h
index 23cc6f02950..a2b56a9445b 100644
--- a/engines/access/data.h
+++ b/engines/access/data.h
@@ -46,10 +46,7 @@ struct TimerEntry {
 	int _timer;
 	byte _flag;
 
-	TimerEntry() {
-		_initTm = _timer = 0;
-		_flag = 0;
-	}
+	TimerEntry() : _flag(0), _initTm(0), _timer(0) { }
 };
 
 class TimerList : public Common::Array<TimerEntry> {
diff --git a/engines/access/events.h b/engines/access/events.h
index fca94bdb8dc..f02a1773dbe 100644
--- a/engines/access/events.h
+++ b/engines/access/events.h
@@ -81,7 +81,7 @@ public:
 	/**
 	 * Return frame counter
 	 */
-	uint32 getFrameCounter() { return _frameCounter; }
+	uint32 getFrameCounter() const { return _frameCounter; }
 
 	/**
 	 * Sets the cursor and reset the normal cursor
@@ -141,7 +141,7 @@ public:
 
 	void waitKeyActionMouse();
 
-	Common::Point &getMousePos() { return _mousePos; }
+	const Common::Point &getMousePos() const { return _mousePos; }
 
 	Common::Point calcRawMouse();
 
diff --git a/engines/access/font.cpp b/engines/access/font.cpp
index 78ad580ac47..5d09c9a19cd 100644
--- a/engines/access/font.cpp
+++ b/engines/access/font.cpp
@@ -33,14 +33,14 @@ Font::~Font() {
 		fontChar.free();
 }
 
-int Font::charWidth(char c) {
+int Font::charWidth(char c) const {
 	if (c < _firstCharIndex)
 		return 0;
 
 	return _chars[c - _firstCharIndex].w;
 }
 
-int Font::stringWidth(const Common::String &msg) {
+int Font::stringWidth(const Common::String &msg) const {
 	int total = 0;
 
 	for (const char *c = msg.c_str(); *c != '\0'; ++c)
@@ -50,7 +50,7 @@ int Font::stringWidth(const Common::String &msg) {
 }
 
 bool Font::getLine(Common::String &s, int maxWidth, Common::String &line, int &width,
-				   LINE_WIDTH_TYPE widthType) {
+				   LINE_WIDTH_TYPE widthType) const {
 	assert(maxWidth > 0);
 	width = 0;
 	const char *src = s.c_str();
@@ -98,7 +98,7 @@ bool Font::getLine(Common::String &s, int maxWidth, Common::String &line, int &w
 	return true;
 }
 
-void Font::drawString(BaseSurface *s, const Common::String &msg, const Common::Point &pt) {
+void Font::drawString(BaseSurface *s, const Common::String &msg, const Common::Point &pt) const {
 	Common::Point currPt = pt;
 	const char *msgP = msg.c_str();
 
@@ -108,13 +108,13 @@ void Font::drawString(BaseSurface *s, const Common::String &msg, const Common::P
 	}
 }
 
-int Font::drawChar(BaseSurface *s, char c, Common::Point &pt) {
-	Graphics::Surface &ch = _chars[c - _firstCharIndex];
+int Font::drawChar(BaseSurface *s, char c, Common::Point &pt) const {
+	const Graphics::Surface &ch = _chars[c - _firstCharIndex];
 	Graphics::Surface dest = s->getSubArea(Common::Rect(pt.x, pt.y, pt.x + ch.w, pt.y + ch.h));
 
 	// Loop through the lines of the character
 	for (int y = 0; y < ch.h; ++y) {
-		byte *pSrc = (byte *)ch.getBasePtr(0, y);
+		const byte *pSrc = (const byte *)ch.getBasePtr(0, y);
 		byte *pDest = (byte *)dest.getBasePtr(0, y);
 
 		// Loop through the horizontal pixels of the line
diff --git a/engines/access/font.h b/engines/access/font.h
index 79e4f1c765f..f94a740c0cb 100644
--- a/engines/access/font.h
+++ b/engines/access/font.h
@@ -59,12 +59,12 @@ public:
 	/**
 	 * Get the width of a given character
 	 */
-	int charWidth(char c);
+	int charWidth(char c) const;
 
 	/**
 	 * Get the width of a given string
 	 */
-	int stringWidth(const Common::String &msg);
+	int stringWidth(const Common::String &msg) const;
 
 	/**
 	 * Type of line wrapping - Martian wraps based on chars, Amazon based on px.
@@ -87,17 +87,17 @@ public:
 	 * @returns			True if last line
 	 */
 	bool getLine(Common::String &s, int maxWidth, Common::String &line, int &width,
-				 LINE_WIDTH_TYPE widthType = kWidthInPixels);
+				 LINE_WIDTH_TYPE widthType = kWidthInPixels) const;
 
 	/**
 	 * Draw a string on a given surface
 	 */
-	void drawString(BaseSurface *s, const Common::String &msg, const Common::Point &pt);
+	void drawString(BaseSurface *s, const Common::String &msg, const Common::Point &pt) const;
 
 	/**
 	 * Draw a character on a given surface
 	 */
-	int drawChar(BaseSurface *s, char c, Common::Point &pt);
+	int drawChar(BaseSurface *s, char c, Common::Point &pt) const;
 
 };
 
diff --git a/engines/access/inventory.cpp b/engines/access/inventory.cpp
index 7ae18dcdeb2..bd9bc7ad2b0 100644
--- a/engines/access/inventory.cpp
+++ b/engines/access/inventory.cpp
@@ -43,7 +43,7 @@ void InventoryEntry::load(const Common::String &name, const int *data) {
 	}
 }
 
-int InventoryEntry::checkItem(int itemId) {
+int InventoryEntry::checkItem(int itemId) const {
 	if (_otherItem1 == itemId)
 		return _newItem1;
 	else if (_otherItem2 == itemId)
@@ -378,7 +378,7 @@ void InventoryManager::freeInvCells() {
 	_vm->_objectsTable[99] = nullptr;
 }
 
-int InventoryManager::coordIndexOf() {
+int InventoryManager::coordIndexOf() const {
 	const Common::Point pt = _vm->_events->_mousePos;
 
 	for (int i = 0; i < (int)_invCoords.size(); ++i) {
diff --git a/engines/access/inventory.h b/engines/access/inventory.h
index 2e7fd834f87..d62e8c0c1f1 100644
--- a/engines/access/inventory.h
+++ b/engines/access/inventory.h
@@ -47,7 +47,7 @@ public:
 
 	void load(const Common::String &name, const int *data);
 
-	int checkItem(int itemId);
+	int checkItem(int itemId) const;
 };
 
 class InventoryManager : public Manager {
@@ -98,7 +98,7 @@ private:
 
 	void freeInvCells();
 
-	int coordIndexOf();
+	int coordIndexOf() const;
 
 	void saveScreens();
 
diff --git a/engines/access/screen.cpp b/engines/access/screen.cpp
index f2945b78b51..653d80c85d2 100644
--- a/engines/access/screen.cpp
+++ b/engines/access/screen.cpp
@@ -44,11 +44,7 @@
 
 namespace Access {
 
-ScreenSave::ScreenSave(){
-	_clipWidth = _clipHeight = 0;
-	_windowXAdd = _windowYAdd = 0;
-	_scrollCol = _scrollRow = 0;
-	_screenYOff = 0;
+ScreenSave::ScreenSave() : _clipWidth(0), _clipHeight(0), _windowXAdd(0), _windowYAdd(0), _scrollCol(0), _scrollRow(0), _screenYOff(0) {
 }
 
 Screen::Screen(AccessEngine *vm) : _vm(vm) {
diff --git a/engines/access/scripts.cpp b/engines/access/scripts.cpp
index daab719c387..3aa9541e518 100644
--- a/engines/access/scripts.cpp
+++ b/engines/access/scripts.cpp
@@ -629,6 +629,10 @@ void Scripts::cmdDispInv_v2() {
 void Scripts::cmdSetAbout() {
 	int idx = _data->readByte();
 	byte val = _data->readByte();
+
+	if (idx < 0 || idx >= ARRAYSIZE(_vm->_ask))
+		error("Invalid index %d in cmdSetAbout", idx);
+
 	debugC(1, kDebugScripts, "cmdSetAbout(idx=%d, val=%d)", idx, val);
 	_vm->_ask[idx] = val;
 	_vm->_startAboutBox = _vm->_startAboutItem = 0;
@@ -868,6 +872,10 @@ void Scripts::cmdCheckAbout() {
 	int idx = _data->readSint16LE();
 	int16 val = _data->readSint16LE();
 	debugCN(1, kDebugScripts, "cmdCheckAbout(idx=%d, val=%d)", idx, val);
+
+	if (idx < 0 || idx >= ARRAYSIZE(_vm->_ask))
+		error("Invalid index %d in cmdCheckAbout", idx);
+
 	if ((byte)_vm->_ask[idx] == (byte)val) {
 		debugC(1, kDebugScripts, " -> True");
 		cmdGoto();


Commit: a1510567a90b3e5adf6d57d22e13073cfe8d79d7
    https://github.com/scummvm/scummvm/commit/a1510567a90b3e5adf6d57d22e13073cfe8d79d7
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Fix 'ask about' box lists

Changed paths:
    engines/access/scripts.cpp


diff --git a/engines/access/scripts.cpp b/engines/access/scripts.cpp
index 3aa9541e518..fe7a808e967 100644
--- a/engines/access/scripts.cpp
+++ b/engines/access/scripts.cpp
@@ -1157,7 +1157,7 @@ void Scripts::cmdPrintWatch() {
 
 void Scripts::cmdDispAbout() {
 	debugC(1, kDebugScripts, "cmdDispAbout()");
-	_vm->_travelBox->getList(Martian::ASK_TBL, _vm->_ask);
+	_vm->_aboutBox->getList(Martian::ASK_TBL, _vm->_ask);
 	int btnSelected = 0;
 	int boxX = _vm->_aboutBox->doBox_v1(_vm->_startAboutItem, _vm->_startAboutBox, btnSelected);
 	_vm->_startAboutItem = _vm->_boxDataStart;
@@ -1167,7 +1167,7 @@ void Scripts::cmdDispAbout() {
 	if (btnSelected == 2)
 		_vm->_useItem = -1;
 	else
-		_vm->_useItem = _vm->_travelBox->_tempListIdx[boxX];
+		_vm->_useItem = _vm->_aboutBox->_tempListIdx[boxX];
 }
 
 void Scripts::cmdPushLocation() {


Commit: c2f5731c382211abb426c1f61b733e5c6438edd1
    https://github.com/scummvm/scummvm/commit/c2f5731c382211abb426c1f61b733e5c6438edd1
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Fix pushLocation opcode for MM

Not sure if the current one is actually right for Amazon either, but leaving it
as-is for now.

Changed paths:
    engines/access/scripts.cpp
    engines/access/scripts.h


diff --git a/engines/access/scripts.cpp b/engines/access/scripts.cpp
index fe7a808e967..d33086adf45 100644
--- a/engines/access/scripts.cpp
+++ b/engines/access/scripts.cpp
@@ -112,7 +112,7 @@ void Scripts::setOpcodes() {
 	COMMAND_LIST[62] = &Scripts::cmdPlayVideoSound;
 	COMMAND_LIST[63] = &Scripts::cmdPrintWatch;
 	COMMAND_LIST[64] = &Scripts::cmdDispAbout;
-	COMMAND_LIST[65] = &Scripts::cmdPushLocation;
+	COMMAND_LIST[65] = &Scripts::cmdPushLocation_v1;
 	COMMAND_LIST[66] = &Scripts::cmdCheckTravel;
 	COMMAND_LIST[67] = &Scripts::cmdBlock;
 	COMMAND_LIST[68] = &Scripts::cmdPlayerOff;
@@ -132,7 +132,7 @@ void Scripts::setOpcodes_v2() {
 	COMMAND_LIST[32] = &Scripts::cmdJumpGoto;
 	COMMAND_LIST[40] = &Scripts::cmdVideoEnded;
 	COMMAND_LIST[45] = COMMAND_LIST[46] = &Scripts::cmdSpecial;
-	COMMAND_LIST[63] = COMMAND_LIST[64] = COMMAND_LIST[66] = COMMAND_LIST[67] = &Scripts::cmdPushLocation;
+	COMMAND_LIST[63] = COMMAND_LIST[64] = COMMAND_LIST[65] = COMMAND_LIST[66] = COMMAND_LIST[67] = &Scripts::cmdPushLocation;
 }
 
 void Scripts::setScript(Resource *res, bool restartFlag) {
@@ -1170,7 +1170,16 @@ void Scripts::cmdDispAbout() {
 		_vm->_useItem = _vm->_aboutBox->_tempListIdx[boxX];
 }
 
+void Scripts::cmdPushLocation_v1() {
+	// MM only
+	debugC(1, kDebugScripts, "cmdPushLocation_v1()");
+	_choiceStart = _data->pos() + 2;
+	cmdGoto();
+}
+
 void Scripts::cmdPushLocation() {
+	// TODO: Double-check this code.  It doesn't seem to match function
+	//   sub13BC0 in Amazon?
 	debugC(1, kDebugScripts, "cmdPushLocation()");
 	_choiceStart = _data->pos() - 1;
 }
diff --git a/engines/access/scripts.h b/engines/access/scripts.h
index bd5174a17a9..5752985629e 100644
--- a/engines/access/scripts.h
+++ b/engines/access/scripts.h
@@ -127,6 +127,7 @@ protected:
 	void cmdPrintWatch();
 	void cmdDispAbout();
 	void cmdPushLocation();
+	void cmdPushLocation_v1();
 	void cmdCheckTravel();
 	void cmdBlock();
 	void cmdPlayerOff();


Commit: 612bf79f37b4e8000a7a4f193d41731f4a0fe426
    https://github.com/scummvm/scummvm/commit/612bf79f37b4e8000a7a4f193d41731f4a0fe426
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Fix MM select box with many items

Changed paths:
    engines/access/bubble_box.cpp


diff --git a/engines/access/bubble_box.cpp b/engines/access/bubble_box.cpp
index a7891c6f587..375d5b1738c 100644
--- a/engines/access/bubble_box.cpp
+++ b/engines/access/bubble_box.cpp
@@ -670,7 +670,7 @@ int BubbleBox::doBox_v1(int item, int box, int &btnSelected) {
 	_vm->_boxSelectYOld = -1;
 	_vm->_boxSelectY = _startBox;
 
-	_vm->_numLines = (_bounds.bottom >> 3) - 2;
+	_vm->_numLines = (_bounds.height() / 8) - 2;
 	if (_type == TYPE_3)
 		--_vm->_numLines;
 


Commit: 0ab83c339b88d0085b8eec7e4c4ea78718f21639
    https://github.com/scummvm/scummvm/commit/0ab83c339b88d0085b8eec7e4c4ea78718f21639
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Improve and simplify debugger commands

Changed paths:
    engines/access/debugger.cpp
    engines/access/debugger.h


diff --git a/engines/access/debugger.cpp b/engines/access/debugger.cpp
index 68aca430a9b..fea9cb0bd23 100644
--- a/engines/access/debugger.cpp
+++ b/engines/access/debugger.cpp
@@ -70,12 +70,11 @@ Debugger::Debugger(AccessEngine *vm) : GUI::Debugger(), _vm(vm) {
 	registerCmd("playmovie", WRAP_METHOD(Debugger, Cmd_PlayMovie));
 	registerCmd("dumpscript", WRAP_METHOD(Debugger, Cmd_DumpScript));
 	registerCmd("timers", WRAP_METHOD(Debugger, Cmd_Timers));
-	registerCmd("getflag", WRAP_METHOD(Debugger, Cmd_GetFlag));
-	registerCmd("setflag", WRAP_METHOD(Debugger, Cmd_SetFlag));
-	registerCmd("gettravel", WRAP_METHOD(Debugger, Cmd_GetTravel));
-	registerCmd("settravel", WRAP_METHOD(Debugger, Cmd_SetTravel));
-	registerCmd("getask", WRAP_METHOD(Debugger, Cmd_GetAsk));
-	registerCmd("setask", WRAP_METHOD(Debugger, Cmd_SetAsk));
+	registerCmd("flag", WRAP_METHOD(Debugger, Cmd_Flag));
+	registerCmd("travel", WRAP_METHOD(Debugger, Cmd_Travel));
+	registerCmd("ask", WRAP_METHOD(Debugger, Cmd_Ask));
+	registerCmd("inventory", WRAP_METHOD(Debugger, Cmd_Inventory));
+	registerCmd("everything", WRAP_METHOD(Debugger, Cmd_Everything));
 }
 
 Debugger::~Debugger() {
@@ -122,7 +121,7 @@ bool Debugger::Cmd_LoadScene(int argc, const char **argv) {
 bool Debugger::Cmd_Cheat(int argc, const char **argv) {
 	if (argc != 1) {
 		debugPrintf("Usage: %s\n", argv[0]);
-		debugPrintf("Switches on/off the cheat mode\n");
+		debugPrintf("Switches on/off the cheat mode (skips Amazon guard on boat)\n");
 		return true;
 	}
 
@@ -177,27 +176,21 @@ bool Debugger::Cmd_DumpScript(int argc, const char **argv) {
 	return true;
 }
 
-bool Debugger::Cmd_GetFlag(int argc, const char **argv) {
-	if (argc != 2) {
-		debugPrintf("Usage: %s <flag number>\n", argv[0]);
-		debugPrintf("Prints the value of the given flag\n");
+bool Debugger::Cmd_Flag(int argc, const char **argv) {
+	if (argc != 2 && argc != 3) {
+		debugPrintf("Usage: %s <flag number> [<flag value>]\n", argv[0]);
+		debugPrintf("Prints or sets the value of the given flag\n");
 		return true;
 	}
 
-	int flagNum = strToInt(argv[1]);
-	if (flagNum < 0 || flagNum >= 256) {
-		debugPrintf("Invalid flag number\n");
-		return true;
-	}
-
-	debugPrintf("Flag %d: %d\n", flagNum, _vm->_flags[flagNum]);
-	return true;
-}
+	if (argc == 2) {
+		int flagNum = strToInt(argv[1]);
+		if (flagNum < 0 || flagNum >= 256) {
+			debugPrintf("Invalid flag number\n");
+			return true;
+		}
 
-bool Debugger::Cmd_SetFlag(int argc, const char **argv) {
-	if (argc != 3) {
-		debugPrintf("Usage: %s <flag number> <flag value>\n", argv[0]);
-		debugPrintf("Sets the given flag to the given value\n");
+		debugPrintf("Flag %d: %d\n", flagNum, _vm->_flags[flagNum]);
 		return true;
 	}
 
@@ -234,25 +227,22 @@ bool Debugger::Cmd_Timers(int argc, const char **argv) {
 	return true;
 }
 
-bool Debugger::Cmd_GetTravel(int argc, const char **argv) {
-	debugPrintf("Travel table:\n");
-
-	const int ncols = ARRAYSIZE(_vm->_travel) / 10;
-	for (int row = 0; row < 10; ++row) {
-		debugPrintf("%2d: ", row * ncols);
-		for (int col = 0; col < ncols; ++col) {
-			debugPrintf("%d ", _vm->_travel[row * ncols + col]);
-		}
-		debugPrintf("\n");
+bool Debugger::Cmd_Travel(int argc, const char **argv) {
+	if (argc != 1 && argc != 3) {
+		debugPrintf("Usage: %s [<travel number> <travel value>]\n", argv[0]);
+		debugPrintf("Dump the travel table, or set a travel table entry to the given value\n");
+		return true;
 	}
 
-	return true;
-}
+	if (argc == 1) {
+		debugPrintf("Travel table:\n");
+
+		for (int i = 0; i < ARRAYSIZE(_vm->_travel); ++i) {
+			if (!Martian::TRAVDATA[i])
+				break;
+			debugPrintf("%2d: %d (%s)\n", i, _vm->_travel[i], Martian::TRAVDATA[i]);
+		}
 
-bool Debugger::Cmd_SetTravel(int argc, const char **argv) {
-	if (argc != 3) {
-		debugPrintf("Usage: %s <travel number> <travel value>\n", argv[0]);
-		debugPrintf("Sets the given travel table entry to the given value\n");
 		return true;
 	}
 
@@ -273,25 +263,22 @@ bool Debugger::Cmd_SetTravel(int argc, const char **argv) {
 	return true;
 }
 
-bool Debugger::Cmd_GetAsk(int argc, const char **argv) {
-	debugPrintf("Ask table:\n");
-
-	const int ncols = ARRAYSIZE(_vm->_ask) / 10;
-	for (int row = 0; row < 10; ++row) {
-		debugPrintf("%2d: ", row * ncols);
-		for (int col = 0; col < ncols; ++col) {
-			debugPrintf("%d ", _vm->_ask[row * ncols + col]);
-		}
-		debugPrintf("\n");
+bool Debugger::Cmd_Ask(int argc, const char **argv) {
+	if (argc != 1 && argc != 3) {
+		debugPrintf("Usage: %s [<ask number> <ask value>]\n", argv[0]);
+		debugPrintf("Dump the ask table, or set an ask table entry to the given value\n");
+		return true;
 	}
 
-	return true;
-}
+	if (argc == 1) {
+		debugPrintf("Ask table:\n");
+
+		for (int i = 0; i < ARRAYSIZE(_vm->_ask); ++i) {
+			if (!Martian::ASK_TBL[i])
+				break;
+			debugPrintf("%2d: %d (%s)\n", i, _vm->_ask[i], Martian::ASK_TBL[i]);
+		}
 
-bool Debugger::Cmd_SetAsk(int argc, const char **argv) {
-	if (argc != 3) {
-		debugPrintf("Usage: %s <ask number> <ask value>\n", argv[0]);
-		debugPrintf("Sets the given ask table entry to the given value\n");
 		return true;
 	}
 
@@ -312,6 +299,72 @@ bool Debugger::Cmd_SetAsk(int argc, const char **argv) {
 	return true;
 }
 
+bool Debugger::Cmd_Inventory(int argc, const char **argv) {
+	if (argc != 1 && argc != 3) {
+		debugPrintf("Usage: %s [<inv number> <state value>]\n", argv[0]);
+		debugPrintf("Dump the list of inventory items and their state, or set the state of an item\n");
+		return true;
+	}
+
+	static const char* STATE_NAMES[] = {
+		"0 - Not Found",
+		"1 - In Inv   ",
+		"2 - Used	 ",
+	};
+
+	if (argc == 1) {
+		debugPrintf("Inventory items:\n");
+
+		for (int i = 0; i < (int)_vm->_inventory->_inv.size(); ++i) {
+			const InventoryEntry &entry = _vm->_inventory->_inv[i];
+			debugPrintf("%2d: %s  %s\n", i, STATE_NAMES[entry._value], entry._name.c_str());
+		}
+		return true;
+	}
+
+	int num = strToInt(argv[1]);
+	if (num < 0 || num >= (int)_vm->_inventory->_inv.size()) {
+		debugPrintf("Invalid inv number\n");
+		return true;
+	}
+
+	int val = strToInt(argv[2]);
+	if (val < 0 || val > 2) {
+		debugPrintf("Invalid inv state val, must be 0/1/2\n");
+		return true;
+	}
+	_vm->_inventory->_inv[num]._value = val;
+
+	debugPrintf("Set item %d to %d\n", num, val);
+	return true;
+}
+
+bool Debugger::Cmd_Everything(int argc, const char **argv) {
+	if (argc != 2 || strcmp(argv[1], "please") != 0) {
+		debugPrintf("Usage: %s please\n", argv[0]);
+		debugPrintf("Gives you all items, travel locations, and ask subjects.\n");
+		debugPrintf("Cannot be undone and may break your game, so you have to confirm with 'please'.\n");
+		return true;
+	}
+
+	for (uint i = 0; i < _vm->_res->INVENTORY.size(); ++i)
+		_vm->_inventory->_inv[i]._value = ITEM_IN_INVENTORY;
+
+	for (uint i = 0; i < ARRAYSIZE(_vm->_travel); ++i)
+		_vm->_travel[i] = 1;
+
+	// Turn off some known-broken locations
+	_vm->_travel[12] = 0; // "LOVE SCENE"
+
+	for (uint i = 0; i < ARRAYSIZE(_vm->_ask); ++i)
+		_vm->_ask[i] = 1;
+
+	debugPrintf("You now have everything, can go anywhere, and can ask anything.\n");
+
+	return true;
+}
+
+
 
 /*------------------------------------------------------------------------*/
 
diff --git a/engines/access/debugger.h b/engines/access/debugger.h
index 3e8c2e911da..d2f17027853 100644
--- a/engines/access/debugger.h
+++ b/engines/access/debugger.h
@@ -41,12 +41,11 @@ protected:
 	bool Cmd_PlayMovie(int argc, const char **argv);
 	bool Cmd_DumpScript(int argc, const char **argv);
 	bool Cmd_Timers(int argc, const char **argv);
-	bool Cmd_GetFlag(int argc, const char **argv);
-	bool Cmd_SetFlag(int argc, const char **argv);
-	bool Cmd_GetTravel(int argc, const char **argv);
-	bool Cmd_SetTravel(int argc, const char **argv);
-	bool Cmd_GetAsk(int argc, const char **argv);
-	bool Cmd_SetAsk(int argc, const char **argv);
+	bool Cmd_Flag(int argc, const char **argv);
+	bool Cmd_Travel(int argc, const char **argv);
+	bool Cmd_Ask(int argc, const char **argv);
+	bool Cmd_Inventory(int argc, const char **argv);
+	bool Cmd_Everything(int argc, const char **argv);
 
 public:
 	static Debugger *init(AccessEngine *vm);


Commit: 45c22b117041ef962be6ff99a46413c455b12aaa
    https://github.com/scummvm/scummvm/commit/45c22b117041ef962be6ff99a46413c455b12aaa
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Remove redundant variable for MM

The picture taken count should be a game variable, not a separate global.

Changed paths:
    engines/access/access.cpp
    engines/access/access.h
    engines/access/martian/martian_game.cpp


diff --git a/engines/access/access.cpp b/engines/access/access.cpp
index 5456487c49b..be9659f9a32 100644
--- a/engines/access/access.cpp
+++ b/engines/access/access.cpp
@@ -33,7 +33,7 @@ namespace Access {
 
 AccessEngine::AccessEngine(OSystem *syst, const AccessGameDescription *gameDesc)
 	: _gameDescription(gameDesc), Engine(syst), _randomSource("Access"),
-	  _useItem(_flags[99]), _startup(_flags[170]), _manScaleOff(_flags[172]) {
+	  _useItem(_flags[99]), _startup(_flags[170]), _manScaleOff(_flags[172]), _pictureTaken(_flags[176]) {
 	// Set up debug channels
 
 	_aboutBox = nullptr;
diff --git a/engines/access/access.h b/engines/access/access.h
index 56e8fd3d913..4d27e5ff97f 100644
--- a/engines/access/access.h
+++ b/engines/access/access.h
@@ -251,8 +251,6 @@ public:
 	byte _byte26CB5;
 	int _bcnt;
 	//byte *_tempList;
-	int16 _pictureTaken;
-	//
 
 	bool _vidEnd;
 	bool _clearSummaryFlag;
@@ -262,6 +260,7 @@ public:
 	int &_useItem;
 	int &_startup;
 	int &_manScaleOff;
+	int &_pictureTaken;
 
 public:
 	AccessEngine(OSystem *syst, const AccessGameDescription *gameDesc);
diff --git a/engines/access/martian/martian_game.cpp b/engines/access/martian/martian_game.cpp
index 583c7eb71a0..bb50b26122e 100644
--- a/engines/access/martian/martian_game.cpp
+++ b/engines/access/martian/martian_game.cpp
@@ -392,8 +392,6 @@ void MartianEngine::synchronize(Common::Serializer &s) {
 		s.syncAsByte(_ask[i]);
 	}
 
-	s.syncAsSint16LE(_pictureTaken);
-
 	/*
 	TODO: Do any of these need to be synchronized here?
 	Mostly involved in modal dialogs.


Commit: d9db7e25c414283b7c1a41b9c2cb864667530786
    https://github.com/scummvm/scummvm/commit/d9db7e25c414283b7c1a41b9c2cb864667530786
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Fix photo taking in MM

Changed paths:
    engines/access/room.cpp


diff --git a/engines/access/room.cpp b/engines/access/room.cpp
index 983eafcf000..6bcd2c55f76 100644
--- a/engines/access/room.cpp
+++ b/engines/access/room.cpp
@@ -108,13 +108,13 @@ void Room::takePicture() {
 			return;
 		}
 
-		if ((_vm->_scrollCol < 35) || (_vm->_scrollRow >= 20)){
+		if ((_vm->_scrollCol < 35) || (_vm->_scrollRow >= 20)) {
 			Common::String msg = "THAT ISN'T INTERESTING ENOUGH TO WASTE FILM ON.";
 			_vm->_scripts->doCmdPrint_v1(msg);
 			return;
 		}
 
-		if (_vm->_inventory->_inv[26]._value != ITEM_USED) {
+		if (_vm->_flags[26] != 2) {
 			Common::String msg = "ALTHOUGH IT WOULD MAKE A NICE PICTURE, YOU MAY FIND SOMETHING MORE INTERESTING TO USE YOUR FILM ON.";
 			_vm->_scripts->doCmdPrint_v1(msg);
 			return;
@@ -122,7 +122,7 @@ void Room::takePicture() {
 
 		Common::String msg = "THAT PHOTO MAY COME IN HANDY SOME DAY.";
 		_vm->_scripts->doCmdPrint_v1(msg);
-		_vm->_inventory->_inv[8]._value = ITEM_IN_INVENTORY;
+		_vm->_flags[8] = 1;
 		_vm->_pictureTaken++;
 		if (_vm->_pictureTaken == 16)
 			_vm->_inventory->_inv[44]._value = ITEM_USED;


Commit: c4590d660ea8785e4a819b76af3469e98bd4538b
    https://github.com/scummvm/scummvm/commit/c4590d660ea8785e4a819b76af3469e98bd4538b
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Fix MM can't travel dialog

Changed paths:
    engines/access/martian/martian_resources.cpp
    engines/access/scripts.cpp


diff --git a/engines/access/martian/martian_resources.cpp b/engines/access/martian/martian_resources.cpp
index ee50c564d74..5e1387539c2 100644
--- a/engines/access/martian/martian_resources.cpp
+++ b/engines/access/martian/martian_resources.cpp
@@ -397,6 +397,8 @@ void MartianResources::load(Common::SeekableReadStream &s) {
 	_font1 = new MartianFont(6, ARRAYSIZE(FONT1_WIDTHS), FONT1_WIDTHS, FONT1_OFFSETS, FONT1_DATA);
 	_font2 = new MartianFont(6, ARRAYSIZE(FONT2_WIDTHS), FONT2_WIDTHS, FONT2_OFFSETS, FONT2_DATA);
 	_bitFont = new MartianBitFont(ARRAYSIZE(BITFONT_DATA) / 8, BITFONT_DATA);
+
+	CANT_GET_THERE = "YOU CAN'T GET THERE FROM HERE.";
 }
 
 const byte *MartianResources::getCursor(int num) const {
diff --git a/engines/access/scripts.cpp b/engines/access/scripts.cpp
index d33086adf45..e5a7a4242fa 100644
--- a/engines/access/scripts.cpp
+++ b/engines/access/scripts.cpp
@@ -812,8 +812,8 @@ void Scripts::cmdDoTravel() {
 		if (btnSelected != 2) {
 			int newRoomNum = _vm->_travelBox->_tempListIdx[boxX];
 			if (Martian::CAN_TRAVEL_MATRIX[newRoomNum] != _vm->_flags[171]) {
-				_vm->_bubbleBox->_bubbleTitle = "TRAVEL";
-				_vm->_bubbleBox->printString(_vm->_res->CANT_GET_THERE);
+				_vm->_bubbleBox->_bubbleDisplStr = "TRAVEL";
+				doCmdPrint_v1(_vm->_res->CANT_GET_THERE);
 				continue;
 			}
 			if (_vm->_player->_roomNumber != newRoomNum) {


Commit: a2752515ab5c94183a207a42d56372ade1608d99
    https://github.com/scummvm/scummvm/commit/a2752515ab5c94183a207a42d56372ade1608d99
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Allow mouse wheel to scroll long dialogs

Changed paths:
    engines/access/bubble_box.cpp


diff --git a/engines/access/bubble_box.cpp b/engines/access/bubble_box.cpp
index 375d5b1738c..445aafa5c5b 100644
--- a/engines/access/bubble_box.cpp
+++ b/engines/access/bubble_box.cpp
@@ -51,12 +51,7 @@ BubbleBox::BubbleBox(AccessEngine *vm, Access::BoxType type, int x, int y, int w
 }
 
 void BubbleBox::load(Common::SeekableReadStream *stream) {
-	_bubbleTitle.clear();
-
-	byte v;
-	while ((v = stream->readByte()) != 0)
-		_bubbleTitle += (char)v;
-
+	_bubbleTitle = stream->readString();
 	_bubbleDisplStr = _bubbleTitle;
 }
 
@@ -680,12 +675,16 @@ int BubbleBox::doBox_v1(int item, int box, int &btnSelected) {
 
 	while (!_vm->shouldQuit()) {
 		_vm->_events->pollEvents();
-		if (!_vm->_events->_leftButton)
+		if (!_vm->_events->_leftButton && !_vm->_events->_wheelDown && !_vm->_events->_wheelUp)
 			continue;
 
+		//
+		// Slight enhancement from original - also allow mouse wheel events to scroll up/down.
+		//
+
 		if (((_type == TYPE_1) || (_type == TYPE_3)) && (_vm->_timers[2]._flag == 0)) {
 			++_vm->_timers[2]._flag;
-			if (_btnUpPos.contains(_vm->_events->_mousePos)) {
+			if (_btnUpPos.contains(_vm->_events->_mousePos) || _vm->_events->_wheelUp) {
 				if (_vm->_bcnt) {
 					if (_vm->_boxSelectY != 0) {
 						--_vm->_boxSelectY;
@@ -697,7 +696,7 @@ int BubbleBox::doBox_v1(int item, int box, int &btnSelected) {
 					}
 				}
 				continue;
-			} else if (_btnDownPos.contains(_vm->_events->_mousePos)) {
+			} else if (_btnDownPos.contains(_vm->_events->_mousePos) || _vm->_events->_wheelDown) {
 				if (_vm->_bcnt) {
 					if (_vm->_bcnt == _vm->_numLines) {
 						if (_vm->_bcnt != _vm->_boxSelectY + 1) {
@@ -717,6 +716,9 @@ int BubbleBox::doBox_v1(int item, int box, int &btnSelected) {
 			}
 		}
 
+		if (!_vm->_events->_leftButton)
+			continue;
+
 		if ((_vm->_events->_mousePos.x >= _boxStartX) && (_vm->_events->_mousePos.x <= _boxEndX)
 		&&  (_vm->_events->_mousePos.y >= _boxStartY) && (_vm->_events->_mousePos.y <= _boxEndY)) {
 			int val = (_vm->_events->_mousePos.y >> 3) - _boxPStartY;


Commit: beced1886d8cde40bcf53e63f2b4f2094c9a8f53
    https://github.com/scummvm/scummvm/commit/beced1886d8cde40bcf53e63f2b4f2094c9a8f53
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Fix MM transitions and death screens a bit

Changed paths:
    engines/access/martian/martian_game.cpp
    engines/access/martian/martian_scripts.cpp


diff --git a/engines/access/martian/martian_game.cpp b/engines/access/martian/martian_game.cpp
index bb50b26122e..7a87e3bddbf 100644
--- a/engines/access/martian/martian_game.cpp
+++ b/engines/access/martian/martian_game.cpp
@@ -94,6 +94,7 @@ void MartianEngine::displayNote(const Common::String &msg) {
 	_fonts._charSet._hi = 8;
 	_fonts._charFor._lo = 0;
 	_fonts._charFor._hi = 255;
+	Font::_fontColors[3] = 0;
 
 	_screen->_maxChars = 40;
 	_screen->_printOrg = _screen->_printStart = Common::Point(59, 124);
@@ -316,6 +317,8 @@ void MartianEngine::showExpositionText(Common::String msg) {
 			_screen->_printOrg.y = _screen->_printStart.y;
 		}
 	} while (!lastLine);
+	// Avoid re-using double-click
+	_events->clearEvents();
 	_events->waitKeyActionMouse();
 }
 
@@ -323,7 +326,7 @@ void MartianEngine::dead(int deathId) {
 	// Load and display death screen
 	_events->hideCursor();
 	_screen->forceFadeOut();
-	_files->loadScreen(48, _deaths[deathId]._screenId);
+	_files->loadScreen(48, _deaths[deathId]._screenId - 1);
 	_screen->setIconPalette();
 	_buffer2.copyBuffer(_screen);
 	_screen->forceFadeIn();
diff --git a/engines/access/martian/martian_scripts.cpp b/engines/access/martian/martian_scripts.cpp
index c7904745537..fe44802a4d3 100644
--- a/engines/access/martian/martian_scripts.cpp
+++ b/engines/access/martian/martian_scripts.cpp
@@ -92,7 +92,7 @@ void MartianScripts::cmdSpecial1(int param1, int param2) {
 	//
 	_vm->_events->hideCursor();
 
-	if (param1 != -1) {
+	if ((byte)param1 != (byte)-1) {
 		_vm->_files->loadScreen(49, param1);
 		_vm->_buffer2.copyBuffer(_vm->_screen);
 	}


Commit: 4b3173135495ce14d9a9fd91d017e3148a636540
    https://github.com/scummvm/scummvm/commit/4b3173135495ce14d9a9fd91d017e3148a636540
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Allow cross-planet travel in MM cheat mode

Changed paths:
    engines/access/debugger.cpp
    engines/access/scripts.cpp


diff --git a/engines/access/debugger.cpp b/engines/access/debugger.cpp
index fea9cb0bd23..1680717916f 100644
--- a/engines/access/debugger.cpp
+++ b/engines/access/debugger.cpp
@@ -121,7 +121,9 @@ bool Debugger::Cmd_LoadScene(int argc, const char **argv) {
 bool Debugger::Cmd_Cheat(int argc, const char **argv) {
 	if (argc != 1) {
 		debugPrintf("Usage: %s\n", argv[0]);
-		debugPrintf("Switches on/off the cheat mode (skips Amazon guard on boat)\n");
+		debugPrintf("Switches on/off the cheat mode.  Cheat mode:\n");
+		debugPrintf(" - [Amazon] Skips guard on boat\n");
+		debugPrintf(" - [MM] Allows travel to \"can't get there from here\" locations\n");
 		return true;
 	}
 
@@ -353,8 +355,17 @@ bool Debugger::Cmd_Everything(int argc, const char **argv) {
 	for (uint i = 0; i < ARRAYSIZE(_vm->_travel); ++i)
 		_vm->_travel[i] = 1;
 
-	// Turn off some known-broken locations
-	_vm->_travel[12] = 0; // "LOVE SCENE"
+	//
+	// Turn off known-broken/cut locations that exist in the travel table
+	// but you can't go there or going there directly will cause a crash.
+	//
+	const int INVALID_TRAVEL_LOCATIONS[] = {
+		10, // RESTAURANT
+		12, // LOVE SCENE
+	};
+
+	for (uint i = 0; i < ARRAYSIZE(INVALID_TRAVEL_LOCATIONS); ++i)
+		_vm->_travel[INVALID_TRAVEL_LOCATIONS[i]] = 0;
 
 	for (uint i = 0; i < ARRAYSIZE(_vm->_ask); ++i)
 		_vm->_ask[i] = 1;
diff --git a/engines/access/scripts.cpp b/engines/access/scripts.cpp
index e5a7a4242fa..0793282ad95 100644
--- a/engines/access/scripts.cpp
+++ b/engines/access/scripts.cpp
@@ -811,7 +811,7 @@ void Scripts::cmdDoTravel() {
 
 		if (btnSelected != 2) {
 			int newRoomNum = _vm->_travelBox->_tempListIdx[boxX];
-			if (Martian::CAN_TRAVEL_MATRIX[newRoomNum] != _vm->_flags[171]) {
+			if (!_vm->_cheatFl && (Martian::CAN_TRAVEL_MATRIX[newRoomNum] != _vm->_flags[171])) {
 				_vm->_bubbleBox->_bubbleDisplStr = "TRAVEL";
 				doCmdPrint_v1(_vm->_res->CANT_GET_THERE);
 				continue;


Commit: de19d80918b4f9c76d1475c3f5db9a8ad9eca2f2
    https://github.com/scummvm/scummvm/commit/de19d80918b4f9c76d1475c3f5db9a8ad9eca2f2
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Add hack to skip unskippable MM videos

Changed paths:
    engines/access/scripts.cpp


diff --git a/engines/access/scripts.cpp b/engines/access/scripts.cpp
index 0793282ad95..0323db39ae6 100644
--- a/engines/access/scripts.cpp
+++ b/engines/access/scripts.cpp
@@ -765,7 +765,16 @@ void Scripts::cmdVideoEnded() {
 	debugCN(1, kDebugScripts, "cmdVideoEnded()");
 	_vm->_events->pollEventsAndWait();
 
-	if (_vm->_video->_videoEnd) {
+	// Slight HACK - add ability to skip unskippable videos.
+	bool skipVideo = false;
+	Common::CustomEventType action;
+	if (_vm->_events->getAction(action) && action == kActionSkip) {
+		skipVideo = true;
+		_vm->_sound->stopSound();
+		_vm->_events->zeroKeysActions();
+	}
+
+	if (_vm->_video->_videoEnd || skipVideo) {
 		debugC(1, kDebugScripts, " -> True");
 		cmdGoto();
 	} else {


Commit: 61b7273745aeb35070e844dfcfe9a0b1af1e10b9
    https://github.com/scummvm/scummvm/commit/61b7273745aeb35070e844dfcfe9a0b1af1e10b9
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Fix placement of default messages in MM

Changed paths:
    engines/access/scripts.cpp


diff --git a/engines/access/scripts.cpp b/engines/access/scripts.cpp
index 0323db39ae6..fd089ab7bac 100644
--- a/engines/access/scripts.cpp
+++ b/engines/access/scripts.cpp
@@ -270,7 +270,10 @@ void Scripts::cmdEndObject() {
 	else
 		msg = GENERAL_MESSAGES[_vm->_room->_selectCommand];
 	debugC(1, kDebugScripts, "cmdEndObject(msg=\"%s\")", msg);
-	printString(msg);
+	if (_vm->getGameID() == kGameMartianMemorandum)
+		doCmdPrint_v1(msg);
+	else
+		printString(msg);
 }
 
 void Scripts::cmdJumpLook() {


Commit: 1f6d3b5610991d8195d2e9e3171634d646c00068
    https://github.com/scummvm/scummvm/commit/1f6d3b5610991d8195d2e9e3171634d646c00068
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Fix possible crash after death in MM

Changed paths:
    engines/access/room.cpp


diff --git a/engines/access/room.cpp b/engines/access/room.cpp
index 6bcd2c55f76..7aba06c0c04 100644
--- a/engines/access/room.cpp
+++ b/engines/access/room.cpp
@@ -287,6 +287,7 @@ void Room::clearRoom() {
 	freePlayField();
 	freeTileData();
 	_vm->_player->freeSprites();
+	_vm->_images.clear();
 }
 
 void Room::loadRoomData(const byte *roomData) {


Commit: ce5206b8c232c683ef8a4032a94ffae1e0060740
    https://github.com/scummvm/scummvm/commit/ce5206b8c232c683ef8a4032a94ffae1e0060740
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Fix scroll when jumping rocks in MM

Changed paths:
    engines/access/player.cpp


diff --git a/engines/access/player.cpp b/engines/access/player.cpp
index 904348d9878..0fff8512315 100644
--- a/engines/access/player.cpp
+++ b/engines/access/player.cpp
@@ -714,6 +714,8 @@ void Player::checkScroll() {
 	if (_playerDirection == NONE)
 		return;
 
+	calcPlayer();
+
 	if ((_playerDirection == UPLEFT || _playerDirection == DOWNLEFT ||
 			_playerDirection == LEFT) && _playerX <= _scrollThreshold) {
 		// Scroll right
@@ -819,7 +821,7 @@ bool Player::scrollLeft(int forcedAmount) {
 		return true;
 	} else {
 		_scrollFlag = true;
-		_vm->_scrollX = _vm->_scrollX + _scrollAmount;
+		_vm->_scrollX += _scrollAmount;
 
 		do {
 			if (_vm->_scrollX < TILE_WIDTH)


Commit: 5f1ad33cdb1487658ac9e9139a750fc05fa1e342
    https://github.com/scummvm/scummvm/commit/5f1ad33cdb1487658ac9e9139a750fc05fa1e342
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Hide cursor during special cutscene in MM

Changed paths:
    engines/access/martian/martian_scripts.cpp


diff --git a/engines/access/martian/martian_scripts.cpp b/engines/access/martian/martian_scripts.cpp
index fe44802a4d3..ffc1dcbf687 100644
--- a/engines/access/martian/martian_scripts.cpp
+++ b/engines/access/martian/martian_scripts.cpp
@@ -41,16 +41,16 @@ void MartianScripts::cmdSpecial0() {
 	_vm->_midi->midiPlay();
 	_vm->_midi->setLoop(true);
 
-	_vm->_events->_vbCount = 300;
-	while (!_vm->shouldQuit() && _vm->_events->_vbCount > 0)
-		_vm->_events->pollEventsAndWait();
-
 	_vm->_screen->forceFadeOut();
 	_vm->_files->loadScreen("HOUSE.SC");
 
 	_vm->_video->setVideo(_vm->_screen, Common::Point(46, 30), "HVID.VID", 20);
 
-	warning("TODO: MartianScripts::cmdSpecial0: Work out how to get timing right");
+	_vm->_events->hideCursor();
+	_vm->_events->_vbCount = 300;
+	while (!_vm->shouldQuit() && _vm->_events->_vbCount > 0)
+		_vm->_events->pollEventsAndWait();
+
 	do {
 		_vm->_video->playVideo();
 		_vm->_events->pollEvents();
@@ -81,9 +81,11 @@ void MartianScripts::cmdSpecial0() {
 	do {
 		_vm->_events->pollEvents();
 	} while (!_vm->shouldQuit() && _vm->_sound->isSFXPlaying());
+
+	_vm->_events->showCursor();
 	_vm->_midi->stopSong();
 	_vm->_midi->freeMusic();
-	warning("TODO: Pop Midi");
+	//warning("TODO: Pop Midi?");
 }
 
 void MartianScripts::cmdSpecial1(int param1, int param2) {


Commit: df8c32b9ba9528edce29fc10d8c284d42aaf964f
    https://github.com/scummvm/scummvm/commit/df8c32b9ba9528edce29fc10d8c284d42aaf964f
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Fix MM restarts a little

Changed paths:
    engines/access/martian/martian_game.cpp


diff --git a/engines/access/martian/martian_game.cpp b/engines/access/martian/martian_game.cpp
index 7a87e3bddbf..4270c44abd0 100644
--- a/engines/access/martian/martian_game.cpp
+++ b/engines/access/martian/martian_game.cpp
@@ -74,6 +74,9 @@ void MartianEngine::initVariables() {
 
 	ARRAYCLEAR(_ask);
 	_ask[33] = 1;
+
+	ARRAYCLEAR(_flags);
+
 }
 
 void MartianEngine::setNoteParams() {
@@ -337,6 +340,7 @@ void MartianEngine::dead(int deathId) {
 	_fonts._charSet._lo = 1;
 	_fonts._charFor._lo = 247;
 	_fonts._charFor._hi = 255;
+	Font::_fontColors[3] = 247;
 	_screen->_maxChars = 50;
 	_screen->_printOrg = Common::Point(24, 18);
 	_screen->_printStart = Common::Point(24, 18);


Commit: 5c0053bef09e7d2a2b684ccd221e2c475eb36e92
    https://github.com/scummvm/scummvm/commit/5c0053bef09e7d2a2b684ccd221e2c475eb36e92
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Add missing rooms in MM data

Changed paths:
    engines/access/martian/martian_resources.cpp
    engines/access/resources.h


diff --git a/engines/access/martian/martian_resources.cpp b/engines/access/martian/martian_resources.cpp
index 5e1387539c2..1eaee751437 100644
--- a/engines/access/martian/martian_resources.cpp
+++ b/engines/access/martian/martian_resources.cpp
@@ -399,6 +399,12 @@ void MartianResources::load(Common::SeekableReadStream &s) {
 	_bitFont = new MartianBitFont(ARRAYSIZE(BITFONT_DATA) / 8, BITFONT_DATA);
 
 	CANT_GET_THERE = "YOU CAN'T GET THERE FROM HERE.";
+
+	// The EXE doesn't have full data for the last few room table entries (49~51), as they are only
+	// talk locations.  That means the DAT file doesn't include them, so we add them manually.
+	ROOMTBL.push_back(RoomEntry({"MICHELE BLOODWORTH", Common::Point(-1, 18), Common::Array<byte>()}));
+	ROOMTBL.push_back(RoomEntry({"BRADLEY ERICSON", Common::Point(-1, 19), Common::Array<byte>()}));
+	ROOMTBL.push_back(RoomEntry({"COOPER BRADBURY", Common::Point(-1, 21), Common::Array<byte>()}));
 }
 
 const byte *MartianResources::getCursor(int num) const {
diff --git a/engines/access/resources.h b/engines/access/resources.h
index f153f5b8e98..6229496be07 100644
--- a/engines/access/resources.h
+++ b/engines/access/resources.h
@@ -49,11 +49,6 @@ class Resources {
 		Common::Language _language;
 		uint _fileOffset;
 	};
-	struct RoomEntry {
-		Common::String _desc;
-		Common::Point _travelPos;
-		Common::Array<byte> _data;
-	};
 	struct DeathEntry {
 		byte _screenId;
 		Common::String _msg;
@@ -63,6 +58,12 @@ class Resources {
 		int _combo[4];
 	};
 protected:
+	struct RoomEntry {
+		Common::String _desc;
+		Common::Point _travelPos;
+		Common::Array<byte> _data;
+	};
+
 	AccessEngine *_vm;
 	Common::Array<DATEntry> _datIndex;
 


Commit: 86c67200452c2af48f270e7b879138c3e6de8b8b
    https://github.com/scummvm/scummvm/commit/86c67200452c2af48f270e7b879138c3e6de8b8b
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Fixes for MM hoverboard scene

Changed paths:
    engines/access/player.cpp
    engines/access/player.h
    engines/access/room.cpp


diff --git a/engines/access/player.cpp b/engines/access/player.cpp
index 0fff8512315..165691e2c2f 100644
--- a/engines/access/player.cpp
+++ b/engines/access/player.cpp
@@ -175,6 +175,12 @@ void Player::removeSprite1() {
 	}
 }
 
+bool Player::isMMHover() const {
+	// Whether or not this is MM and the player is on the hoverboard.
+	return (_vm->getGameID() == kGameMartianMemorandum &&
+		_vm->_flags[174] == 1);
+}
+
 void Player::calcManScale() {
 	if (!_vm->_manScaleOff) {
 		_vm->_scale = ((((_rawPlayer.y - _vm->_scaleMaxY + _vm->_scaleN1) *
@@ -252,9 +258,9 @@ void Player::walkUp() {
 
 	_playerDirection = UP;
 	int walkOff = _walkOffUp[_frame - _upWalkMin];
-	int tempL = _rawPlayerLow.y - _vm->_screen->_scaleTable2[walkOff];
+	int tempL = _rawPlayerLow.y - (isMMHover() ? 2 : _vm->_screen->_scaleTable2[walkOff]);
 	_rawYTempL = (byte)tempL;
-	int yTemp = _rawPlayer.y - _vm->_screen->_scaleTable1[walkOff] -
+	int yTemp = _rawPlayer.y - (isMMHover() ? 2 : _vm->_screen->_scaleTable1[walkOff]) -
 		(tempL < 0 ? 1 : 0);
 	_rawYTemp = yTemp;
 	_rawXTemp = _rawPlayer.x;
@@ -284,10 +290,10 @@ void Player::walkDown() {
 		_frame = _downWalkMin;
 
 	_playerDirection = DOWN;
-	int walkOff = _walkOffDown[_frame - _downWalkMin];
-	int tempL = _vm->_screen->_scaleTable2[walkOff] + _rawPlayerLow.y;
+	int walkOff =  _walkOffDown[_frame - _downWalkMin];
+	int tempL = (isMMHover() ? 2 : _vm->_screen->_scaleTable2[walkOff]) + _rawPlayerLow.y;
 	_rawYTempL = (byte)tempL;
-	_rawYTemp = _vm->_screen->_scaleTable1[walkOff] + _rawPlayer.y + (tempL >= 0x100 ? 1 : 0);
+	_rawYTemp = (isMMHover() ? 2 : _vm->_screen->_scaleTable1[walkOff]) + _rawPlayer.y + (tempL >= 0x100 ? 1 : 0);
 	_rawXTemp = _rawPlayer.x;
 
 	if (_vm->_room->codeWalls()) {
@@ -324,9 +330,9 @@ void Player::walkLeft() {
 	}
 	if (flag) {
 		int walkOffset = _walkOffLeft[_frame - _sideWalkMin];
-		int tempL = _rawPlayerLow.x - _vm->_screen->_scaleTable2[walkOffset];
+		int tempL = _rawPlayerLow.x - (isMMHover() ? 2 : _vm->_screen->_scaleTable2[walkOffset]);
 		_rawTempL = (byte)tempL;
-		_rawXTemp = _rawPlayer.x - _vm->_screen->_scaleTable1[walkOffset] -
+		_rawXTemp = _rawPlayer.x - (isMMHover() ? 2 : _vm->_screen->_scaleTable1[walkOffset]) -
 			(tempL < 0 ? 1 : 0);
 	} else {
 		_rawXTemp = _rawPlayer.x - _vm->_screen->_scaleTable1[_scrollConst];
@@ -366,9 +372,9 @@ void Player::walkRight() {
 	}
 	if (flag) {
 		int walkOffset = _walkOffRight[_frame - _sideWalkMin];
-		int tempL = _rawPlayerLow.x + _vm->_screen->_scaleTable2[walkOffset];
+		int tempL = _rawPlayerLow.x + (isMMHover() ? 2 : _vm->_screen->_scaleTable2[walkOffset]);
 		_rawTempL = (byte)tempL;
-		_rawXTemp = _rawPlayer.x + _vm->_screen->_scaleTable1[walkOffset] +
+		_rawXTemp = _rawPlayer.x + (isMMHover() ? 2 : _vm->_screen->_scaleTable1[walkOffset]) +
 			(tempL >= 0x100 ? 1 : 0);
 	} else {
 		_rawXTemp = _rawPlayer.x + _vm->_screen->_scaleTable1[_scrollConst];
@@ -681,8 +687,17 @@ void Player::plotCom1() {
 
 void Player::plotCom2() {
 	// WORKAROUND: Amazon has at least one cutscene with the player not properly turned off
-	if (!_playerOff && _spritesPtr != nullptr)
-		_vm->_images.addToList(*this);
+	if (!_playerOff && _spritesPtr != nullptr) {
+		ImageEntry ie = *this;
+		if (!isMMHover()) {
+			_vm->_images.addToList(ie);
+		} else if (_vm->_objectsTable[23]) {
+			// MM player on hoverboard
+			ie._spritesPtr = _vm->_objectsTable[23];
+			ie._frameNumber = 13;
+			_vm->_images.addToList(ie);
+		}
+	}
 }
 
 void Player::plotCom3() {
diff --git a/engines/access/player.h b/engines/access/player.h
index 9093c15f845..65e29333c48 100644
--- a/engines/access/player.h
+++ b/engines/access/player.h
@@ -73,6 +73,8 @@ protected:
 	void walkUpRight();
 	void walkDownRight();
 	void checkScrollUp();
+
+	bool isMMHover() const;
 public:
 	Direction _playerDirection;
 	SpriteResource *_playerSprites;
diff --git a/engines/access/room.cpp b/engines/access/room.cpp
index 7aba06c0c04..dbaf91affa6 100644
--- a/engines/access/room.cpp
+++ b/engines/access/room.cpp
@@ -645,11 +645,13 @@ void Room::executeCommand(int commandId) {
 				return;
 			}
 			if (_vm->_useItem == 39) {
+				// Use hoverboard
 				if (_vm->_player->_roomNumber == 23)
-					_vm->_currentMan = 1;
+					_vm->_flags[174] = 1;
 				commandOff();
 				return;
 			} else if (_vm->_useItem == 6) {
+				// Use comlink
 				_vm->_flags[3] = 2;
 				_vm->_scripts->converse1(24);
 


Commit: 1f3f1864dcc27eb12385ce5babdf7194d45a4876
    https://github.com/scummvm/scummvm/commit/1f3f1864dcc27eb12385ce5babdf7194d45a4876
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Add Jetpack special case and stub tunnel code

For now the tunnel/duct scene in the casino is skipped so the game can
continue.  Added some starting-point code.

Changed paths:
  A engines/access/martian/martian_tunnel.cpp
  A engines/access/martian/martian_tunnel.h
    engines/access/asurface.h
    engines/access/martian/martian_scripts.cpp
    engines/access/martian/martian_scripts.h
    engines/access/module.mk
    engines/access/player.cpp
    engines/access/player.h


diff --git a/engines/access/asurface.h b/engines/access/asurface.h
index 99d24bfe7f6..81ead365387 100644
--- a/engines/access/asurface.h
+++ b/engines/access/asurface.h
@@ -149,6 +149,7 @@ public:
 };
 
 enum ImageFlag {
+	IMGFLAG_NONE = 0,
 	IMGFLAG_CROPPED = 1,
 	IMGFLAG_BACKWARDS = 2,
 	IMGFLAG_DRAWN = 4,
diff --git a/engines/access/martian/martian_scripts.cpp b/engines/access/martian/martian_scripts.cpp
index ffc1dcbf687..243dd61a377 100644
--- a/engines/access/martian/martian_scripts.cpp
+++ b/engines/access/martian/martian_scripts.cpp
@@ -23,6 +23,7 @@
 #include "access/access.h"
 #include "access/martian/martian_game.h"
 #include "access/martian/martian_resources.h"
+#include "access/martian/martian_tunnel.h"
 #include "access/martian/martian_scripts.h"
 
 namespace Access {
@@ -31,9 +32,15 @@ namespace Martian {
 
 MartianScripts::MartianScripts(AccessEngine *vm) : Scripts(vm) {
 	_game = (MartianEngine *)_vm;
+	_tunnel = new MartianTunnel(_game);
+}
+
+MartianScripts::~MartianScripts() {
+	delete _tunnel;
 }
 
 void MartianScripts::cmdSpecial0() {
+	// Abduction scene
 	_vm->_sound->stopSound();
 	_vm->_midi->stopSong();
 
@@ -106,6 +113,10 @@ void MartianScripts::cmdSpecial1(int param1, int param2) {
 	_vm->establish(0, param2);
 }
 
+void MartianScripts::cmdSpecial2() {
+	_tunnel->tunnel2();
+};
+
 void MartianScripts::cmdSpecial3() {
 	_vm->_screen->forceFadeOut();
 	_vm->_events->hideCursor();
@@ -117,6 +128,10 @@ void MartianScripts::cmdSpecial3() {
 	_vm->_screen->forceFadeIn();
 }
 
+void MartianScripts::cmdSpecial4() {
+	_tunnel->tunnel4();
+}
+
 void MartianScripts::doIntro(int param1) {
 	_game->doSpecial5(param1);
 }
@@ -147,6 +162,8 @@ void MartianScripts::cmdSpecial6() {
 
 	Resource *notesRes = _vm->_files->loadFile("ETEXT.DAT");
 	notesRes->_stream->seek(72);
+	uint16 offset = notesRes->_stream->readUint16LE();
+	notesRes->_stream->seek(offset);
 
 	// Read the message
 	Common::String msg = notesRes->_stream->readString();
@@ -158,6 +175,8 @@ void MartianScripts::cmdSpecial6() {
 	delete _vm->_objectsTable[0];
 	_vm->_objectsTable[0] = nullptr;
 	_vm->_midi->stopSong();
+
+	// TODO: Restore original music here?
 }
 
 void MartianScripts::cmdSpecial7() {
@@ -323,13 +342,13 @@ void MartianScripts::executeSpecial(int commandIndex, int param1, int param2) {
 		cmdSpecial1(param1, param2);
 		break;
 	case 2:
-		warning("TODO: cmdSpecial2");
+		cmdSpecial2();
 		break;
 	case 3:
 		cmdSpecial3();
 		break;
 	case 4:
-		warning("TODO: cmdSpecial4");
+		cmdSpecial4();
 		break;
 	case 5:
 		doIntro(param1);
diff --git a/engines/access/martian/martian_scripts.h b/engines/access/martian/martian_scripts.h
index 62778fc9cb7..f31f77f7db8 100644
--- a/engines/access/martian/martian_scripts.h
+++ b/engines/access/martian/martian_scripts.h
@@ -30,14 +30,18 @@ namespace Access {
 namespace Martian {
 
 class MartianEngine;
+class MartianTunnel;
 
 class MartianScripts : public Scripts {
 private:
 	MartianEngine *_game;
+	MartianTunnel *_tunnel;
 
 	void cmdSpecial0();
 	void cmdSpecial1(int param1, int param2);
+	void cmdSpecial2();
 	void cmdSpecial3();
+	void cmdSpecial4();
 	void doIntro(int param1);
 	void cmdSpecial6();
 	void cmdSpecial7();
@@ -48,6 +52,7 @@ protected:
 
 public:
 	MartianScripts(AccessEngine *vm);
+	~MartianScripts();
 };
 
 } // End of namespace Martian
diff --git a/engines/access/martian/martian_tunnel.cpp b/engines/access/martian/martian_tunnel.cpp
new file mode 100644
index 00000000000..67376039555
--- /dev/null
+++ b/engines/access/martian/martian_tunnel.cpp
@@ -0,0 +1,143 @@
+/* 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 "access/martian/martian_tunnel.h"
+#include "access/martian/martian_game.h"
+
+namespace Access {
+
+namespace Martian {
+
+MartianTunnel::MartianTunnel(MartianEngine *vm) : _vm(vm), _tunnelParam_ca42(0), _tunnelParam_ca44(0), _tunnelParam_ca46(0), _tunnelMoveFlag(0) {
+}
+
+MartianTunnel::~MartianTunnel() {
+}
+
+void MartianTunnel::tunnel2() {
+	_tunnelParam_ca42 = 0x226;
+	_tunnelParam_ca44 = 10;
+	_tunnelParam_ca46 = 0x352;
+	doTunnel();
+}
+
+void MartianTunnel::tunnel4() {
+	_tunnelParam_ca42 = 0xabe;
+	_tunnelParam_ca44 = 10;
+	_tunnelParam_ca46 = 0x41a;
+	doTunnel();
+}
+
+void MartianTunnel::doTunnel() {
+	_vm->_screen->forceFadeOut();
+	_vm->_events->hideCursor();
+	_vm->_files->loadScreen(20, 0);
+	Resource *res = _vm->_files->loadFile(20, 1);
+	_vm->_objectsTable[20] = new SpriteResource(_vm, res);
+	if (_vm->_inventory->_inv[40]._value == ITEM_IN_INVENTORY) {
+		_vm->_screen->plotImage(_vm->_objectsTable[20], 8, Common::Point(140, 10));
+	}
+	_vm->_events->showCursor();
+	_vm->_screen->forceFadeIn();
+	_crawlFrame = 0;
+	_tunnelMoveFlag = 0;
+
+	warning("***TODO***: Init all the other tunnel variables here");
+
+	drawArrowSprites();
+	drawArrowSprites2();
+	_vm->_room->_function = FN_NONE;
+
+	/*
+	while (true) {
+		clearWorkScreenArea();
+		tunnel_17f5c();
+		tunnel_1888a();
+		tunnel_18985();
+		_vm->_buffer2.plotImage(_vm->_objectsTable[20], _crawlFrame, Common::Point(140, 94));
+		copyBufBlockToScreen();
+		if (_vm->_room->_function != FN_NONE)
+			break;
+		do {
+			tunnel_doloop_18c65();
+		} while (_tunnelStopLoop_ca27 == 0);
+	}
+	*/
+	// FIXME: Quick hack skip this part
+	g_system->displayMessageOnOSD(Common::U32String("Duct tunnel section not implemented yet!"));
+	_vm->_flags[0x62] = 1;
+	_vm->_flags[0x55] = 1;
+	_vm->_room->_function = FN_CLEAR1;
+	
+
+
+	delete _vm->_objectsTable[20];
+	_vm->_objectsTable[20] = nullptr;
+}
+
+void MartianTunnel::drawArrowSprites() {
+	int x;
+	int y;
+	int frame;
+
+	_vm->_events->hideCursor();
+	_vm->_screen->plotImage(_vm->_objectsTable[20], 7, Common::Point(4, 0x50));
+	if (_tunnelMoveFlag == 0) {
+		x = 0x11;
+		y = 0x50;
+		frame = 9;
+	} else if (_tunnelMoveFlag == 0x40) {
+		x = 0x19;
+		y = 0x57;
+		frame = 12;
+	} else if (_tunnelMoveFlag == 0x80) {
+		x = 0xe;
+		y = 0x5d;
+		frame = 11;
+	} else {
+		x = 4;
+		y = 0x57;
+		frame = 10;
+	}
+	_vm->_screen->plotImage(_vm->_objectsTable[20], frame, Common::Point(x, y));
+	_vm->_events->showCursor();
+}
+	
+void MartianTunnel::drawArrowSprites2() {
+	_vm->_events->hideCursor();
+	_vm->_screen->plotImage(_vm->_objectsTable[20], 14, Common::Point(16, 0x58));
+	if ((3 < _tunnel_ca20) && (_tunnel_ca20 < 0xd)) {
+		_vm->_screen->plotImage(_vm->_objectsTable[20], 13, Common::Point(17, 0x59));
+	}
+	_vm->_events->showCursor();
+}
+
+void MartianTunnel::clearWorkScreenArea() {
+	_vm->_buffer2.fillRect(Common::Rect(100, 60, 220, 140), 0);
+}
+
+void MartianTunnel::copyBufBlockToScreen() {
+	_vm->_screen->copyBlock(&_vm->_buffer2, Common::Rect(100, 60, 220, 140));
+}
+
+}
+
+} // end namespace Access
diff --git a/engines/access/martian/martian_tunnel.h b/engines/access/martian/martian_tunnel.h
new file mode 100644
index 00000000000..81f77cf186c
--- /dev/null
+++ b/engines/access/martian/martian_tunnel.h
@@ -0,0 +1,66 @@
+/* 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 ACCESS_MARTIAN_MARTIAN_TUNNEL_H
+#define ACCESS_MARTIAN_MARTIAN_TUNNEL_H
+
+#include "common/scummsys.h"
+
+namespace Access {
+
+namespace Martian {
+
+class MartianEngine;
+
+class MartianTunnel {
+public:
+	MartianTunnel(MartianEngine *vm);
+	~MartianTunnel();
+
+	void tunnel2();
+	void tunnel4();
+
+private:
+	void doTunnel();
+	void drawArrowSprites();
+	void drawArrowSprites2();
+	void clearWorkScreenArea();
+	void copyBufBlockToScreen();
+	void tunnel_doloop_8c65();
+	void tunnel_17f5c();
+	void tunnel_1888a();
+	void tunnel_18985();
+
+	MartianEngine *_vm;
+	int16 _tunnelParam_ca42;
+	int16 _tunnelParam_ca44;
+	int16 _tunnelParam_ca46;
+	uint16 _tunnel_ca20;
+	byte _tunnelMoveFlag;
+	int16 _crawlFrame;
+	byte _tunnelStopLoop_ca27;
+};
+
+}
+
+} // end namespace Access
+
+#endif // ACCESS_MARTIAN_MARTIAN_TUNNEL_H
diff --git a/engines/access/module.mk b/engines/access/module.mk
index 03465dd7158..29a45a333a6 100644
--- a/engines/access/module.mk
+++ b/engines/access/module.mk
@@ -1,9 +1,9 @@
 MODULE := engines/access
 
 MODULE_OBJS := \
+	access.o \
 	animation.o \
 	asurface.o \
-	access.o \
 	bubble_box.o \
 	char.o \
 	data.o \
@@ -21,7 +21,6 @@ MODULE_OBJS := \
 	scripts.o \
 	sound.o \
 	video.o \
-	video/movie_decoder.o \
 	amazon/amazon_game.o \
 	amazon/amazon_logic.o \
 	amazon/amazon_player.o \
@@ -31,6 +30,8 @@ MODULE_OBJS := \
 	martian/martian_game.o \
 	martian/martian_player.o \
 	martian/martian_resources.o \
+	martian/martian_tunnel.o \
+	video/movie_decoder.o \
 	martian/martian_room.o \
 	martian/martian_scripts.o
 
diff --git a/engines/access/player.cpp b/engines/access/player.cpp
index 165691e2c2f..2210e1f3626 100644
--- a/engines/access/player.cpp
+++ b/engines/access/player.cpp
@@ -72,6 +72,7 @@ Player::Player(AccessEngine *vm) : Manager(vm), ImageEntry() {
 	_playerDirection = NONE;
 	_xFlag = _yFlag = 0;
 	_inactiveYOff = 0;
+	_jetpackFlag = 0;
 
 	_sideWalkMin = _sideWalkMax = 0;
 	_upWalkMin = _upWalkMax = 0;
@@ -193,8 +194,56 @@ void Player::calcManScale() {
 	}
 }
 
+void Player::jetpack() {
+	_playerDirection = UP;
+	ImageFlag flags = IMGFLAG_NONE;
+	if (!_vm->_timers[0]._flag) {
+		_vm->_timers[0]._flag = 1;
+		_jetpackFlag ^= 1;
+		_rawPlayer.y -= 4;
+		if (_move == RIGHT) {
+			_frame = 0;
+			flags = IMGFLAG_CROPPED;
+			if (_rawPlayer.x < 0x101)
+				_rawPlayer.x += 2;
+			else
+				_rawPlayer.x = 256;
+		}
+		if (_move == LEFT) {
+			_frame = 0;
+			flags = IMGFLAG_BACKWARDS;
+			_rawPlayer.x -= 2;
+			if (_rawPlayer.x < 0)
+				_rawPlayer.x = 0;
+		}
+
+		// Leave tex facing whichever direction he was previously
+		// unless moving in some direction
+		if (_move == LEFT || _move == RIGHT)
+			_flags = (_flags & 0xfd) | flags;
+	}
+
+	_flags |= IMGFLAG_UNSCALED;
+
+	_position.x = _rawPlayer.x;
+	_position.y = _rawPlayer.y - _playerOffset.y;
+	_offsetY = _playerOffset.y;
+	_frameNumber = 23 + _jetpackFlag;
+
+	ImageEntry ie = *this;
+	ie._spritesPtr = _vm->_objectsTable[35];
+	_vm->_images.addToList(ie);
+}
+
 void Player::walk() {
 	_collideFlag = false;
+
+	if (_vm->getGameID() == kGameMartianMemorandum && _vm->_flags[173] == 1) {
+		// Special case for MM Jetpack
+		jetpack();
+		return;
+	}
+
 	_playerDirection = NONE;
 
 	if (_playerOff)
diff --git a/engines/access/player.h b/engines/access/player.h
index 65e29333c48..0a228e55285 100644
--- a/engines/access/player.h
+++ b/engines/access/player.h
@@ -57,6 +57,7 @@ protected:
 	SpriteResource *_playerSprites1;
 	int _scrollEnd;
 	int _inactiveYOff;
+	int _jetpackFlag;
 
 	void plotCom(int v1);
 	void plotCom0();
@@ -75,6 +76,8 @@ protected:
 	void checkScrollUp();
 
 	bool isMMHover() const;
+	void jetpack();
+
 public:
 	Direction _playerDirection;
 	SpriteResource *_playerSprites;
@@ -131,6 +134,8 @@ public:
 
 	void calcManScale();
 
+	void extracted();
+
 	void walk();
 
 	void calcPlayer();


Commit: 1c5f75c7f9639750dfaf92fd7f5829eff8282bfa
    https://github.com/scummvm/scummvm/commit/1c5f75c7f9639750dfaf92fd7f5829eff8282bfa
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Fixes for MM endgame sequence

Changed paths:
    engines/access/martian/martian_scripts.cpp


diff --git a/engines/access/martian/martian_scripts.cpp b/engines/access/martian/martian_scripts.cpp
index 243dd61a377..95f778722ef 100644
--- a/engines/access/martian/martian_scripts.cpp
+++ b/engines/access/martian/martian_scripts.cpp
@@ -137,6 +137,8 @@ void MartianScripts::doIntro(int param1) {
 }
 
 void MartianScripts::cmdSpecial6() {
+	// A special transition screen after the jetpack in the outpost.
+	warning("cmdSpecial6: TODO: Store current music");
 	_vm->_midi->stopSong();
 	_vm->_screen->setDisplayScan();
 	_vm->_events->clearEvents();
@@ -176,7 +178,11 @@ void MartianScripts::cmdSpecial6() {
 	_vm->_objectsTable[0] = nullptr;
 	_vm->_midi->stopSong();
 
-	// TODO: Restore original music here?
+	// WORKAROUND: Reset Tex's scale flag after jetpack.
+	// (bug also present in original game)
+	_vm->_player->_flags &= ~IMGFLAG_UNSCALED;
+
+	warning("cmdSpecial6: TODO: Restore original music");
 }
 
 void MartianScripts::cmdSpecial7() {
@@ -201,7 +207,7 @@ void MartianScripts::cmdSpecial7() {
 
 	// Load objects specific to this special scene
 	Resource *data = _vm->_files->loadFile(40, 2);
-	_game->_spec7Objects = new SpriteResource(_vm, data);
+	_game->_objectsTable[40] = new SpriteResource(_vm, data);
 	delete data;
 
 	// Load animation data
@@ -212,23 +218,25 @@ void MartianScripts::cmdSpecial7() {
 
 	// Load script
 	Resource *newScript = _vm->_files->loadFile(40, 0);
-	_vm->_scripts->setScript(newScript);
+	setScript(newScript);
 
 	_vm->_images.clear();
 	_vm->_oldRects.clear();
-	_vm->_scripts->_sequence = 0;
-
+	_sequence = 0;
+	searchForSequence();
+	executeScript();
 	_vm->_sound->playSound(0);
 
 	do {
 		charLoop();
+		_vm->_events->pollEvents();
 	} while (_vm->_flags[134] != 1);
 
 	do {
 		_vm->_events->pollEvents();
 	} while (!_vm->shouldQuit() && _vm->_sound->isSFXPlaying());
 
-	_game->_numAnimTimers = 0;
+	_vm->_animation->clearTimers();
 	_vm->_animation->freeAnimationData();
 	_vm->_scripts->freeScriptData();
 	_vm->_sound->freeSounds();
@@ -255,7 +263,6 @@ void MartianScripts::cmdSpecial7() {
 	_vm->_screen->_printOrg = Common::Point(24, 18);
 	_vm->_screen->_printStart = Common::Point(24, 18);
 
-	// Display death message
 	_game->showExpositionText(Common::String(SPEC7MESSAGE));
 
 	_vm->_events->showCursor();
@@ -281,8 +288,8 @@ void MartianScripts::cmdSpecial7() {
 	_vm->_files->loadScreen(40, 7);
 	_vm->_destIn = _vm->_screen;
 
-	_vm->_screen->plotImage(_game->_spec7Objects, 8, Common::Point(104, 176));
-	_vm->_screen->plotImage(_game->_spec7Objects, 7, Common::Point(102, 160));
+	_vm->_screen->plotImage(_game->_objectsTable[40], 8, Common::Point(176, 104));
+	_vm->_screen->plotImage(_game->_objectsTable[40], 7, Common::Point(160, 102));
 	_vm->_events->showCursor();
 	_vm->_screen->forceFadeIn();
 
@@ -315,8 +322,8 @@ void MartianScripts::cmdSpecial7() {
 
 	_vm->_sound->freeSounds();
 
-	delete _game->_spec7Objects;
-	_game->_spec7Objects = nullptr;
+	delete _game->_objectsTable[40];
+	_game->_objectsTable[40] = nullptr;
 
 	_vm->_events->hideCursor();
 	_vm->_screen->forceFadeOut();


Commit: 14b2a2506e9d014c8f80714f28162a112648696f
    https://github.com/scummvm/scummvm/commit/14b2a2506e9d014c8f80714f28162a112648696f
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Remove duplicate variables

Changed paths:
    engines/access/access.cpp
    engines/access/access.h
    engines/access/amazon/amazon_game.cpp
    engines/access/amazon/amazon_logic.cpp
    engines/access/animation.h
    engines/access/martian/martian_game.cpp
    engines/access/martian/martian_game.h
    engines/access/room.cpp
    engines/access/scripts.cpp
    engines/access/sound.h


diff --git a/engines/access/access.cpp b/engines/access/access.cpp
index be9659f9a32..974440f7491 100644
--- a/engines/access/access.cpp
+++ b/engines/access/access.cpp
@@ -62,7 +62,6 @@ AccessEngine::AccessEngine(OSystem *syst, const AccessGameDescription *gameDesc)
 	_currentMan = 0;
 	_currentManOld = -1;
 	_converseMode = 0;
-	_numAnimTimers = 0;
 	_startup = 0;
 	_currentCharFlag = false;
 	_boxSelect = false;
diff --git a/engines/access/access.h b/engines/access/access.h
index 4d27e5ff97f..8f03a97235b 100644
--- a/engines/access/access.h
+++ b/engines/access/access.h
@@ -195,7 +195,6 @@ public:
 	int _establishMode;
 	int _establishGroup;
 	int _establishCtrlTblOfs;
-	int _numAnimTimers;
 	TimerList _timers;
 	DeathList _deaths;
 	FontManager _fonts;
diff --git a/engines/access/amazon/amazon_game.cpp b/engines/access/amazon/amazon_game.cpp
index f8795b7f9bb..956b7374183 100644
--- a/engines/access/amazon/amazon_game.cpp
+++ b/engines/access/amazon/amazon_game.cpp
@@ -195,7 +195,7 @@ void AmazonEngine::initVariables() {
 	_room->_selectCommand = -1;
 	_events->setNormalCursor(CURSOR_CROSSHAIRS);
 	_mouseMode = 0;
-	_numAnimTimers = 0;
+	_animation->clearTimers();
 }
 
 void AmazonEngine::establish(int screenId, int esatabIndex) {
diff --git a/engines/access/amazon/amazon_logic.cpp b/engines/access/amazon/amazon_logic.cpp
index 3622957f762..c4083c28f48 100644
--- a/engines/access/amazon/amazon_logic.cpp
+++ b/engines/access/amazon/amazon_logic.cpp
@@ -181,7 +181,7 @@ void CampScene::mWhileDoOpen() {
 	_vm->freeCells();
 	_vm->_oldRects.clear();
 	_vm->_newRects.clear();
-	_vm->_numAnimTimers = 0;
+	_vm->_animation->clearTimers();
 	_vm->_images.clear();
 
 	if (_vm->isCD()) {
@@ -200,7 +200,7 @@ void CampScene::mWhileDoOpen() {
 		_vm->freeCells();
 		_vm->_oldRects.clear();
 		_vm->_newRects.clear();
-		_vm->_numAnimTimers = 0;
+		_vm->_animation->clearTimers();
 		_vm->_images.clear();
 	}
 }
@@ -1316,7 +1316,7 @@ void Cast::doCast(int param1) {
 
 	_vm->_oldRects.clear();
 	_vm->_newRects.clear();
-	_vm->_numAnimTimers = 0;
+	_vm->_animation->clearTimers();
 
 	_vm->_midi->newMusic(58, 0);
 	screen.forceFadeIn();
@@ -1349,7 +1349,7 @@ void Cast::doCast(int param1) {
 	_vm->freeCells();
 	_vm->_oldRects.clear();
 	_vm->_newRects.clear();
-	_vm->_numAnimTimers = 0;
+	_vm->_animation->clearTimers();
 	_vm->_images.clear();
 	screen.forceFadeOut();
 
diff --git a/engines/access/animation.h b/engines/access/animation.h
index f0e3392fd3a..5b1aafb49e1 100644
--- a/engines/access/animation.h
+++ b/engines/access/animation.h
@@ -68,6 +68,11 @@ public:
 	 * Update the timing of all currently active animation
 	 */
 	void updateTimers();
+
+	/**
+	 * Remove the last animation timer
+	 */
+	void popBackTimer() { _animationTimers.pop_back(); }
 };
 
 class AnimationResource {
diff --git a/engines/access/martian/martian_game.cpp b/engines/access/martian/martian_game.cpp
index 4270c44abd0..7e1a89a5f1b 100644
--- a/engines/access/martian/martian_game.cpp
+++ b/engines/access/martian/martian_game.cpp
@@ -32,12 +32,12 @@ namespace Martian {
 
 MartianEngine::MartianEngine(OSystem *syst, const AccessGameDescription *gameDesc) :
 AccessEngine(syst, gameDesc), _skipStart(false), _introObjects(nullptr),
-_creditsStream(nullptr), _spec7Objects(nullptr)
+_creditsStream(nullptr)
 {
 }
 
 MartianEngine::~MartianEngine() {
-	_introObjects = _spec7Objects = nullptr;
+	_introObjects = nullptr;
 	_skipStart = false;
 	_creditsStream = nullptr;
 }
@@ -67,7 +67,7 @@ void MartianEngine::initVariables() {
 	_room->_selectCommand = -1;
 	_events->setNormalCursor(CURSOR_CROSSHAIRS);
 	_mouseMode = 0;
-	_numAnimTimers = 0;
+	_animation->clearTimers();
 
 	ARRAYCLEAR(_travel);
 	_travel[7] = 1;
diff --git a/engines/access/martian/martian_game.h b/engines/access/martian/martian_game.h
index 1111fae53e1..d31a12d71f6 100644
--- a/engines/access/martian/martian_game.h
+++ b/engines/access/martian/martian_game.h
@@ -61,8 +61,6 @@ protected:
 	void setNoteParams();
 	void displayNote(const Common::String &msg);
 public:
-	SpriteResource *_spec7Objects;
-
 	MartianEngine(OSystem *syst, const AccessGameDescription *gameDesc);
 	~MartianEngine() override;
 
diff --git a/engines/access/room.cpp b/engines/access/room.cpp
index dbaf91affa6..10b06666207 100644
--- a/engines/access/room.cpp
+++ b/engines/access/room.cpp
@@ -166,8 +166,7 @@ void Room::doRoom() {
 			_vm->_images.clear();
 			_vm->_newRects.clear();
 			_vm->_oldRects.clear();
-			_vm->_numAnimTimers = 0;
-
+			_vm->_animation->clearTimers();
 			reloadRoom();
 		}
 
@@ -266,7 +265,7 @@ void Room::doRoom() {
 }
 
 void Room::roomInit() {
-	_vm->_numAnimTimers = 0;
+	_vm->_animation->clearTimers();
 	_vm->_scripts->_sequence = INIT_ROOM_SCRIPT;
 	_vm->_scripts->searchForSequence();
 	_vm->_scripts->executeScript();
@@ -279,7 +278,7 @@ void Room::clearRoom() {
 	}
 
 	_vm->_sound->freeSounds();
-	_vm->_numAnimTimers = 0;
+	_vm->_animation->clearTimers();
 
 	_vm->_animation->freeAnimationData();
 	_vm->_scripts->freeScriptData();
diff --git a/engines/access/scripts.cpp b/engines/access/scripts.cpp
index fd089ab7bac..1866200b1e7 100644
--- a/engines/access/scripts.cpp
+++ b/engines/access/scripts.cpp
@@ -805,7 +805,7 @@ void Scripts::cmdPlayBufVid() {
 
 void Scripts::cmdRemoveLast() {
 	debugC(1, kDebugScripts, "cmdRemoveLast()");
-	--_vm->_numAnimTimers;
+	_vm->_animation->popBackTimer();
 }
 
 void Scripts::cmdDoTravel() {
diff --git a/engines/access/sound.h b/engines/access/sound.h
index 02920f76fcd..f2722d0bef3 100644
--- a/engines/access/sound.h
+++ b/engines/access/sound.h
@@ -94,7 +94,7 @@ private:
 
 public:
 	Resource *_music;
-	bool _byte1F781;
+	bool _byte1F781; // Maybe repeat flag?
 
 public:
 	MusicManager(AccessEngine *vm);


Commit: bf34b0b660dbdc77bb5b78297f0f92589cc5e4e0
    https://github.com/scummvm/scummvm/commit/bf34b0b660dbdc77bb5b78297f0f92589cc5e4e0
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Allow arrows to navigate list boxes

Changed paths:
    engines/access/bubble_box.cpp


diff --git a/engines/access/bubble_box.cpp b/engines/access/bubble_box.cpp
index 445aafa5c5b..4f1fb39eca3 100644
--- a/engines/access/bubble_box.cpp
+++ b/engines/access/bubble_box.cpp
@@ -675,16 +675,19 @@ int BubbleBox::doBox_v1(int item, int box, int &btnSelected) {
 
 	while (!_vm->shouldQuit()) {
 		_vm->_events->pollEvents();
-		if (!_vm->_events->_leftButton && !_vm->_events->_wheelDown && !_vm->_events->_wheelUp)
+		if (!_vm->_events->_leftButton && !_vm->_events->_wheelDown && !_vm->_events->_wheelUp && !_vm->_events->isKeyActionPending())
 			continue;
 
 		//
-		// Slight enhancement from original - also allow mouse wheel events to scroll up/down.
+		// Slight enhancement from original - we also allow mouse wheel and
+		// keyboard events to scroll up/down.
 		//
-
 		if (((_type == TYPE_1) || (_type == TYPE_3)) && (_vm->_timers[2]._flag == 0)) {
 			++_vm->_timers[2]._flag;
-			if (_btnUpPos.contains(_vm->_events->_mousePos) || _vm->_events->_wheelUp) {
+
+			Common::CustomEventType action = kActionNone;
+			_vm->_events->getAction(action);
+			if (_btnUpPos.contains(_vm->_events->_mousePos) || _vm->_events->_wheelUp || action == kActionMoveUp) {
 				if (_vm->_bcnt) {
 					if (_vm->_boxSelectY != 0) {
 						--_vm->_boxSelectY;
@@ -696,7 +699,7 @@ int BubbleBox::doBox_v1(int item, int box, int &btnSelected) {
 					}
 				}
 				continue;
-			} else if (_btnDownPos.contains(_vm->_events->_mousePos) || _vm->_events->_wheelDown) {
+			} else if (_btnDownPos.contains(_vm->_events->_mousePos) || _vm->_events->_wheelDown || action == kActionMoveDown) {
 				if (_vm->_bcnt) {
 					if (_vm->_bcnt == _vm->_numLines) {
 						if (_vm->_bcnt != _vm->_boxSelectY + 1) {


Commit: 573b5f522939bec9369e81c80d7251ef074dd340
    https://github.com/scummvm/scummvm/commit/573b5f522939bec9369e81c80d7251ef074dd340
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Update keymapper config for MM actions

Also add a hotkey for save/load menu action, and only allow it during regular
room loop.  This should ensure consistent save states.

Changed paths:
    engines/access/access.h
    engines/access/metaengine.cpp
    engines/access/room.cpp


diff --git a/engines/access/access.h b/engines/access/access.h
index 8f03a97235b..a58204fdcdc 100644
--- a/engines/access/access.h
+++ b/engines/access/access.h
@@ -86,7 +86,11 @@ enum ACCESSActions {
 	kActionTalk,
 	kActionWalk,
 	kActionHelp,
+	kActionOpen,
+	kActionMove,
+	kActionTravel,
 	kActionSkip,
+	kActionSaveLoad,
 };
 
 struct AccessActionCode {
@@ -94,7 +98,7 @@ struct AccessActionCode {
 	int8 _code;
 };
 
-static const AccessActionCode _accessActionCodes[] = {
+static const AccessActionCode AMAZON_ACTION_CODES[] = {
 	{ kActionLook, 1 },
 	{ kActionUse, 2 },
 	{ kActionTake, 3 },
@@ -103,6 +107,22 @@ static const AccessActionCode _accessActionCodes[] = {
 	{ kActionTalk, 6 },
 	{ kActionWalk, 7 },
 	{ kActionHelp, 8 },
+	{ kActionSaveLoad, -2 },
+	{ kActionNone, -1 },
+};
+
+static const AccessActionCode MARTIAN_ACTION_CODES[] = {
+	{ kActionLook, 0 },
+	{ kActionOpen, 1 },
+	{ kActionMove, 2 },
+	{ kActionTake, 3 },
+	{ kActionUse, 4 },
+	{ kActionWalk, 5 },
+	{ kActionTalk, 6 },
+	{ kActionTravel, 7 },
+	{ kActionHelp, 8 },
+	{ kActionSaveLoad, -2 },
+	{ kActionNone, -1 },
 };
 
 #define ACCESS_SAVEGAME_VERSION 1
diff --git a/engines/access/metaengine.cpp b/engines/access/metaengine.cpp
index eaf1f0f9752..0f8da2988f2 100644
--- a/engines/access/metaengine.cpp
+++ b/engines/access/metaengine.cpp
@@ -189,6 +189,12 @@ Common::KeymapArray AccessMetaEngine::initKeymaps(const char *target) const {
 	using namespace Common;
 	using namespace Access;
 
+	// Get the game ID for the target
+	const Common::String currDomain = ConfMan.getActiveDomainName();
+	ConfMan.setActiveDomain(target);
+	const Common::String gameId = ConfMan.get("gameid");
+	ConfMan.setActiveDomain(currDomain);
+
 	Keymap *engineKeyMap = new Keymap(Keymap::kKeymapTypeGame, "access-default", _("Default keymappings"));
 
 	Action *act;
@@ -262,44 +268,88 @@ Common::KeymapArray AccessMetaEngine::initKeymaps(const char *target) const {
 	act = new Action("LOOK", _("Look"));
 	act->setCustomEngineActionEvent(kActionLook);
 	act->addDefaultInputMapping("F1");
-	act->addDefaultInputMapping("F2");
-	engineKeyMap->addAction(act);
-
-	act = new Action("USE", _("Use"));
-	act->setCustomEngineActionEvent(kActionUse);
-	act->addDefaultInputMapping("F3");
-	engineKeyMap->addAction(act);
-
-	act = new Action("TAKE", _("Take"));
-	act->setCustomEngineActionEvent(kActionTake);
-	act->addDefaultInputMapping("F4");
-	engineKeyMap->addAction(act);
-
-	act = new Action("INVENTORY", _("Inventory"));
-	act->setCustomEngineActionEvent(kActionInventory);
-	act->addDefaultInputMapping("F5");
+	if (strcmp(target, "amazon") == 0)
+		act->addDefaultInputMapping("F2");
 	engineKeyMap->addAction(act);
 
-	act = new Action("CLIMB", _("Climb"));
-	act->setCustomEngineActionEvent(kActionClimb);
-	act->addDefaultInputMapping("F6");
-	engineKeyMap->addAction(act);
-
-	act = new Action("TALK", _("Talk"));
-	act->setCustomEngineActionEvent(kActionTalk);
-	act->addDefaultInputMapping("F7");
-	engineKeyMap->addAction(act);
-
-	act = new Action("WALK", _("Walk"));
-	act->setCustomEngineActionEvent(kActionWalk);
-	act->addDefaultInputMapping("F8");
-	engineKeyMap->addAction(act);
+	if (gameId.equals("martian")) {
+		act = new Action("OPEN", _("Open"));
+		act->setCustomEngineActionEvent(kActionOpen);
+		act->addDefaultInputMapping("F2");
+		engineKeyMap->addAction(act);
+
+		act = new Action("MOVE", _("Move"));
+		act->setCustomEngineActionEvent(kActionMove);
+		act->addDefaultInputMapping("F3");
+		engineKeyMap->addAction(act);
+
+		act = new Action("GET", _("Get"));
+		act->setCustomEngineActionEvent(kActionTake);
+		act->addDefaultInputMapping("F4");
+		engineKeyMap->addAction(act);
+
+		act = new Action("USE", _("Use"));
+		act->setCustomEngineActionEvent(kActionUse);
+		act->addDefaultInputMapping("F5");
+		engineKeyMap->addAction(act);
+
+		act = new Action("GOTO", _("Goto"));
+		act->setCustomEngineActionEvent(kActionWalk);
+		act->addDefaultInputMapping("F6");
+		engineKeyMap->addAction(act);
+
+		act = new Action("TALK", _("Talk"));
+		act->setCustomEngineActionEvent(kActionTalk);
+		act->addDefaultInputMapping("F7");
+		engineKeyMap->addAction(act);
+
+		act = new Action("TRAVEL", _("Travel"));
+		act->setCustomEngineActionEvent(kActionTravel);
+		act->addDefaultInputMapping("F8");
+		engineKeyMap->addAction(act);
+	} else {
+		// Amazon keymaps
+		act = new Action("USE", _("Use"));
+		act->setCustomEngineActionEvent(kActionUse);
+		act->addDefaultInputMapping("F3");
+		engineKeyMap->addAction(act);
+
+		act = new Action("TAKE", _("Take"));
+		act->setCustomEngineActionEvent(kActionTake);
+		act->addDefaultInputMapping("F4");
+		engineKeyMap->addAction(act);
+
+		act = new Action("INVENTORY", _("Inventory"));
+		act->setCustomEngineActionEvent(kActionInventory);
+		act->addDefaultInputMapping("F5");
+		engineKeyMap->addAction(act);
+
+		act = new Action("CLIMB", _("Climb"));
+		act->setCustomEngineActionEvent(kActionClimb);
+		act->addDefaultInputMapping("F6");
+		engineKeyMap->addAction(act);
+
+		act = new Action("TALK", _("Talk"));
+		act->setCustomEngineActionEvent(kActionTalk);
+		act->addDefaultInputMapping("F7");
+		engineKeyMap->addAction(act);
+
+		act = new Action("WALK", _("Walk"));
+		act->setCustomEngineActionEvent(kActionWalk);
+		act->addDefaultInputMapping("F8");
+		engineKeyMap->addAction(act);
+	}
 
 	act = new Action("HELP", _("Help"));
 	act->setCustomEngineActionEvent(kActionHelp);
 	act->addDefaultInputMapping("F9");
 	engineKeyMap->addAction(act);
 
+	act = new Action("SAVELOAD", _("Open save/load menu"));
+	act->setCustomEngineActionEvent(kActionSaveLoad);
+	act->addDefaultInputMapping("F10");
+	engineKeyMap->addAction(act);
+
 	return Keymap::arrayOf(engineKeyMap);
 }
 
diff --git a/engines/access/room.cpp b/engines/access/room.cpp
index 10b06666207..a2d1b59f4c8 100644
--- a/engines/access/room.cpp
+++ b/engines/access/room.cpp
@@ -196,7 +196,9 @@ void Room::doRoom() {
 				_vm->_player->checkScroll();
 			}
 
+			_vm->_canSaveLoad = true;
 			doCommands();
+			_vm->_canSaveLoad = false;
 			if (_vm->shouldQuitOrRestart())
 				return;
 
@@ -592,9 +594,10 @@ void Room::doCommands() {
 			mainAreaClick();
 		}
 	} else if (_vm->_events->getAction(action)) {
-		for (int i = 0; i < ARRAYSIZE(_accessActionCodes); ++i) {
-			if (_accessActionCodes[i]._action == action) {
-				handleCommand(_accessActionCodes[i]._code);
+		const AccessActionCode *actionCodes = (_vm->getGameID() == kGameMartianMemorandum) ? MARTIAN_ACTION_CODES : AMAZON_ACTION_CODES;
+		for (int i = 0; actionCodes[i]._action != kActionNone; ++i) {
+			if (actionCodes[i]._action == action) {
+				handleCommand(actionCodes[i]._code);
 				break;
 			}
 		}
@@ -616,12 +619,16 @@ void Room::cycleCommand(int incr) {
 }
 
 void Room::handleCommand(int commandId) {
-	if (commandId == 9) {
+	if (commandId == -2) {
+		// Save-load button event from keymapper.  Only open if allowed at the moment.
+		if (_vm->_canSaveLoad)
+			_vm->openMainMenuDialog();
+	} else if (commandId == 9) {
 		_vm->_events->debounceLeft();
 		_vm->_canSaveLoad = true;
 		_vm->openMainMenuDialog();
 		_vm->_canSaveLoad = false;
-	}  else if (commandId == _selectCommand) {
+	} else if (commandId == _selectCommand) {
 		_vm->_events->debounceLeft();
 		commandOff();
 	} else {


Commit: 790dc5859f157117d03e206e1b96db223337ade0
    https://github.com/scummvm/scummvm/commit/790dc5859f157117d03e206e1b96db223337ade0
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Add support for MM midi format

Changed paths:
  A engines/access/martian/midiparser_bemd.cpp
  A engines/access/martian/midiparser_bemd.h
    engines/access/module.mk
    engines/access/sound.cpp


diff --git a/engines/access/martian/midiparser_bemd.cpp b/engines/access/martian/midiparser_bemd.cpp
new file mode 100644
index 00000000000..458d7b16adc
--- /dev/null
+++ b/engines/access/martian/midiparser_bemd.cpp
@@ -0,0 +1,185 @@
+/* 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 "access/martian/midiparser_bemd.h"
+
+#include "audio/mididrv.h"
+#include "audio/midiparser.h"
+#include "common/textconsole.h"
+#include "common/util.h"
+#include "common/file.h"
+
+namespace Access {
+
+MidiParser_BEmd::MidiParser_BEmd(): _tickData(nullptr), _tickDataEnd(nullptr), _trackDataEnd(nullptr) {
+}
+
+bool MidiParser_BEmd::loadMusic(byte *data, uint32 size) {
+	unloadMusic();
+	const byte *pos = data;
+
+	if (!memcmp(pos, "BEmd", 4)) {
+		pos += 4;
+		if (size <= 16)
+			error("Wrong BEmd music resource size");
+
+		/*uint16 unk1 = */ READ_LE_UINT16(pos);  // Normally 0xC0.. tempo?
+		uint16 secondBlockOffset = READ_LE_UINT16(pos + 2);
+		if (secondBlockOffset < 16 || secondBlockOffset >= size)
+			error("Bad second block offset in BEmd file");
+		uint16 secondBlockSize = READ_LE_UINT16(pos + 4);
+		if (secondBlockOffset + secondBlockSize != size)
+			error("Bad second block offset+size in BEmd file");
+
+		_trackDataEnd = data + secondBlockOffset;
+		_tickData = _trackDataEnd;
+		_tickDataEnd = data + size;
+
+		// Only one track
+		_numTracks = 1;
+		_numSubtracks[0] = 1;
+		_autoLoop = false;
+		_ppqn = 1;
+		_tracks[0][0] = data + 16;
+
+		resetTracking();
+		setTempo(16667);
+		setTrack(0);
+		return true;
+	} else {
+		warning("Expected BEmd header but found '%c%c%c%c' instead", pos[0], pos[1], pos[2], pos[3]);
+		return false;
+	}
+
+	return false;
+}
+
+
+void MidiParser_BEmd::parseNextEvent(EventInfo &info) {
+	uint8 subtrack = info.subtrack;
+	byte *playPos = _position._subtracks[subtrack]._playPos;
+	info.start = playPos;
+
+	info.delta = 0;
+
+	// Process the next info.
+	if ((playPos[0] & 0xF0) >= 0x80)
+		info.event = *(playPos++);
+	else
+		info.event = _position._subtracks[subtrack]._runningStatus;
+	if (info.event < 0x80) {
+		_position._subtracks[subtrack]._playPos = playPos;
+		return;
+	}
+
+	_position._subtracks[subtrack]._runningStatus = info.event;
+	switch (info.command()) {
+	case 0x9: // Note On
+		info.basic.param1 = *(playPos++);
+		info.basic.param2 = *(playPos++);
+		if (info.basic.param2 == 0)
+			info.event = info.channel() | 0x80;
+		info.length = 0;
+		break;
+
+	case 0xC:
+	case 0xD:
+		info.basic.param1 = *(playPos++);
+		info.basic.param2 = 0;
+		break;
+
+	case 0x8:
+	case 0xA:
+	case 0xB:
+	case 0xE:
+		info.basic.param1 = *(playPos++);
+		info.basic.param2 = *(playPos++);
+		info.length = 0;
+		break;
+
+	case 0xF:
+		switch (info.event & 0x0F) {
+		case 0x2: // Song Position Pointer
+			info.basic.param1 = *(playPos++);
+			info.basic.param2 = *(playPos++);
+			break;
+
+		case 0x3: // Song Select
+			info.basic.param1 = *(playPos++);
+			info.basic.param2 = 0;
+			break;
+
+		case 0x8: // Timing data
+			// Tick data is stored separately.
+			info.delta = READ_LE_UINT16(_tickData);
+			_tickData += 2;
+			// FALL THROUGH
+		case 0x6:
+		case 0xA:
+		case 0xB:
+		case 0xC:
+		case 0xE:
+			info.basic.param1 = info.basic.param2 = 0;
+			break;
+
+		case 0x0: // SysEx
+			error("MidiParser_BEmd::parseNextEvent: Unexpected SysEx event");
+			break;
+
+		case 0xF: // META event
+			info.ext.type = *(playPos++);
+			if (info.ext.type == 0x51) {
+				// Set Tempo - 2 bytes and interpreted as direct input for the PIT
+				// as ticks to next note (0.8381uS/tick)
+				setTempo(READ_LE_UINT16(playPos) * 0.8381);
+			}
+			info.length = (info.ext.type == 0x2f ? 0 : 2);
+			info.ext.data = playPos;
+			playPos += info.length;
+			break;
+
+		default:
+			error("MidiParser_BEmd::parseNextEvent: Unsupported event code %x", info.event);
+			break;
+		}
+
+	default:
+		break;
+	}
+
+	_position._subtracks[subtrack]._playPos = playPos;
+
+	assert(playPos < _trackDataEnd);
+	assert(_tickData < _tickDataEnd);
+}
+
+bool MidiParser_BEmd::processEvent(const EventInfo &info, bool fireEvents) {
+	// Ignore timer events we handled already.
+	if ((info.event == 0xF8) || (info.event == 0xFF && info.ext.type == 0x51))
+		return true;
+	return MidiParser::processEvent(info, fireEvents);
+}
+
+void MidiParser_BEmd::resetTracking() {
+	_tickData = _trackDataEnd;
+}
+
+} // end namespace Access
diff --git a/engines/access/martian/midiparser_bemd.h b/engines/access/martian/midiparser_bemd.h
new file mode 100644
index 00000000000..8e032005770
--- /dev/null
+++ b/engines/access/martian/midiparser_bemd.h
@@ -0,0 +1,49 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ACCESS_MARTIAN_MIDI_PARSER_BEMD_H
+#define ACCESS_MARTIAN_MIDI_PARSER_BEMD_H
+
+#include "audio/midiparser.h"
+
+namespace Access {
+
+class MidiParser_BEmd : public MidiParser {
+public:
+	MidiParser_BEmd();
+
+	bool loadMusic(byte *data, uint32 size) override;
+
+protected:
+	void parseNextEvent(EventInfo &info) override;
+	bool processEvent(const EventInfo &info, bool fireEvents) override;
+	void resetTracking() override;
+
+private:
+	const byte *_trackDataEnd;
+	const byte *_tickData;
+	const byte *_tickDataEnd;
+
+};
+
+} // end namespace Access
+
+#endif // ACCESS_MARTIAN_MIDI_PARSER_BEMD_H
diff --git a/engines/access/module.mk b/engines/access/module.mk
index 29a45a333a6..6e26737b96a 100644
--- a/engines/access/module.mk
+++ b/engines/access/module.mk
@@ -31,9 +31,10 @@ MODULE_OBJS := \
 	martian/martian_player.o \
 	martian/martian_resources.o \
 	martian/martian_tunnel.o \
-	video/movie_decoder.o \
 	martian/martian_room.o \
-	martian/martian_scripts.o
+	martian/martian_scripts.o \
+	martian/midiparser_bemd.o \
+	video/movie_decoder.o
 
 # This module can be built as a plugin
 ifeq ($(ENABLE_ACCESS), DYNAMIC_PLUGIN)
diff --git a/engines/access/sound.cpp b/engines/access/sound.cpp
index 39895f0c8d3..367523e7efd 100644
--- a/engines/access/sound.cpp
+++ b/engines/access/sound.cpp
@@ -31,6 +31,8 @@
 #include "access/access.h"
 #include "access/sound.h"
 
+#include "access/martian/midiparser_bemd.h"
+
 namespace Access {
 
 SoundManager::SoundManager(AccessEngine *vm, Audio::Mixer *mixer) : _vm(vm), _mixer(mixer) {
@@ -308,23 +310,17 @@ void MusicManager::midiPlay() {
 	if (magic == MKTAG('B', 'E', 'm', 'd')) {
 		warning("TODO: Implement Martian Memorandum style MIDI parsing");
 		_isPlaying = false;
+		_parser = new MidiParser_BEmd();
+
+		if (!_parser->loadMusic(_music->data(), _music->_size))
+			error("midiPlay() couldn't load music resource");
 
-		if (_music->_size <= 16)
-			error("midiPlay() wrong BEmd music resource size");
-
-		/*uint16 unk1 = */ READ_LE_UINT32(_music->data() + 4);  // Normally 0xC0?
-		uint16 secondBlockOffset = READ_LE_UINT16(_music->data() + 6);
-		if (secondBlockOffset < 16 || secondBlockOffset >= _music->_size)
-			error("midiPlay() bad second block offset in BEmd file");
-		/*uint16 unk2 =*/ READ_LE_UINT16(_music->data() + 8);
-		//byte *midiDataBlock1 = _music->data() + 16;
-		//byte *midiDataBlock2 = _music->data() + secondBlockOffset;
-		/*
-		Common::DumpFile dumpfile;
-		dumpfile.open("/tmp/access_music_dump.bin");
-		dumpfile.write(_music->data(), _music->_size);
-		dumpfile.close();
-		*/
+		_parser->setTrack(0);
+		_parser->setMidiDriver(this);
+		_parser->setTimerRate(_driver->getBaseTempo());
+		_parser->property(MidiParser::mpAutoLoop, _isLooping);
+		setVolume(127);
+		_isPlaying = true;
 	} else if (magic == MKTAG('F', 'O', 'R', 'M')) {
 		_parser = MidiParser::createParser_XMIDI();
 


Commit: 3cb81720f9e1f58402ef3a97dc08e20126a763f6
    https://github.com/scummvm/scummvm/commit/3cb81720f9e1f58402ef3a97dc08e20126a763f6
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Fix Tex Y offset in various MM scenes

Changed paths:
    engines/access/martian/martian_player.cpp
    engines/access/player.cpp


diff --git a/engines/access/martian/martian_player.cpp b/engines/access/martian/martian_player.cpp
index 64c44886af7..28fcdccd8a3 100644
--- a/engines/access/martian/martian_player.cpp
+++ b/engines/access/martian/martian_player.cpp
@@ -39,7 +39,7 @@ void MartianPlayer::load() {
 
 	// Overwrite game-specific values
 	_playerOffset.x = _vm->_screen->_scaleTable1[20];
-	_playerOffset.y = _vm->_screen->_scaleTable1[52];
+	_playerOffset.y = _vm->_screen->_scaleTable1[62];
 	_leftDelta = -9;
 	_rightDelta = 33;
 	_upDelta = 5;
diff --git a/engines/access/player.cpp b/engines/access/player.cpp
index 2210e1f3626..4f72b89543e 100644
--- a/engines/access/player.cpp
+++ b/engines/access/player.cpp
@@ -109,6 +109,8 @@ void Player::load() {
 	_walkOffUL = new Common::Point[dataCount];
 	_walkOffDL = new Common::Point[dataCount];
 
+	// NOTE: Although the values get set here to Amazon defaults, they are overridden
+	// in both AmazonPlayer and MartianPlayer load() functions.
 	_playerOffset.x = _vm->_screen->_scaleTable1[25];
 	_playerOffset.y = _vm->_screen->_scaleTable1[67];
 	_leftDelta = -3;
@@ -189,7 +191,7 @@ void Player::calcManScale() {
 		_vm->_screen->setScaleTable(_vm->_scale);
 
 		_playerOffset.x = _vm->_screen->_scaleTable1[20];
-		_playerOffset.y = _vm->_screen->_scaleTable1[67];
+		_playerOffset.y = _vm->_screen->_scaleTable1[(_vm->getGameID() == kGameMartianMemorandum) ? 62 : 67];
 		_inactiveYOff = _playerOffset.y;
 	}
 }


Commit: 9dce3991c47659706e954c900a2cf99688b1ba3c
    https://github.com/scummvm/scummvm/commit/9dce3991c47659706e954c900a2cf99688b1ba3c
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Small midi parsing fixes

Changed paths:
    engines/access/martian/midiparser_bemd.cpp
    engines/access/sound.cpp


diff --git a/engines/access/martian/midiparser_bemd.cpp b/engines/access/martian/midiparser_bemd.cpp
index 458d7b16adc..e116595e24f 100644
--- a/engines/access/martian/midiparser_bemd.cpp
+++ b/engines/access/martian/midiparser_bemd.cpp
@@ -36,12 +36,33 @@ bool MidiParser_BEmd::loadMusic(byte *data, uint32 size) {
 	unloadMusic();
 	const byte *pos = data;
 
+	//
+	// 'BEmd' MIDI format from Martian Memorandum.
+	//
+	// A simple single-track format that splits note and timing data.
+	//
+	// Header is:
+	//     'BEmd' (magic number)
+	//     0xC0 0x00 (unknown, always 0xC0?
+	//     16-bit offset to timing data block
+	//     16-bit size of timing data block
+	//     6 bytes unk (normally 0)
+	// Header is followed by the track data block, then timing delta data
+	// block.
+	//
+	// Track data mostly follows other MIDI formats with a few differences:
+	//  * Fixed length arguments
+	//  * 0xFF 0x51 (tempo meta event) is followed by a uint16 which is fed
+	//      directly to the PIT as a delay
+	//  * Deltas are assumed to be 0. On 0xF8, a 16 bit int is read from
+	//      the timing block and sent to the PIT as a timing delay.
+	//
 	if (!memcmp(pos, "BEmd", 4)) {
 		pos += 4;
 		if (size <= 16)
 			error("Wrong BEmd music resource size");
 
-		/*uint16 unk1 = */ READ_LE_UINT16(pos);  // Normally 0xC0.. tempo?
+		/*uint16 unk1 = */ READ_LE_UINT16(pos);  // Normally 0xC0?
 		uint16 secondBlockOffset = READ_LE_UINT16(pos + 2);
 		if (secondBlockOffset < 16 || secondBlockOffset >= size)
 			error("Bad second block offset in BEmd file");
@@ -180,6 +201,7 @@ bool MidiParser_BEmd::processEvent(const EventInfo &info, bool fireEvents) {
 
 void MidiParser_BEmd::resetTracking() {
 	_tickData = _trackDataEnd;
+	MidiParser::resetTracking();
 }
 
 } // end namespace Access
diff --git a/engines/access/sound.cpp b/engines/access/sound.cpp
index 367523e7efd..379b34ae89f 100644
--- a/engines/access/sound.cpp
+++ b/engines/access/sound.cpp
@@ -308,8 +308,6 @@ void MusicManager::midiPlay() {
 
 	uint32 magic = READ_BE_UINT32(_music->data());
 	if (magic == MKTAG('B', 'E', 'm', 'd')) {
-		warning("TODO: Implement Martian Memorandum style MIDI parsing");
-		_isPlaying = false;
 		_parser = new MidiParser_BEmd();
 
 		if (!_parser->loadMusic(_music->data(), _music->_size))


Commit: 69a6292917969ec29a1b0b33d43223e79ca77748
    https://github.com/scummvm/scummvm/commit/69a6292917969ec29a1b0b33d43223e79ca77748
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Fix TODO and leak - use same sprite storage as original for credits

Changed paths:
    engines/access/martian/martian_game.cpp
    engines/access/martian/martian_game.h


diff --git a/engines/access/martian/martian_game.cpp b/engines/access/martian/martian_game.cpp
index 7e1a89a5f1b..8df0105e68f 100644
--- a/engines/access/martian/martian_game.cpp
+++ b/engines/access/martian/martian_game.cpp
@@ -31,13 +31,12 @@ namespace Access {
 namespace Martian {
 
 MartianEngine::MartianEngine(OSystem *syst, const AccessGameDescription *gameDesc) :
-AccessEngine(syst, gameDesc), _skipStart(false), _introObjects(nullptr),
+AccessEngine(syst, gameDesc), _skipStart(false),
 _creditsStream(nullptr)
 {
 }
 
 MartianEngine::~MartianEngine() {
-	_introObjects = nullptr;
 	_skipStart = false;
 	_creditsStream = nullptr;
 }
@@ -208,7 +207,7 @@ bool MartianEngine::showCredits() {
 	while (posX != -1) {
 		posY = _creditsStream->readSint16LE();
 		int frameNum = _creditsStream->readSint16LE();
-		_screen->plotImage(_introObjects, frameNum, Common::Point(posX, posY));
+		_screen->plotImage(_objectsTable[41], frameNum, Common::Point(posX, posY));
 
 		posX = _creditsStream->readSint16LE();
 	}
@@ -244,7 +243,7 @@ void MartianEngine::doCredits() {
 	_events->hideCursor();
 	_screen->forceFadeOut();
 	Resource *data = _files->loadFile(41, 1);
-	_introObjects = new SpriteResource(this, data);
+	_objectsTable[41] = new SpriteResource(this, data);
 	delete data;
 
 	_files->loadScreen(41, 0);
@@ -265,7 +264,8 @@ void MartianEngine::doCredits() {
 		while (!shouldQuit() && !_events->isKeyActionMousePressed()&& !showCredits())
 			_events->pollEventsAndWait();
 
-		warning("TODO: Free word_21E2B (roomSprites+54h)");
+		delete _objectsTable[41];
+		_objectsTable[41] = nullptr;
 		_midi->freeMusic();
 	}
 }
diff --git a/engines/access/martian/martian_game.h b/engines/access/martian/martian_game.h
index d31a12d71f6..d93ca463499 100644
--- a/engines/access/martian/martian_game.h
+++ b/engines/access/martian/martian_game.h
@@ -31,7 +31,6 @@ namespace Martian {
 class MartianEngine : public AccessEngine {
 private:
 	bool _skipStart;
-	SpriteResource *_introObjects;
 	Common::MemoryReadStream *_creditsStream;
 
 	/**


Commit: a7b52e5d9c61bd6363fdd6699f0fc63823d1051b
    https://github.com/scummvm/scummvm/commit/a7b52e5d9c61bd6363fdd6699f0fc63823d1051b
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Update for new midiparser interface

Changed paths:
    engines/access/martian/midiparser_bemd.cpp
    engines/access/martian/midiparser_bemd.h


diff --git a/engines/access/martian/midiparser_bemd.cpp b/engines/access/martian/midiparser_bemd.cpp
index e116595e24f..ec0aac99828 100644
--- a/engines/access/martian/midiparser_bemd.cpp
+++ b/engines/access/martian/midiparser_bemd.cpp
@@ -32,7 +32,7 @@ namespace Access {
 MidiParser_BEmd::MidiParser_BEmd(): _tickData(nullptr), _tickDataEnd(nullptr), _trackDataEnd(nullptr) {
 }
 
-bool MidiParser_BEmd::loadMusic(byte *data, uint32 size) {
+bool MidiParser_BEmd::loadMusic(const byte *data, uint32 size) {
 	unloadMusic();
 	const byte *pos = data;
 
@@ -96,7 +96,7 @@ bool MidiParser_BEmd::loadMusic(byte *data, uint32 size) {
 
 void MidiParser_BEmd::parseNextEvent(EventInfo &info) {
 	uint8 subtrack = info.subtrack;
-	byte *playPos = _position._subtracks[subtrack]._playPos;
+	const byte *playPos = _position._subtracks[subtrack]._playPos;
 	info.start = playPos;
 
 	info.delta = 0;
diff --git a/engines/access/martian/midiparser_bemd.h b/engines/access/martian/midiparser_bemd.h
index 8e032005770..367cf094370 100644
--- a/engines/access/martian/midiparser_bemd.h
+++ b/engines/access/martian/midiparser_bemd.h
@@ -30,7 +30,7 @@ class MidiParser_BEmd : public MidiParser {
 public:
 	MidiParser_BEmd();
 
-	bool loadMusic(byte *data, uint32 size) override;
+	bool loadMusic(const byte *data, uint32 size) override;
 
 protected:
 	void parseNextEvent(EventInfo &info) override;


Commit: daf31978c36220d2d852dc083ebd6427ca300722
    https://github.com/scummvm/scummvm/commit/daf31978c36220d2d852dc083ebd6427ca300722
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Fix palette in and after MM abduction scene

Need to flash palette during the scene, and manually restore palette after the
scene.

Changed paths:
    engines/access/martian/martian_scripts.cpp
    engines/access/room.cpp
    engines/access/screen.cpp
    engines/access/screen.h


diff --git a/engines/access/martian/martian_scripts.cpp b/engines/access/martian/martian_scripts.cpp
index 95f778722ef..f36a852ff3a 100644
--- a/engines/access/martian/martian_scripts.cpp
+++ b/engines/access/martian/martian_scripts.cpp
@@ -92,7 +92,6 @@ void MartianScripts::cmdSpecial0() {
 	_vm->_events->showCursor();
 	_vm->_midi->stopSong();
 	_vm->_midi->freeMusic();
-	//warning("TODO: Pop Midi?");
 }
 
 void MartianScripts::cmdSpecial1(int param1, int param2) {
diff --git a/engines/access/room.cpp b/engines/access/room.cpp
index a2d1b59f4c8..b1a6e1bc8b7 100644
--- a/engines/access/room.cpp
+++ b/engines/access/room.cpp
@@ -211,6 +211,9 @@ void Room::doRoom() {
 				return;
 			} else if (_function == FN_RELOAD) {
 				reloadRoom1();
+				// WORKAROUND: This doesn't seem to restore the palette correctly?
+				// This is only ever used in the abduction scene (special 0)
+				_vm->_screen->setPalette();
 				reloadFlag = true;
 				break;
 			} else if (_function == FN_BREAK) {
diff --git a/engines/access/screen.cpp b/engines/access/screen.cpp
index 653d80c85d2..46b1e6b89c2 100644
--- a/engines/access/screen.cpp
+++ b/engines/access/screen.cpp
@@ -346,8 +346,22 @@ void Screen::cyclePaletteBackwards() {
 	}
 }
 
-void Screen::flashPalette(int count) {
-	// No implementation needed in ScummVM
+void Screen::flashPalette(int step) {
+	// Note: Original parameter is for 64-level palette
+	step *= 4;
+
+	for (int i = 0; i < Graphics::PALETTE_SIZE; ++i) {
+		_tempPalette[i] = (byte)MIN(_rawPalette[i] + step, 255);
+	}
+
+	updatePalette();
+	_vm->_events->pollEventsAndWait();
+
+	// Ensure at least 1 frame delay at 30FPS before resetting palette
+	// to ensure the effect is perceptible and matches original.
+	_vm->_events->delay(30);
+	setPalette();
+	_vm->_events->pollEventsAndWait();
 }
 
 void Screen::dump(const char *fname) const {
diff --git a/engines/access/screen.h b/engines/access/screen.h
index 7e5e94a6280..31341a862af 100644
--- a/engines/access/screen.h
+++ b/engines/access/screen.h
@@ -145,7 +145,7 @@ public:
 
 	void getPalette(byte *pal);
 
-	void flashPalette(int count);
+	void flashPalette(int step);
 
 	/**
 	 * Copy a buffer to the screen


Commit: 5b262b47b1ab147e7f892ce93dbeef4cf28773c6
    https://github.com/scummvm/scummvm/commit/5b262b47b1ab147e7f892ce93dbeef4cf28773c6
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-09-03T21:23:45+10:00

Commit Message:
ACCESS: Add small cleanups suggested by @bluegr

Comment and const changes

Changed paths:
    engines/access/access.cpp
    engines/access/access.h
    engines/access/bubble_box.cpp
    engines/access/screen.cpp
    engines/access/scripts.cpp


diff --git a/engines/access/access.cpp b/engines/access/access.cpp
index 974440f7491..3a62c708439 100644
--- a/engines/access/access.cpp
+++ b/engines/access/access.cpp
@@ -111,7 +111,6 @@ AccessEngine::AccessEngine(OSystem *syst, const AccessGameDescription *gameDesc)
 	_boxSelectY = 0;
 	_boxSelectYOld = -1;
 	_numLines = 0;
-	//_tempList = nullptr;
 	_pictureTaken = 0;
 
 	_vidEnd = false;
diff --git a/engines/access/access.h b/engines/access/access.h
index a58204fdcdc..5e337bc2cac 100644
--- a/engines/access/access.h
+++ b/engines/access/access.h
@@ -269,7 +269,6 @@ public:
 	int _numLines;
 	byte _byte26CB5;
 	int _bcnt;
-	//byte *_tempList;
 
 	bool _vidEnd;
 	bool _clearSummaryFlag;
diff --git a/engines/access/bubble_box.cpp b/engines/access/bubble_box.cpp
index 4f1fb39eca3..494570c3ce8 100644
--- a/engines/access/bubble_box.cpp
+++ b/engines/access/bubble_box.cpp
@@ -521,6 +521,7 @@ int BubbleBox::doBox_v1(int item, int box, int &btnSelected) {
 	if (_type != TYPE_2) {
 		// Draw the button background at the bottom
 		oldY = _vm->_screen->_orgY1;
+		// Original does this here, but we need bottom/right offset by 1.
 		//--_vm->_screen->_orgY2;
 		_vm->_screen->_orgY1 = _vm->_screen->_orgY2 - 8;
 		if (_type == TYPE_3)
diff --git a/engines/access/screen.cpp b/engines/access/screen.cpp
index 46b1e6b89c2..fbd799369d5 100644
--- a/engines/access/screen.cpp
+++ b/engines/access/screen.cpp
@@ -148,7 +148,7 @@ void Screen::loadPalette(int fileNum, int subfile, int srcOffset) {
 		for (int i = 0; i < _numColors * 3; i++)
 			_rawPalette[_startColor * 3 + i] = PALETTE_6BIT_TO_8BIT(palette[i]);
 	} else {
-		// TODO: is this right for Amaazon?  Surely it should be converted?  Maybe never used..
+		// TODO: is this right for Amazon?  Surely it should be converted?  Maybe never used..
 		Common::copy(palette, palette + (_numColors * 3), &_rawPalette[_startColor * 3]);
 	}
 	delete res;
@@ -366,7 +366,7 @@ void Screen::flashPalette(int step) {
 
 void Screen::dump(const char *fname) const {
 #ifdef DEBUG_FRAME_DUMP
-	/* For debugging, dump the frame contents.. */
+	// For debugging, dump the frame contents.
 	::Common::DumpFile outf;
 	uint32 now = g_system->getMillis();
 	outf.open(::Common::Path(::Common::String::format("/tmp/%07d-%s.png", now, fname)));
diff --git a/engines/access/scripts.cpp b/engines/access/scripts.cpp
index 1866200b1e7..6936157f84d 100644
--- a/engines/access/scripts.cpp
+++ b/engines/access/scripts.cpp
@@ -480,8 +480,8 @@ void Scripts::cmdCheckInventory() {
 }
 
 void Scripts::cmdSetTex() {
-	int xStart = _data->readSint16LE();
-	int yStart = _data->readSint16LE();
+	const int xStart = _data->readSint16LE();
+	const int yStart = _data->readSint16LE();
 	debugC(1, kDebugScripts, "cmdSetTex(xStart=%d, yStart=%d)", xStart, yStart);
 	_vm->_player->_playerDirection = RIGHT;
 	int posX = xStart - (_vm->_player->_playerOffset.x / 2);
@@ -768,7 +768,7 @@ void Scripts::cmdVideoEnded() {
 	debugCN(1, kDebugScripts, "cmdVideoEnded()");
 	_vm->_events->pollEventsAndWait();
 
-	// Slight HACK - add ability to skip unskippable videos.
+	// Slight enhancement over original - add ability to skip unskippable videos.
 	bool skipVideo = false;
 	Common::CustomEventType action;
 	if (_vm->_events->getAction(action) && action == kActionSkip) {




More information about the Scummvm-git-logs mailing list