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

AndywinXp noreply at scummvm.org
Sat Aug 10 11:16:23 UTC 2024


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

Summary:
19397407cf SCUMM: MANIAC (NES): Fix mishandling/drawing of text area
d78ec57ef5 SCUMM: MANIAC (NES): Improve inventory handling accuracy
1df23b8fcc SCUMM: MANIAC (NES): Fix game speed being too slow


Commit: 19397407cf78178ff185fd6fa42669cb8008aec2
    https://github.com/scummvm/scummvm/commit/19397407cf78178ff185fd6fa42669cb8008aec2
Author: AndywinXp (andywinxp at gmail.com)
Date: 2024-08-10T13:00:31+02:00

Commit Message:
SCUMM: MANIAC (NES): Fix mishandling/drawing of text area

While the workaround makes sense for room graphics,
I haven't yet see a reason why it should be used for the text
area as well...

This fixes #13107:
"SCUMM: MM (NES-EU-ES) - Last letters retained in screen/missing letters"

Changed paths:
    engines/scumm/gfx.cpp


diff --git a/engines/scumm/gfx.cpp b/engines/scumm/gfx.cpp
index 269000a4c61..fd72cb5063f 100644
--- a/engines/scumm/gfx.cpp
+++ b/engines/scumm/gfx.cpp
@@ -765,7 +765,10 @@ void ScummEngine::drawStripToScreen(VirtScreen *vs, int x, int width, int top, i
 			// NES can address negative number strips and that poses problem for
 			// our code. So instead of adding zillions of fixes and potentially
 			// breaking other games, we shift it right at the rendering stage.
-			if (((_NESStartStrip > 0) && (vs->number == kMainVirtScreen)) || (vs->number == kTextVirtScreen)) {
+			//
+			// This hack originally checked for (vs->number == kTextVirtScreen) as well.
+			// This causes bug #3594/#13107 to happen though...
+			if (((_NESStartStrip > 0) && (vs->number == kMainVirtScreen))) {
 				x += 16;
 				while (x + width >= _screenWidth)
 					width -= 16;


Commit: d78ec57ef5376a6a5d70a53f19f1bc5d1e441b5b
    https://github.com/scummvm/scummvm/commit/d78ec57ef5376a6a5d70a53f19f1bc5d1e441b5b
Author: AndywinXp (andywinxp at gmail.com)
Date: 2024-08-10T13:00:31+02:00

Commit Message:
SCUMM: MANIAC (NES): Improve inventory handling accuracy

The inventory is now scrollable starting from three objects,
and it is filled in inverse order (last object grabbed is the first
displayed).

Changed paths:
    engines/scumm/script_v2.cpp
    engines/scumm/verbs.cpp


diff --git a/engines/scumm/script_v2.cpp b/engines/scumm/script_v2.cpp
index 8951b1ae6d6..c5bae64707e 100644
--- a/engines/scumm/script_v2.cpp
+++ b/engines/scumm/script_v2.cpp
@@ -1336,8 +1336,11 @@ void ScummEngine_v2::o2_findObject() {
 	int y = getVarOrDirectByte(PARAM_2) * V12_Y_MULTIPLIER;
 	obj = findObject(x, y);
 	if (obj == 0 && (_game.platform == Common::kPlatformNES) && (_userState & USERSTATE_IFACE_INVENTORY)) {
-		if (_mouseOverBoxV2 >= 0 && _mouseOverBoxV2 < 4)
-			obj = findInventory(VAR(VAR_EGO), _mouseOverBoxV2 + _inventoryOffset + 1);
+		if (_mouseOverBoxV2 >= 0 && _mouseOverBoxV2 < 4) {
+			// Simulate inverse order
+			int invCount = getInventoryCount(VAR(VAR_EGO));
+			obj = findInventory(VAR(VAR_EGO), invCount - _inventoryOffset - _mouseOverBoxV2);
+		}
 	}
 	setResult(obj);
 }
diff --git a/engines/scumm/verbs.cpp b/engines/scumm/verbs.cpp
index 6af7dbbf862..dde84f14796 100644
--- a/engines/scumm/verbs.cpp
+++ b/engines/scumm/verbs.cpp
@@ -382,7 +382,8 @@ void ScummEngine_v2::checkV2MouseOver(Common::Point pos) {
 }
 
 int ScummEngine_v2::checkV2Inventory(int x, int y) {
-	int inventoryArea = (_game.platform == Common::kPlatformNES) ? 48: 32;
+	bool isNES = (_game.platform == Common::kPlatformNES);
+	int inventoryArea = isNES ? 48 : 32;
 	int object = 0;
 
 	y -= _virtscr[kVerbVirtScreen].topline;
@@ -396,7 +397,7 @@ int ScummEngine_v2::checkV2Inventory(int x, int y) {
 			redrawV2Inventory();
 		}
 	} else if (_mouseOverBoxesV2[kInventoryDownArrow].rect.contains(x, y)) {
-		if (_inventoryOffset + 4 < getInventoryCount(_scummVars[VAR_EGO])) {
+		if (_inventoryOffset + (isNES ? 2 : 4) < getInventoryCount(_scummVars[VAR_EGO])) {
 			_inventoryOffset += 2;
 			redrawV2Inventory();
 		}
@@ -416,11 +417,11 @@ int ScummEngine_v2::checkV2Inventory(int x, int y) {
 
 void ScummEngine_v2::redrawV2Inventory() {
 	VirtScreen *vs = &_virtscr[kVerbVirtScreen];
-	int i;
-	int max_inv;
+	int maxVisibleInv, invCount, obj;
 	Common::Rect inventoryBox;
-	int inventoryArea = (_game.platform == Common::kPlatformNES) ? 48: 32;
-	int maxChars = (_game.platform == Common::kPlatformNES) ? 13: 18;
+	bool isNES = (_game.platform == Common::kPlatformNES);
+	int inventoryArea = isNES ? 48 : 32;
+	int maxChars = isNES ? 13 : 18;
 
 	_mouseOverBoxV2 = -1;
 
@@ -436,11 +437,18 @@ void ScummEngine_v2::redrawV2Inventory() {
 
 	_string[1].charset = 1;
 
-	max_inv = getInventoryCount(_scummVars[VAR_EGO]) - _inventoryOffset;
-	if (max_inv > 4)
-		max_inv = 4;
-	for (i = 0; i < max_inv; i++) {
-		int obj = findInventory(_scummVars[VAR_EGO], i + 1 + _inventoryOffset);
+	invCount = getInventoryCount(_scummVars[VAR_EGO]);
+	maxVisibleInv = invCount - _inventoryOffset;
+	if (maxVisibleInv > 4)
+		maxVisibleInv = 4;
+
+	for (int i = 0; i < maxVisibleInv; i++) {
+		if (isNES) {
+			obj = findInventory(_scummVars[VAR_EGO], invCount - _inventoryOffset - i);
+		} else {
+			obj = findInventory(_scummVars[VAR_EGO], i + 1 + _inventoryOffset);
+		}
+
 		if (obj == 0)
 			break;
 
@@ -468,19 +476,19 @@ void ScummEngine_v2::redrawV2Inventory() {
 		_string[1].ypos = _mouseOverBoxesV2[kInventoryUpArrow].rect.top + vs->topline;
 		_string[1].right = _mouseOverBoxesV2[kInventoryUpArrow].rect.right - 1;
 		_string[1].color = _mouseOverBoxesV2[kInventoryUpArrow].color;
-		if (_game.platform == Common::kPlatformNES)
+		if (isNES)
 			drawString(1, (const byte *)"\x7E");
 		else
 			drawString(1, (const byte *)" \1\2");
 	}
 
 	// If necessary, draw "down" arrow
-	if (_inventoryOffset + 4 < getInventoryCount(_scummVars[VAR_EGO])) {
+	if (_inventoryOffset + (isNES ? 2 : 4) < getInventoryCount(_scummVars[VAR_EGO])) {
 		_string[1].xpos = _mouseOverBoxesV2[kInventoryDownArrow].rect.left;
 		_string[1].ypos = _mouseOverBoxesV2[kInventoryDownArrow].rect.top + vs->topline;
 		_string[1].right = _mouseOverBoxesV2[kInventoryDownArrow].rect.right - 1;
 		_string[1].color = _mouseOverBoxesV2[kInventoryDownArrow].color;
-		if (_game.platform == Common::kPlatformNES)
+		if (isNES)
 			drawString(1, (const byte *)"\x7F");
 		else
 			drawString(1, (const byte *)" \3\4");


Commit: 1df23b8fccae7d61e0169d5ac07ff1730a4f995a
    https://github.com/scummvm/scummvm/commit/1df23b8fccae7d61e0169d5ac07ff1730a4f995a
Author: AndywinXp (andywinxp at gmail.com)
Date: 2024-08-10T13:16:07+02:00

Commit Message:
SCUMM: MANIAC (NES): Fix game speed being too slow

Changed paths:
    engines/scumm/scumm.cpp


diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp
index c40b44a11b4..3aa6d90f1eb 100644
--- a/engines/scumm/scumm.cpp
+++ b/engines/scumm/scumm.cpp
@@ -2437,7 +2437,7 @@ Common::Error ScummEngine::go() {
 		// expected. The timer resolution is lower than the frame-time
 		// derived from it, i.e., one tick represents three frames. We need
 		// to round up VAR_TIMER_NEXT to the nearest multiple of three.
-		if (_game.id == GID_MANIAC && _game.version == 1) {
+		if (_game.id == GID_MANIAC && _game.version == 1 && _game.platform != Common::kPlatformNES) {
 			delta = ceil(delta / 3.0) * 3;
 		}
 




More information about the Scummvm-git-logs mailing list