[Scummvm-git-logs] scummvm master -> ef60248022c5f94d6309bbadcb3e3cddb2b2b012

neuromancer noreply at scummvm.org
Thu Jun 11 19:06:11 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:
808f0526f2 SCUMM RA2: correct shoot rendering for L10
959c1517c8 SCUMM RA2: improve responsiveness of the gamepad in some levels
ef60248022 SCUMM RA2: improved perspective in some levels


Commit: 808f0526f216e5c285a8a45ed651c20f064c6592
    https://github.com/scummvm/scummvm/commit/808f0526f216e5c285a8a45ed651c20f064c6592
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2026-06-11T21:05:59+02:00

Commit Message:
SCUMM RA2: correct shoot rendering for L10

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


diff --git a/engines/scumm/insane/rebel2/render.cpp b/engines/scumm/insane/rebel2/render.cpp
index 9d5c7dccb65..d1219967e57 100644
--- a/engines/scumm/insane/rebel2/render.cpp
+++ b/engines/scumm/insane/rebel2/render.cpp
@@ -620,15 +620,14 @@ void InsaneRebel2::spawnHandler25Shot(int x, int y) {
 }
 
 Common::Point InsaneRebel2::getHandler7ShipDrawPoint() {
-	int shipCenterX = (_flyShipScreenX - 0xd4) + _perspectiveX + 160 + _viewX;
-	int shipCenterY = (_flyShipScreenY - 0x82) + _perspectiveY + 100 + _viewY;
+	Common::Point projected = getHandler7ProjectedPoint();
 
 	if (!_flyShipSprite || _flyShipSprite->getNumChars() <= 0)
-		return Common::Point(shipCenterX - 0xd4, shipCenterY - 0x82);
+		return Common::Point(projected.x - 0xd4, projected.y - 0x82);
 
 	int spriteIndex = CLIP<int>(_shipDirectionIndex, 0, _flyShipSprite->getNumChars() - 1);
-	return Common::Point(shipCenterX - _flyShipSprite->getCharWidth(spriteIndex) / 2,
-	                     shipCenterY - _flyShipSprite->getCharHeight(spriteIndex) / 2);
+	return Common::Point(projected.x - 0xd4 + _flyShipSprite->getCharXOffset(spriteIndex),
+	                     projected.y - 0x82 + _flyShipSprite->getCharYOffset(spriteIndex));
 }
 
 Common::Point InsaneRebel2::getHandler7ProjectedPoint() {
@@ -2693,13 +2692,13 @@ void InsaneRebel2::renderGameplayPostFrame(byte *renderBitmap, int pitch, int wi
 	// STEP 0: Fill status bar background (FUN_004288c0).
 	renderStatusBarBackground(renderBitmap, pitch, width, height, videoWidth, videoHeight, statusBarY);
 
-	// Ship rendering (FUN_00401ccf for Handler 8, FUN_0040d836 for Handler 7).
+	// Ship rendering. Handler 7 is drawn later, after its lasers, matching
+	// FUN_0040d836's order so the ship covers the muzzle end of the beams.
 	debugC(DEBUG_INSANE, "Ship Check: handler=%d shipSprite=%p flyShipSprite=%p shipLevelMode=%d numSprites=%d/%d",
 		_rebelHandler, (void*)_shipSprite, (void*)_flyShipSprite, _shipLevelMode,
 		_shipSprite ? _shipSprite->getNumChars() : 0,
 		_flyShipSprite ? _flyShipSprite->getNumChars() : 0);
 
-	renderHandler7Ship(renderBitmap, pitch, width, height);
 	renderVehicleShotImpacts(renderBitmap, pitch, width, height);
 	renderHandler8Ship(renderBitmap, pitch, width, height);
 	renderFallbackShip(renderBitmap, pitch, width, height);
@@ -2713,6 +2712,8 @@ void InsaneRebel2::renderGameplayPostFrame(byte *renderBitmap, int pitch, int wi
 	// Laser shot beams - drawn BEFORE cockpit/HUD overlays so cockpit covers beam edges.
 	renderLaserShots(renderBitmap, pitch, width, height);
 
+	renderHandler7Ship(renderBitmap, pitch, width, height);
+
 	// Handler 25 GRD sprites drawn AFTER enemies/explosions/lasers per original FUN_0041DB5E:
 	//   Line 193: FUN_0041f29a (enemies)
 	//   Line 194: FUN_0041e7c2 (explosions)
@@ -3463,17 +3464,20 @@ void InsaneRebel2::renderHandler7Ship(byte *renderBitmap, int pitch, int width,
 	const int nativeViewX = renderHiRes ? _hiResPresentationViewX : 0;
 	const int nativeViewY = renderHiRes ? _hiResPresentationViewY : 0;
 
+	Common::Point projected = getHandler7ProjectedPoint();
 	Common::Point shipDraw = getHandler7ShipDrawPoint();
 	if (renderHiRes) {
 		// Low-res draws into the native source buffer with _viewX/_viewY baked in,
 		// then SmushPlayer copies the scrolled viewport. High-res promotion has
 		// already consumed those offsets, so reconstruct the same native source
 		// position before applying the 2x presentation transform.
+		projected.x += nativeViewX;
+		projected.y += nativeViewY;
 		shipDraw.x += nativeViewX;
 		shipDraw.y += nativeViewY;
 	}
-	int shipCenterX = shipDraw.x + 0xd4;
-	int shipCenterY = shipDraw.y + 0x82;
+	int shipCenterX = projected.x;
+	int shipCenterY = projected.y;
 
 	// FUN_40D836 lines 108-136: FLY002 proximity cues near corridor danger.
 	if (_flyLaserSprite && _flyLaserSprite->getNumChars() > 0) {


Commit: 959c1517c892796fc5fd600b8c9f76a97ca8cbd2
    https://github.com/scummvm/scummvm/commit/959c1517c892796fc5fd600b8c9f76a97ca8cbd2
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2026-06-11T21:05:59+02:00

Commit Message:
SCUMM RA2: improve responsiveness of the gamepad in some levels

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


diff --git a/engines/scumm/insane/rebel2/iact.cpp b/engines/scumm/insane/rebel2/iact.cpp
index a322e039bd1..63178723a3a 100644
--- a/engines/scumm/insane/rebel2/iact.cpp
+++ b/engines/scumm/insane/rebel2/iact.cpp
@@ -853,14 +853,20 @@ void InsaneRebel2::handleOpcode6Handler7(Common::SeekableReadStream &b, int16 pa
 
 	// Direct mouse/touch/gamepad aiming can hold the cursor at an edge
 	// indefinitely. Keep this sensitivity concession local to Handler 7
-	// third-person ship steering.
-	scaledInputX = (int16)((scaledInputX * kRA2Handler7DirectInputNumerator) /
-		kRA2Handler7DirectInputDenominator);
-	scaledInputY = (int16)((scaledInputY * kRA2Handler7DirectInputNumerator) /
-		kRA2Handler7DirectInputDenominator);
-	const bool useMouseFlightTarget = !_gamepadAimActive;
+	// third-person ship steering. A held analog stick is already bounded by its
+	// physical range, so keep its full logical range for more responsive L10 flight.
+	if (!_gamepadAimActive) {
+		scaledInputX = (int16)((scaledInputX * kRA2Handler7DirectInputNumerator) /
+			kRA2Handler7DirectInputDenominator);
+		scaledInputY = (int16)((scaledInputY * kRA2Handler7DirectInputNumerator) /
+			kRA2Handler7DirectInputDenominator);
+	}
+	// ScummVM's controller path drives a virtual absolute aim point, like mouse/touch.
+	// Use the same bounded target steering for it; the original relative-axis
+	// integration is too sluggish for L10's low slide/lift parameters.
+	const bool useTargetSteering = true;
 	int16 mouseFlightTargetX = _flyShipScreenX;
-	if (useMouseFlightTarget) {
+	if (useTargetSteering) {
 		mouseFlightTargetX = (int16)(0xd4 + (scaledInputX * kRA2Handler7MouseTargetRangeX) / 127);
 		mouseFlightTargetX = CLIP<int16>(mouseFlightTargetX, 0x14, 0x194);
 	}
@@ -927,9 +933,10 @@ void InsaneRebel2::handleOpcode6Handler7(Common::SeekableReadStream &b, int16 pa
 	// FUN_0040C3CC integrates relative flight axes. The real mouse is an
 	// absolute position, so steer toward a bounded position target instead of
 	// letting a held off-center cursor keep pushing the ship until it bounces.
-	if (useMouseFlightTarget) {
+	if (useTargetSteering) {
 		int targetDeltaX = mouseFlightTargetX - _flyShipScreenX;
-		positionDeltaX = (int16)CLIP<int>(targetDeltaX / 4, -12, 12);
+		const int targetSteeringDivisor = _gamepadAimActive ? 2 : 4;
+		positionDeltaX = (int16)CLIP<int>(targetDeltaX / targetSteeringDivisor, -12, 12);
 		if (positionDeltaX == 0 && targetDeltaX != 0)
 			positionDeltaX = (targetDeltaX < 0) ? -1 : 1;
 	}
@@ -1085,11 +1092,11 @@ void InsaneRebel2::handleOpcode6Handler7(Common::SeekableReadStream &b, int16 pa
 		 _vm->getActionState(kScummActionInsaneAttack));
 
 	debugC(DEBUG_INSANE, "H7: mouse=(%d,%d) raw=(%d,%d) scaled=(%d,%d) targetX=%d pos=(%d,%d) "
-		"vel=%d vIn=%d dx=%d dir=%d mode=%d mouseTarget=%d",
+		"vel=%d vIn=%d dx=%d dir=%d mode=%d targetSteer=%d padAim=%d",
 		mouseX, mouseY, inputX, inputY, scaledInputX, scaledInputY,
 		mouseFlightTargetX, _flyShipScreenX, _flyShipScreenY, _smoothedVelocity,
 		_verticalInput, positionDeltaX, _shipDirectionIndex, _flyControlMode,
-		useMouseFlightTarget ? 1 : 0);
+		useTargetSteering ? 1 : 0, _gamepadAimActive ? 1 : 0);
 }
 
 // Helper split out of FUN_0041CADB case 4; not a separate original function.
diff --git a/engines/scumm/insane/rebel2/rebel.cpp b/engines/scumm/insane/rebel2/rebel.cpp
index babc253b027..910ee97a597 100644
--- a/engines/scumm/insane/rebel2/rebel.cpp
+++ b/engines/scumm/insane/rebel2/rebel.cpp
@@ -1953,6 +1953,40 @@ void InsaneRebel2::updateGameplayAimFromGamepad() {
 				return;
 			}
 		}
+	} else if (_rebelHandler == 7) {
+		int axisX = 0;
+		int axisY = 0;
+		if (dpadX || dpadY) {
+			axisX = dpadX * 127;
+			axisY = dpadY * 127;
+		} else {
+			axisX = velX;
+			axisY = velY;
+		}
+
+		if (axisX || axisY) {
+			const Common::Point aimPos = getGameplayAimPoint();
+			const int centerX = 160;
+			const int centerY = 100;
+			const int kHandler7HorizontalRange = 120;
+			const int targetX = CLIP<int>(centerX + axisX * kHandler7HorizontalRange / 127, 0, 319);
+			const int targetY = (axisY < 0) ?
+				centerY + axisY * centerY / 127 :
+				centerY + axisY * (199 - centerY) / 127;
+			const int kHandler7HorizontalMaxStep = 24;
+			const int kHandler7VerticalMaxStep = 32;
+			const int distX = targetX - aimPos.x;
+			const int distY = targetY - aimPos.y;
+
+			if (distX || distY) {
+				deltaX = CLIP<int>(distX, -kHandler7HorizontalMaxStep, kHandler7HorizontalMaxStep);
+				deltaY = CLIP<int>(distY, -kHandler7VerticalMaxStep, kHandler7VerticalMaxStep);
+				activeGamepadAim = true;
+			} else {
+				_gamepadAimActive = true;
+				return;
+			}
+		}
 	} else if (dpadX || dpadY) {
 		const int kOriginalDigitalStep = 3;
 		deltaX = dpadX * kOriginalDigitalStep;


Commit: ef60248022c5f94d6309bbadcb3e3cddb2b2b012
    https://github.com/scummvm/scummvm/commit/ef60248022c5f94d6309bbadcb3e3cddb2b2b012
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2026-06-11T21:05:59+02:00

Commit Message:
SCUMM RA2: improved perspective in some levels

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


diff --git a/engines/scumm/insane/rebel2/iact.cpp b/engines/scumm/insane/rebel2/iact.cpp
index 63178723a3a..eb59a01ad7e 100644
--- a/engines/scumm/insane/rebel2/iact.cpp
+++ b/engines/scumm/insane/rebel2/iact.cpp
@@ -861,10 +861,11 @@ void InsaneRebel2::handleOpcode6Handler7(Common::SeekableReadStream &b, int16 pa
 		scaledInputY = (int16)((scaledInputY * kRA2Handler7DirectInputNumerator) /
 			kRA2Handler7DirectInputDenominator);
 	}
-	// ScummVM's controller path drives a virtual absolute aim point, like mouse/touch.
-	// Use the same bounded target steering for it; the original relative-axis
-	// integration is too sluggish for L10's low slide/lift parameters.
-	const bool useTargetSteering = true;
+	// Mouse/touch can hold an absolute cursor at an edge indefinitely, so they use
+	// bounded target steering. Gamepad input for Handler 7 now feeds the original
+	// center-relative flight axes and lets the assembly-derived velocity history,
+	// lift/slide tables, wind, and clamps produce the ship movement.
+	const bool useTargetSteering = !_gamepadAimActive;
 	int16 mouseFlightTargetX = _flyShipScreenX;
 	if (useTargetSteering) {
 		mouseFlightTargetX = (int16)(0xd4 + (scaledInputX * kRA2Handler7MouseTargetRangeX) / 127);
diff --git a/engines/scumm/insane/rebel2/rebel.cpp b/engines/scumm/insane/rebel2/rebel.cpp
index 910ee97a597..35c0dd5186b 100644
--- a/engines/scumm/insane/rebel2/rebel.cpp
+++ b/engines/scumm/insane/rebel2/rebel.cpp
@@ -1964,23 +1964,22 @@ void InsaneRebel2::updateGameplayAimFromGamepad() {
 			axisY = velY;
 		}
 
-		if (axisX || axisY) {
+		if (axisX || axisY || _gamepadAimActive) {
 			const Common::Point aimPos = getGameplayAimPoint();
 			const int centerX = 160;
 			const int centerY = 100;
-			const int kHandler7HorizontalRange = 120;
-			const int targetX = CLIP<int>(centerX + axisX * kHandler7HorizontalRange / 127, 0, 319);
+			const int targetX = (axisX < 0) ?
+				centerX + axisX * centerX / 127 :
+				centerX + axisX * (319 - centerX) / 127;
 			const int targetY = (axisY < 0) ?
 				centerY + axisY * centerY / 127 :
 				centerY + axisY * (199 - centerY) / 127;
-			const int kHandler7HorizontalMaxStep = 24;
-			const int kHandler7VerticalMaxStep = 32;
 			const int distX = targetX - aimPos.x;
 			const int distY = targetY - aimPos.y;
 
 			if (distX || distY) {
-				deltaX = CLIP<int>(distX, -kHandler7HorizontalMaxStep, kHandler7HorizontalMaxStep);
-				deltaY = CLIP<int>(distY, -kHandler7VerticalMaxStep, kHandler7VerticalMaxStep);
+				deltaX = distX;
+				deltaY = distY;
 				activeGamepadAim = true;
 			} else {
 				_gamepadAimActive = true;




More information about the Scummvm-git-logs mailing list