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

alxpnv a04198622 at gmail.com
Tue Sep 21 12:00:57 UTC 2021


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

Summary:
6c24eb0be2 ASYLUM: fix potential bad bit shift
5fe5a128a6 ASYLUM: fix improper use of negative value
ce0c5cce18 ASYLUM: fix arguments in wrong order
b9e52233c3 ASYLUM: (TimeMachine puzzle) fix uninitialized class members


Commit: 6c24eb0be2d3eba9f47a3072ce12c897dfe12914
    https://github.com/scummvm/scummvm/commit/6c24eb0be2d3eba9f47a3072ce12c897dfe12914
Author: alxpnv (alxpnv22 at yahoo.com)
Date: 2021-09-21T15:02:41+03:00

Commit Message:
ASYLUM: fix potential bad bit shift

CID 1453217

Changed paths:
    engines/asylum/puzzles/pipes.cpp


diff --git a/engines/asylum/puzzles/pipes.cpp b/engines/asylum/puzzles/pipes.cpp
index 7f3ea5f377..7ce2a259bc 100644
--- a/engines/asylum/puzzles/pipes.cpp
+++ b/engines/asylum/puzzles/pipes.cpp
@@ -62,8 +62,10 @@ static const int16 peepholePoints[37][2] = {
 const uint32 peepholeResources[] = {15, 15, 15, 15, 32, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 32, 32, 15,
 									15, 32, 32, 15, 15, 15, 15, 15, 15, 15, 15, 32, 15, 15, 15, 15, 15, 15, 15};
 
-static BinNum calcStateFromPos(uint32 ind, ConnectorType type, uint32 position) {
-	uint32 shift = (uint32)Common::intLog2(position);
+static BinNum calcStateFromPosition(ConnectorType type, uint32 position) {
+	assert(position--);
+	uint32 shift = !!position + !!(position >> 1) + !!(position >> 2);
+
 	return BinNum((type >> shift | type << (4 - shift)) & 0xF);
 }
 
@@ -115,7 +117,7 @@ void Connector::init(Peephole *n, Peephole *e, Peephole *s, Peephole *w, uint32
 
 	*_position = pos;
 	_type = type;
-	_state = calcStateFromPos(_id, _type, *_position);
+	_state = calcStateFromPosition(_type, *_position);
 
 	_nextConnector = nextConnector;
 	_nextConnectorPosition = nextConnectorPosition;
@@ -595,7 +597,7 @@ uint32 PuzzlePipes::checkFlags() {
 void PuzzlePipes::checkConnections() {
 	for (uint32 i = 0; i < connectorsCount; i++) {
 		uint32 oldState = _connectors[i].getState(),
-			newState = calcStateFromPos(i, _connectors[i].getType(), _positions[i]);
+			newState = calcStateFromPosition(_connectors[i].getType(), _positions[i]);
 		if (oldState != newState) {
 			do {
 				_connectors[i].turn(false);


Commit: 5fe5a128a6ed005ed4d8bd603e351a09bd4ff156
    https://github.com/scummvm/scummvm/commit/5fe5a128a6ed005ed4d8bd603e351a09bd4ff156
Author: alxpnv (alxpnv22 at yahoo.com)
Date: 2021-09-21T15:02:41+03:00

Commit Message:
ASYLUM: fix improper use of negative value

CID 1453216

Changed paths:
    engines/asylum/views/scene.cpp


diff --git a/engines/asylum/views/scene.cpp b/engines/asylum/views/scene.cpp
index 6cd159fc50..6d152bb18f 100644
--- a/engines/asylum/views/scene.cpp
+++ b/engines/asylum/views/scene.cpp
@@ -800,7 +800,8 @@ void Scene::updateMouse() {
 		newDirection = kDirectionSE;
 	}
 
-	updateCursor(newDirection, actorRect);
+	if (newDirection != kDirectionInvalid)
+		updateCursor(newDirection, actorRect);
 
 	if (newDirection >= kDirectionN)
 		if (player->getStatus() == kActorStatusWalking || player->getStatus() == kActorStatusWalking2)


Commit: ce0c5cce18964ca2b9f54dadd249208e37b4572b
    https://github.com/scummvm/scummvm/commit/ce0c5cce18964ca2b9f54dadd249208e37b4572b
Author: alxpnv (alxpnv22 at yahoo.com)
Date: 2021-09-21T15:02:41+03:00

Commit Message:
ASYLUM: fix arguments in wrong order

CID 1453225

Changed paths:
    engines/asylum/views/scene.cpp


diff --git a/engines/asylum/views/scene.cpp b/engines/asylum/views/scene.cpp
index 6d152bb18f..3968cd9f69 100644
--- a/engines/asylum/views/scene.cpp
+++ b/engines/asylum/views/scene.cpp
@@ -2323,7 +2323,7 @@ void Scene::changePlayer(ActorIndex index) {
 		// Save scene data
 		getSharedData()->saveCursorResources((ResourceId *)&_ws->cursorResources, sizeof(_ws->cursorResources));
 		getSharedData()->saveSceneFonts(_ws->font1, _ws->font2, _ws->font3);
-		getSharedData()->saveSmallCursor(_ws->smallCurDown, _ws->smallCurUp);
+		getSharedData()->saveSmallCursor(_ws->smallCurUp, _ws->smallCurDown);
 		getSharedData()->saveEncounterFrameBackground(_ws->encounterFrameBg);
 
 		// Setup new values
@@ -2345,7 +2345,7 @@ void Scene::changePlayer(ActorIndex index) {
 		// Load scene data
 		getSharedData()->loadCursorResources((ResourceId *)&_ws->cursorResources, sizeof(_ws->cursorResources));
 		getSharedData()->loadSceneFonts(&_ws->font1, &_ws->font2, &_ws->font3);
-		getSharedData()->loadSmallCursor(&_ws->smallCurDown, &_ws->smallCurUp);
+		getSharedData()->loadSmallCursor(&_ws->smallCurUp, &_ws->smallCurDown);
 		getSharedData()->loadEncounterFrameBackground(&_ws->encounterFrameBg);
 
 		// Reset cursor


Commit: b9e52233c31bb8f5932e4ade386f6719fb078995
    https://github.com/scummvm/scummvm/commit/b9e52233c31bb8f5932e4ade386f6719fb078995
Author: alxpnv (alxpnv22 at yahoo.com)
Date: 2021-09-21T15:02:41+03:00

Commit Message:
ASYLUM: (TimeMachine puzzle) fix uninitialized class members

CID 1453221

Changed paths:
    engines/asylum/puzzles/timemachine.cpp


diff --git a/engines/asylum/puzzles/timemachine.cpp b/engines/asylum/puzzles/timemachine.cpp
index 1f05e70423..f996b08a1e 100644
--- a/engines/asylum/puzzles/timemachine.cpp
+++ b/engines/asylum/puzzles/timemachine.cpp
@@ -48,10 +48,15 @@ const int16 puzzleTimeMachinePoints[5][2] = {
 
 PuzzleTimeMachine::PuzzleTimeMachine(AsylumEngine *engine) : Puzzle(engine) {
 	_leftButtonClicked = true;
+	_counter = 0;
 
 	memset(&_frameIndexes,		0, sizeof(_frameIndexes));
 	memset(&_frameCounts,		0, sizeof(_frameCounts));
 	memset(&_frameIncrements,	0, sizeof(_frameIncrements));
+	memset(&_state,				0, sizeof(_state));
+
+	_data_45AAA8 = _data_45AAAC = 0;
+	_currentFrameIndex = 0;
 
 	reset();
 }




More information about the Scummvm-git-logs mailing list