[Scummvm-git-logs] scummvm master -> 8188dc71a3fad08e7a03feb41af125d29145b95b

Strangerke noreply at scummvm.org
Fri May 30 06:05:26 UTC 2025


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

Summary:
8188dc71a3 M4: Fix more frac16 negative issues


Commit: 8188dc71a3fad08e7a03feb41af125d29145b95b
    https://github.com/scummvm/scummvm/commit/8188dc71a3fad08e7a03feb41af125d29145b95b
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2025-05-30T07:05:19+01:00

Commit Message:
M4: Fix more frac16 negative issues

Changed paths:
    engines/m4/riddle/rooms/section3/room303.cpp
    engines/m4/wscript/ws_cruncher.cpp
    engines/m4/wscript/ws_machine.cpp


diff --git a/engines/m4/riddle/rooms/section3/room303.cpp b/engines/m4/riddle/rooms/section3/room303.cpp
index 4eab8a469e9..f5d147eb6ed 100644
--- a/engines/m4/riddle/rooms/section3/room303.cpp
+++ b/engines/m4/riddle/rooms/section3/room303.cpp
@@ -532,7 +532,7 @@ void Room303::daemon() {
 
 	case 124:
 		_G(globals)[GLB_TEMP_1] = 0;
-		_G(globals)[GLB_TEMP_2] = 0xFFFF0000;
+		_G(globals)[GLB_TEMP_2] = (int)-1 << 16;
 		sendWSMessage(0x200000, 0, _priestTalk, 0, nullptr, 1);
 		break;
 
diff --git a/engines/m4/wscript/ws_cruncher.cpp b/engines/m4/wscript/ws_cruncher.cpp
index 4a144947995..eb5d1ed5ef2 100644
--- a/engines/m4/wscript/ws_cruncher.cpp
+++ b/engines/m4/wscript/ws_cruncher.cpp
@@ -792,9 +792,9 @@ static void op_FLOOR(Anim8 *myAnim8) {
 		ws_Error(myAnim8->myMachine, ERR_SEQU, 0x0251, "functionality: arg1 = floor(arg2)  or  arg1 = floor(rand(arg2,arg3))");
 	}
 	if (_GWS(myArg3)) {
-		*_GWS(myArg1) = ((imath_ranged_rand16(*_GWS(myArg2), *_GWS(myArg3))) >> 16) << 16;
+		*_GWS(myArg1) = (imath_ranged_rand16(*_GWS(myArg2), *_GWS(myArg3)) >> 16) << 16;
 	} else {
-		*_GWS(myArg1) = ((*_GWS(myArg2)) >> 16) << 16;
+		*_GWS(myArg1) = (*_GWS(myArg2) >> 16) << 16;
 	}
 }
 
@@ -809,9 +809,9 @@ static void op_ROUND(Anim8 *myAnim8) {
 		myArg = *_GWS(myArg2);
 	}
 	if ((myArg & 0xffff) >= 0x8000) {
-		*_GWS(myArg1) = (myArg + 0x10000) & 0xffff0000;
+		*_GWS(myArg1) = ((myArg + 0x10000) >> 16) << 16;
 	} else {
-		*_GWS(myArg1) = myArg & 0xffff0000;
+		*_GWS(myArg1) = (myArg >> 16) << 16;
 	}
 }
 
@@ -826,9 +826,9 @@ static void op_CEIL(Anim8 *myAnim8) {
 		myArg = *_GWS(myArg2);
 	}
 	if ((myArg & 0xffff) > 0) {
-		*_GWS(myArg1) = (myArg + 0x10000) & 0xffff0000;
+		*_GWS(myArg1) = ((myArg >> 16) << 16) + 0x10000;
 	} else {
-		*_GWS(myArg1) = myArg & 0xffff0000;
+		*_GWS(myArg1) = (myArg >> 16) << 16;
 	}
 }
 
diff --git a/engines/m4/wscript/ws_machine.cpp b/engines/m4/wscript/ws_machine.cpp
index 8121e75af65..8713e53b736 100644
--- a/engines/m4/wscript/ws_machine.cpp
+++ b/engines/m4/wscript/ws_machine.cpp
@@ -1046,7 +1046,7 @@ machine *TriggerMachineByHash(int32 val1, int32 val2, int32 val3, int32 val4, in
 	_G(globals)[GLB_TEMP_8] = y << 16;
 	_G(globals)[GLB_TEMP_9] = (scale << 16) / 100;
 	_G(globals)[GLB_TEMP_10] = layer << 16;
-	_G(globals)[GLB_TEMP_11] = flag ? 0xffff0000 : 0x10000;
+	_G(globals)[GLB_TEMP_11] = (flag ? (int)-1 : 1) << 16;
 
 	return TriggerMachineByHash(40, nullptr, -1, -1, intrMsg, false, machName);
 }




More information about the Scummvm-git-logs mailing list