[Scummvm-git-logs] scummvm master -> 1b427b3f57ba70e46772df73269075448f86bc56

neuromancer noreply at scummvm.org
Thu Jun 25 14:27:24 UTC 2026


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

Summary:
db7e4b0b88 SCUMM: RA2: fixed aiming animation in L2 for high resolution mode
a256dffbe5 SCUMM: RA1: fixed music cut in L2
1b427b3f57 SCUMM: RA1: correctly decode pixels on the X axis in smushDecodeRA1Transparent


Commit: db7e4b0b881f1addb22f70c0261878ef3c8a38ff
    https://github.com/scummvm/scummvm/commit/db7e4b0b881f1addb22f70c0261878ef3c8a38ff
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2026-06-25T15:04:38+02:00

Commit Message:
SCUMM: RA2: fixed aiming animation in L2 for high resolution mode

Changed paths:
    engines/scumm/insane/rebel2/iact.cpp
    engines/scumm/insane/rebel2/render.cpp


diff --git a/engines/scumm/insane/rebel2/iact.cpp b/engines/scumm/insane/rebel2/iact.cpp
index c4fcf762791..3e9b985f83e 100644
--- a/engines/scumm/insane/rebel2/iact.cpp
+++ b/engines/scumm/insane/rebel2/iact.cpp
@@ -543,13 +543,6 @@ void InsaneRebel2::handleOpcode6Handler8(Common::SeekableReadStream &b, int16 pa
 		int16 mouseX = aimPos.x;
 		int16 mouseY = aimPos.y;
 
-		if (_player && _player->_width > 320) {
-			mouseX = (mouseX * 320) / _player->_width;
-		}
-		if (_player && _player->_height > 200) {
-			mouseY = (mouseY * 200) / _player->_height;
-		}
-
 		// Horizontal: 5 zones (0=far left, 2=center, 4=far right)
 		if (mouseX < 64)
 			_shipDirectionH = 0;
@@ -933,9 +926,6 @@ void InsaneRebel2::handleOpcode6Handler25(byte *renderBitmap, Common::SeekableRe
 	if (_grdSpriteMode == 3) {
 		if (_rebelDamageLevel == 5) {
 			int16 mouseX = getGameplayAimPoint().x;
-			if (_player && _player->_width > 320) {
-				mouseX = (mouseX * 320) / _player->_width;
-			}
 			if (mouseX > 235) {  // 0x4b + 160 = 235
 				_rebelFlightDir = 1;
 			}
diff --git a/engines/scumm/insane/rebel2/render.cpp b/engines/scumm/insane/rebel2/render.cpp
index 9f4b8aaf6bb..5f4af086950 100644
--- a/engines/scumm/insane/rebel2/render.cpp
+++ b/engines/scumm/insane/rebel2/render.cpp
@@ -3433,10 +3433,6 @@ void InsaneRebel2::renderHandler25Ship(byte *renderBitmap, int pitch, int width,
 			Common::Point aimPos = getGameplayAimPoint();
 			int16 crosshairX = aimPos.x;
 			int16 crosshairY = aimPos.y;
-			if (_player && _player->_width > 320) {
-				crosshairX = (crosshairX * 320) / _player->_width;
-				crosshairY = (crosshairY * 200) / _player->_height;
-			}
 
 			int areaWidth = areaRight - areaLeft;
 			int areaHeight = areaBottom - areaTop;


Commit: a256dffbe5ffd5fd9c59c6f2806997ade80e52c5
    https://github.com/scummvm/scummvm/commit/a256dffbe5ffd5fd9c59c6f2806997ade80e52c5
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2026-06-25T15:31:21+02:00

Commit Message:
SCUMM: RA1: fixed music cut in L2

Changed paths:
    engines/scumm/smush/rebel/smush_player_ra1.cpp


diff --git a/engines/scumm/smush/rebel/smush_player_ra1.cpp b/engines/scumm/smush/rebel/smush_player_ra1.cpp
index 28ccee399fa..5d7cf83dc83 100644
--- a/engines/scumm/smush/rebel/smush_player_ra1.cpp
+++ b/engines/scumm/smush/rebel/smush_player_ra1.cpp
@@ -43,6 +43,8 @@ enum {
 	kRA1PresentationScreenHeight = 200,
 	kRA1PresentationWidth = kRA1PresentationScreenWidth - kRA1PresentationBorder * 2,
 	kRA1PresentationHeight = kRA1PresentationScreenHeight - kRA1PresentationBorder * 2,
+	// Original RA1 keeps SAUD streams this large on the dedicated long audio buffer.
+	kRA1LargeAudioTrackThreshold = 45000,
 	kRebel1LongAudioTrackSize = 500000
 };
 
@@ -727,12 +729,16 @@ static bool ra1ScanFrameGameChunks(Common::SeekableReadStream &b, int32 frameSiz
 	return hasGameChunk;
 }
 
-static int16 getRA1AudioChunkTypeFlags(uint32 subType) {
+static int16 getRA1AudioChunkTypeFlags(uint32 subType, const uint8 *payload, uint32 payloadSize, uint16 index) {
 	switch (subType) {
 	case MKTAG('P','V','O','C'):
 		return IS_SPEECH;
 	case MKTAG('P','S','A','D'):
-		return IS_BKG_MUSIC;
+		if (index == 0 && payload && payloadSize >= 8 && READ_BE_UINT32(payload) == MKTAG('S','A','U','D') &&
+				READ_BE_UINT32(payload + 4) >= kRA1LargeAudioTrackThreshold) {
+			return IS_BKG_MUSIC;
+		}
+		return IS_SFX;
 	case MKTAG('P','S','D','2'):
 	case MKTAG('S','A','U','D'):
 	default:
@@ -762,7 +768,6 @@ void SmushPlayerRebel1::ra1FeedAudio(uint32 subType, uint8 *srcBuf, int groupId,
 		return;
 
 	const uint32 chunkSize = READ_BE_UINT32(&srcBuf[4]);
-	const int16 typeFlags = getRA1AudioChunkTypeFlags(subType);
 
 	if (chunkSize >= 12 &&
 			srcBuf[8] == 0 && srcBuf[9] == 0 && srcBuf[12] == 0 &&
@@ -770,6 +775,7 @@ void SmushPlayerRebel1::ra1FeedAudio(uint32 subType, uint8 *srcBuf, int groupId,
 		const uint16 trkId = READ_BE_INT16(&srcBuf[10]);
 		const uint16 index = READ_BE_INT16(&srcBuf[14]);
 		const int32 maxFrames = READ_BE_INT16(&srcBuf[18]);
+		const int16 typeFlags = getRA1AudioChunkTypeFlags(subType, srcBuf + 20, chunkSize - 12, index);
 		flags = (flags & ~TRK_TYPE_MASK) | typeFlags;
 
 		handleSAUDChunk(
@@ -787,6 +793,7 @@ void SmushPlayerRebel1::ra1FeedAudio(uint32 subType, uint8 *srcBuf, int groupId,
 		const uint16 index = READ_LE_INT16(&srcBuf[10]);
 		const int32 maxFrames = READ_LE_INT16(&srcBuf[12]);
 		flags |= READ_LE_INT16(&srcBuf[14]);
+		const int16 typeFlags = getRA1AudioChunkTypeFlags(subType, srcBuf + 18, chunkSize - 10, index);
 		flags = (flags & ~TRK_TYPE_MASK) | typeFlags;
 		volume = (volume * srcBuf[16]) >> 7;
 


Commit: 1b427b3f57ba70e46772df73269075448f86bc56
    https://github.com/scummvm/scummvm/commit/1b427b3f57ba70e46772df73269075448f86bc56
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2026-06-25T16:17:39+02:00

Commit Message:
SCUMM: RA1: correctly decode pixels on the X axis in smushDecodeRA1Transparent

Changed paths:
    engines/scumm/smush/rebel/codec_ra1.cpp
    engines/scumm/smush/rebel/codec_ra1.h
    engines/scumm/smush/rebel/smush_player_ra1.cpp
    engines/scumm/smush/rebel/smush_player_ra1.h


diff --git a/engines/scumm/smush/rebel/codec_ra1.cpp b/engines/scumm/smush/rebel/codec_ra1.cpp
index a6ba915d1cc..1b2ab04b528 100644
--- a/engines/scumm/smush/rebel/codec_ra1.cpp
+++ b/engines/scumm/smush/rebel/codec_ra1.cpp
@@ -28,7 +28,8 @@
 namespace Scumm {
 
 // RLE with transparency on pixel 0.
-void smushDecodeRA1Transparent(byte *dst, const byte *src, int left, int top, int width, int height, int pitch, int dataSize) {
+void smushDecodeRA1Transparent(byte *dst, const byte *src, int left, int top, int width, int height,
+		int pitch, int dataSize, int sourceSkipX) {
 	if (dst == nullptr || src == nullptr || width <= 0 || height <= 0 || pitch <= 0 || dataSize <= 0)
 		return;
 
@@ -39,33 +40,53 @@ void smushDecodeRA1Transparent(byte *dst, const byte *src, int left, int top, in
 		const byte *lineData = src + 2;
 		const byte *lineEnd = lineData + MIN<int>(lineSize, srcEnd - lineData);
 		byte *rowDst = dst + left;
+		int skip = sourceSkipX;
 		int remaining = width;
 
-		while (remaining > 0 && lineData < lineEnd) {
+		while ((skip > 0 || remaining > 0) && lineData < lineEnd) {
 			byte code = *lineData++;
 			int num = (code >> 1) + 1;
-			if (num > remaining)
-				num = remaining;
 
 			if (code & 1) {
 				if (lineData >= lineEnd)
 					break;
 				byte color = *lineData++;
+
+				const int skipped = MIN(num, skip);
+				skip -= skipped;
+				num -= skipped;
+				if (num == 0)
+					continue;
+
+				const int count = MIN(num, remaining);
 				if (color != 0)
-					memset(rowDst, color, num);
+					memset(rowDst, color, count);
+				rowDst += count;
+				remaining -= count;
 			} else {
 				const int readable = MIN<int>(num, lineEnd - lineData);
-				for (int j = 0; j < readable; j++) {
+				const int skipped = MIN(num, skip);
+				const int skippedBytes = MIN(readable, skipped);
+				lineData += skippedBytes;
+				skip -= skipped;
+				if (skipped == num) {
+					if (readable < num)
+						break;
+					continue;
+				}
+
+				const int count = MIN<int>(readable - skippedBytes, remaining);
+				for (int j = 0; j < count; j++) {
 					byte c = lineData[j];
 					if (c != 0)
 						rowDst[j] = c;
 				}
-				lineData += readable;
+				lineData += count;
 				if (readable < num)
 					break;
+				rowDst += count;
+				remaining -= count;
 			}
-			rowDst += num;
-			remaining -= num;
 		}
 
 		const int rowSize = 2 + lineSize;
diff --git a/engines/scumm/smush/rebel/codec_ra1.h b/engines/scumm/smush/rebel/codec_ra1.h
index b509120323b..4aeb572b18d 100644
--- a/engines/scumm/smush/rebel/codec_ra1.h
+++ b/engines/scumm/smush/rebel/codec_ra1.h
@@ -26,7 +26,8 @@
 
 namespace Scumm {
 
-void smushDecodeRA1Transparent(byte *dst, const byte *src, int left, int top, int width, int height, int pitch, int dataSize);
+void smushDecodeRA1Transparent(byte *dst, const byte *src, int left, int top, int width, int height,
+		int pitch, int dataSize, int sourceSkipX = 0);
 void smushDecodeRA1SkipCopy(byte *dst, const byte *src, int left, int top, int width, int height,
 		int pitch, int bufWidth, int bufHeight, int dataSize);
 void smushDecodeRA1AdditiveLineUpdate(byte *dst, const byte *src, int left, int top, int width, int height,
diff --git a/engines/scumm/smush/rebel/smush_player_ra1.cpp b/engines/scumm/smush/rebel/smush_player_ra1.cpp
index 5d7cf83dc83..33b0f2967de 100644
--- a/engines/scumm/smush/rebel/smush_player_ra1.cpp
+++ b/engines/scumm/smush/rebel/smush_player_ra1.cpp
@@ -146,6 +146,7 @@ void SmushPlayerRebel1::initGamePlayerFields() {
 	_ra1ObjOverlayHeight = 0;
 	_ra1ViewportOffsetX = 0;
 	_ra1ViewportOffsetY = 0;
+	_ra1FrameSourceSkipX = 0;
 	_ra1FrameSourceSkipY = 0;
 	_ra1LastFrameObjectVisible = true;
 	_ra1FadeFrame = nullptr;
@@ -200,6 +201,7 @@ void SmushPlayerRebel1::resetGameVideoState() {
 	_ra1ObjOverlayHeight = 0;
 	_ra1ViewportOffsetX = 0;
 	_ra1ViewportOffsetY = 0;
+	_ra1FrameSourceSkipX = 0;
 	_ra1LastFrameObjectVisible = true;
 	_ra1UseFadeFrame = false;
 }
@@ -535,6 +537,7 @@ bool SmushPlayerRebel1::handleGameDimensionOverride(int codec, int width, int he
 }
 
 bool SmushPlayerRebel1::handleGameAdjustCoords(int codec, int &left, int &top, int &width, int &height, int pitch, int *srcSkipY) {
+	_ra1FrameSourceSkipX = 0;
 	_ra1FrameSourceSkipY = 0;
 
 	// Additive and scatter codecs use absolute positions.
@@ -556,7 +559,10 @@ bool SmushPlayerRebel1::handleGameAdjustCoords(int codec, int &left, int &top, i
 	}
 
 	int sourceSkipY = 0;
+	const int sourceSkipX = MAX(0, -(left + _fobjOffsetX));
 	adjustFrameCoords(left, top, width, height, pitch, &sourceSkipY);
+	if (codec == SMUSH_CODEC_RLE)
+		_ra1FrameSourceSkipX = sourceSkipX;
 	if (codec == SMUSH_CODEC_RLE_ALT) {
 		_ra1FrameSourceSkipY = sourceSkipY;
 		if (srcSkipY)
@@ -570,7 +576,7 @@ bool SmushPlayerRebel1::handleGameAdjustCoords(int codec, int &left, int &top, i
 bool SmushPlayerRebel1::handleGameCodecDecode(int codec, const uint8 *src, int left, int top, int width, int height, int pitch, int dataSize, uint8 param, uint16 parm2) {
 	switch (codec) {
 	case SMUSH_CODEC_RLE:
-		smushDecodeRA1Transparent(_dst, src, left, top, width, height, pitch, dataSize);
+		smushDecodeRA1Transparent(_dst, src, left, top, width, height, pitch, dataSize, _ra1FrameSourceSkipX);
 		return true;
 	case SMUSH_CODEC_RLE_ALT:
 		src = smushSkipRLELines(src, dataSize, _ra1FrameSourceSkipY);
diff --git a/engines/scumm/smush/rebel/smush_player_ra1.h b/engines/scumm/smush/rebel/smush_player_ra1.h
index c5c29052198..e34acd792eb 100644
--- a/engines/scumm/smush/rebel/smush_player_ra1.h
+++ b/engines/scumm/smush/rebel/smush_player_ra1.h
@@ -95,6 +95,7 @@ private:
 	// Interactive viewport scroll offset.
 	int _ra1ViewportOffsetX;
 	int _ra1ViewportOffsetY;
+	int _ra1FrameSourceSkipX;
 	int _ra1FrameSourceSkipY;
 	bool _ra1LastFrameObjectVisible;
 




More information about the Scummvm-git-logs mailing list