[Scummvm-git-logs] scummvm master -> 9b2c3c59d3014909ccdd8a42cc00e3374855a908

mgerhardy martin.gerhardy at gmail.com
Thu Mar 4 15:11:21 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:
e9ee0ca7bc TWINE: previousAnimIdx might be -1 in Redraw::processDrawListShadows
9e65aad7a2 TWINE: reduced code duplication
262e8a1d57 PRIVATE: fixed invalid memory access
9b2c3c59d3 PRIVATE: also open in file in release builds


Commit: e9ee0ca7bc1bcb42c3d72ff8d117e16a50d788f3
    https://github.com/scummvm/scummvm/commit/e9ee0ca7bc1bcb42c3d72ff8d117e16a50d788f3
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-04T15:32:07+01:00

Commit Message:
TWINE: previousAnimIdx might be -1 in Redraw::processDrawListShadows

Changed paths:
    engines/twine/renderer/redraw.cpp


diff --git a/engines/twine/renderer/redraw.cpp b/engines/twine/renderer/redraw.cpp
index 42e6a43838..9871553f9c 100644
--- a/engines/twine/renderer/redraw.cpp
+++ b/engines/twine/renderer/redraw.cpp
@@ -251,8 +251,7 @@ int32 Redraw::fillActorDrawingList(bool bgRedraw) {
 					_engine->_movements->getShadowPosition(actor->pos.x, actor->pos.y, actor->pos.z);
 				}
 
-				tmpVal--;
-				drawList[drawListPos].posValue = tmpVal; // save the shadow entry in the drawList
+				drawList[drawListPos].posValue = tmpVal - 1; // save the shadow entry in the drawList
 				drawList[drawListPos].type = DrawListType::DrawShadows;
 				drawList[drawListPos].actorIdx = 0;
 				drawList[drawListPos].x = _engine->_actor->shadowCoord.x;
@@ -343,9 +342,11 @@ void Redraw::processDrawListShadows(const DrawListStruct &drawCmd) {
 void Redraw::processDrawListActors(const DrawListStruct &drawCmd, bool bgRedraw) {
 	const int32 actorIdx = drawCmd.actorIdx;
 	ActorStruct *actor = _engine->_scene->getActor(actorIdx);
-	const uint8 *animPtr = _engine->_resources->animTable[actor->previousAnimIdx];
-	const AnimData &animData = _engine->_resources->animData[actor->previousAnimIdx];
-	_engine->_animations->setModelAnimation(actor->animPosition, animData, animPtr, _engine->_actor->bodyTable[actor->entity], &actor->animTimerData);
+	if (actor->previousAnimIdx >= 0) {
+		const uint8 *animPtr = _engine->_resources->animTable[actor->previousAnimIdx];
+		const AnimData &animData = _engine->_resources->animData[actor->previousAnimIdx];
+		_engine->_animations->setModelAnimation(actor->animPosition, animData, animPtr, _engine->_actor->bodyTable[actor->entity], &actor->animTimerData);
+	}
 
 	const int32 x = actor->pos.x - _engine->_grid->camera.x;
 	const int32 y = actor->pos.y - _engine->_grid->camera.y;


Commit: 9e65aad7a2f9929d35576580c04da115b0af9702
    https://github.com/scummvm/scummvm/commit/9e65aad7a2f9929d35576580c04da115b0af9702
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-04T15:32:07+01:00

Commit Message:
TWINE: reduced code duplication

Changed paths:
    engines/twine/renderer/redraw.cpp


diff --git a/engines/twine/renderer/redraw.cpp b/engines/twine/renderer/redraw.cpp
index 9871553f9c..9b70c59f31 100644
--- a/engines/twine/renderer/redraw.cpp
+++ b/engines/twine/renderer/redraw.cpp
@@ -287,7 +287,8 @@ int32 Redraw::fillExtraDrawingList(int32 drawListPos) {
 			_engine->_renderer->projectPositionOnScreen(extra->pos - _engine->_grid->camera);
 
 			if (_engine->_renderer->projPos.x > -50 && _engine->_renderer->projPos.x < _engine->width() + 40 && _engine->_renderer->projPos.y > -30 && _engine->_renderer->projPos.y < _engine->height() + 100) {
-				drawList[drawListPos].posValue = extra->pos.x - _engine->_grid->camera.x + extra->pos.z - _engine->_grid->camera.z;
+				const int16 tmpVal = extra->pos.x - _engine->_grid->camera.x + extra->pos.z - _engine->_grid->camera.z;
+				drawList[drawListPos].posValue = tmpVal;
 				drawList[drawListPos].actorIdx = i;
 				drawList[drawListPos].type = DrawListType::DrawExtras;
 				drawListPos++;
@@ -295,7 +296,7 @@ int32 Redraw::fillExtraDrawingList(int32 drawListPos) {
 				if (_engine->cfgfile.ShadowMode == 2 && !(extra->info0 & EXTRA_SPECIAL_MASK)) {
 					_engine->_movements->getShadowPosition(extra->pos.x, extra->pos.y, extra->pos.z);
 
-					drawList[drawListPos].posValue = extra->pos.x - _engine->_grid->camera.x + extra->pos.z - _engine->_grid->camera.z - 1;
+					drawList[drawListPos].posValue = tmpVal - 1;
 					drawList[drawListPos].actorIdx = 0;
 					drawList[drawListPos].type = DrawListType::DrawShadows;
 					drawList[drawListPos].x = _engine->_actor->shadowCoord.x;


Commit: 262e8a1d57c4077e7d9c7b4c9072644f8eedbcad
    https://github.com/scummvm/scummvm/commit/262e8a1d57c4077e7d9c7b4c9072644f8eedbcad
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-04T16:10:23+01:00

Commit Message:
PRIVATE: fixed invalid memory access

Changed paths:
    engines/private/private.cpp


diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 012dacb44e..f959b53f4f 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -143,8 +143,10 @@ Common::Error PrivateEngine::run() {
 
     // Read assets file
     assert(file != NULL);
-    char *buf = (char *)malloc(file->size()+1);
-    file->read(buf, file->size()+1);
+    const int32 fileSize = file->size();
+    char *buf = (char *)malloc(fileSize + 1);
+    file->read(buf, fileSize);
+    buf[fileSize] = '\0';
 
     // Initialize stuff
     initFuncs();


Commit: 9b2c3c59d3014909ccdd8a42cc00e3374855a908
    https://github.com/scummvm/scummvm/commit/9b2c3c59d3014909ccdd8a42cc00e3374855a908
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-04T16:10:52+01:00

Commit Message:
PRIVATE: also open in file in release builds

Changed paths:
    engines/private/private.cpp


diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index f959b53f4f..0798ddf409 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -173,7 +173,10 @@ Common::Error PrivateEngine::run() {
 
     // Load the game frame once
     Common::File frameFile;
-    assert(frameFile.open(convertPath(_framePath)));
+    const Common::String &frameFilePathname = convertPath(_framePath);
+    if (!frameFile.open(frameFilePathname)) {
+        error("Failed to read %s", frameFilePathname.c_str());
+    }
     _image->loadStream(frameFile);
     _frame = _image->getSurface()->convertTo(_pixelFormat, _image->getPalette());
 




More information about the Scummvm-git-logs mailing list