[Scummvm-git-logs] scummvm master -> 46e2ac8b8511536df803d068adf30838051da0cd
antoniou79
noreply at scummvm.org
Fri May 19 21:24:58 UTC 2023
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
46e2ac8b85 TOON: Fix another overreading of picture data
Commit: 46e2ac8b8511536df803d068adf30838051da0cd
https://github.com/scummvm/scummvm/commit/46e2ac8b8511536df803d068adf30838051da0cd
Author: antoniou (a.antoniou79 at gmail.com)
Date: 2023-05-20T00:03:58+03:00
Commit Message:
TOON: Fix another overreading of picture data
This was in Picture::floodFillNotWalkableOnMask() and only needed reordering of the logic AND clauses
Changed paths:
engines/toon/picture.cpp
diff --git a/engines/toon/picture.cpp b/engines/toon/picture.cpp
index 26c964150f4..f3ad4f42af5 100644
--- a/engines/toon/picture.cpp
+++ b/engines/toon/picture.cpp
@@ -118,7 +118,6 @@ bool Picture::loadPicture(const Common::String &file) {
uint32 decSize = READ_BE_UINT32(fileData + 4);
_data = new uint8[decSize];
-
decSize = rnc.unpackM2(fileData, _data);
if (decSize > TOON_SCREEN_WIDTH * TOON_SCREEN_HEIGHT + 768)
@@ -282,21 +281,23 @@ void Picture::floodFillNotWalkableOnMask(int16 x, int16 y) {
pt.y++;
bool spanLeft = false;
bool spanRight = false;
- while (_data[pt.x + pt.y * _width] & 0x1F && pt.y < _height) {
- _data[pt.x + pt.y * _width] &= 0xE0;
- if (!spanLeft && pt.x > 0 && _data[pt.x - 1 + pt.y * _width] & 0x1F) {
+ uint32 nextDataPos = pt.x + pt.y * _width;
+ while (pt.y < _height && _data[nextDataPos] & 0x1F) {
+ _data[nextDataPos] &= 0xE0;
+ if (!spanLeft && pt.x > 0 && _data[nextDataPos - 1] & 0x1F) {
stack.push(Common::Point(pt.x - 1, pt.y));
spanLeft = 1;
- } else if (spanLeft && pt.x > 0 && !(_data[pt.x - 1 + pt.y * _width] & 0x1F)) {
+ } else if (spanLeft && pt.x > 0 && !(_data[nextDataPos - 1] & 0x1F)) {
spanLeft = 0;
}
- if (!spanRight && pt.x < _width - 1 && _data[pt.x + 1 + pt.y * _width] & 0x1F) {
+ if (!spanRight && pt.x < _width - 1 && _data[nextDataPos + 1] & 0x1F) {
stack.push(Common::Point(pt.x + 1, pt.y));
spanRight = 1;
- } else if (spanRight && pt.x < _width - 1 && !(_data[pt.x + 1 + pt.y * _width] & 0x1F)) {
+ } else if (spanRight && pt.x < _width - 1 && !(_data[nextDataPos + 1] & 0x1F)) {
spanRight = 0;
}
pt.y++;
+ nextDataPos = pt.x + pt.y * _width;
}
}
}
More information about the Scummvm-git-logs
mailing list