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

sev- noreply at scummvm.org
Wed Jun 8 13:17:36 UTC 2022


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

Summary:
c73af63436 SCUMM: Fix random number generation in SCUMM6
ccb7bbe921 NEWS: Mention SCUMM RNG fix


Commit: c73af63436e88b50eabce6a30fd2aea2c1695ab1
    https://github.com/scummvm/scummvm/commit/c73af63436e88b50eabce6a30fd2aea2c1695ab1
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-06-08T15:16:57+02:00

Commit Message:
SCUMM: Fix random number generation in SCUMM6

Now it matches disassembly and particularly fixes RNG in
Backyard Sports games.

Changed paths:
    engines/scumm/script_v6.cpp


diff --git a/engines/scumm/script_v6.cpp b/engines/scumm/script_v6.cpp
index a51ecb92bce..7abf1608905 100644
--- a/engines/scumm/script_v6.cpp
+++ b/engines/scumm/script_v6.cpp
@@ -1345,8 +1345,8 @@ void ScummEngine_v6::o6_loadRoomWithEgo() {
 }
 
 void ScummEngine_v6::o6_getRandomNumber() {
-	int rnd;
-	rnd = _rnd.getRandomNumber(ABS(pop()));
+	int rnd = _rnd.getRandomNumber(0x7fff);
+	rnd = rnd % (pop() + 1);
 	if (VAR_RANDOM_NR != 0xFF)
 		VAR(VAR_RANDOM_NR) = rnd;
 	push(rnd);
@@ -1355,7 +1355,8 @@ void ScummEngine_v6::o6_getRandomNumber() {
 void ScummEngine_v6::o6_getRandomNumberRange() {
 	int max = pop();
 	int min = pop();
-	int rnd = _rnd.getRandomNumberRng(min, max);
+	int rnd = _rnd.getRandomNumber(0x7fff);
+	rnd = min + (rnd % (max - min + 1));
 	if (VAR_RANDOM_NR != 0xFF)
 		VAR(VAR_RANDOM_NR) = rnd;
 	push(rnd);
@@ -2901,10 +2902,10 @@ void ScummEngine_v6::o6_delayFrames() {
 	// WORKAROUND:  At startup, Moonbase Commander will pause for 20 frames before
 	// showing the Infogrames logo.  The purpose of this break is to give time for the
 	// GameSpy Arcade application to fill with the Online game infomation.
-	// 
+	//
 	// [0000] (84) localvar2 = max(readConfigFile.number(":var263:","user","wait-for-gamespy"),10)
 	// [0029] (08) delayFrames((localvar2 * 2))
-	// 
+	//
 	// But since we don't support GameSpy and have our own Online support, this break
 	// has become redundant and only wastes time.
 	if (_game.id == GID_MOONBASE && vm.slot[_currentScript].number == 69) {


Commit: ccb7bbe921a8088cec3d3766568fed7aef7a7ad3
    https://github.com/scummvm/scummvm/commit/ccb7bbe921a8088cec3d3766568fed7aef7a7ad3
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-06-08T15:16:57+02:00

Commit Message:
NEWS: Mention SCUMM RNG fix

Changed paths:
    NEWS.md


diff --git a/NEWS.md b/NEWS.md
index e94076d09ce..3a3b457346c 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -153,6 +153,7 @@ For a more comprehensive changelog of the latest experimental code, see:
      Run Games sold in their Monkey Island 30th Anniversary Anthology, if using
      the default DISK4 image, which is corrupted. It's possible to recover a
      working image from the KryoFlux dumps they also provided.
+   - Fixed random number generation which fixes throwing in Backyard Baseball.
 
  Sherlock:
    - Fixed slowdown in Serrated Scalpel intro when playing the game from a small




More information about the Scummvm-git-logs mailing list