[Scummvm-git-logs] scummvm master -> 5a532801df073949e3c263fd6b7928ee31673b8c
mduggan
noreply at scummvm.org
Sat Nov 23 03:19:06 UTC 2024
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:
5dbc36ddc0 DGDS: Fix clip window setting
5a532801df DGDS: Ensure scroll image drawn correctly
Commit: 5dbc36ddc056f0eadec77e3a4ac8d0b2d76fa41e
https://github.com/scummvm/scummvm/commit/5dbc36ddc056f0eadec77e3a4ac8d0b2d76fa41e
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2024-11-23T14:14:25+11:00
Commit Message:
DGDS: Fix clip window setting
The values to the TTM op 0x4004 are inclusive x/y values and default to 319/199
in the original, so we need to add 1 when setting the draw rect.
Changed paths:
engines/dgds/ttm.cpp
diff --git a/engines/dgds/ttm.cpp b/engines/dgds/ttm.cpp
index 6740bd33d17..c08ccd00903 100644
--- a/engines/dgds/ttm.cpp
+++ b/engines/dgds/ttm.cpp
@@ -773,7 +773,7 @@ void TTMInterpreter::handleOperation(TTMEnviro &env, TTMSeq &seq, uint16 op, byt
}
case 0x4000: // SET CLIP WINDOW x,y,x2,y2:int [0..320,0..200]
// NOTE: params are xmax/ymax, NOT w/h
- seq._drawWin = Common::Rect(ivals[0], ivals[1], ivals[2], ivals[3]);
+ seq._drawWin = Common::Rect(ivals[0], ivals[1], ivals[2] + 1, ivals[3] + 1);
break;
case 0x4110: // FADE OUT: colorno,ncolors,targetcol,speed:byte
if (seq._executed) // this is a one-shot op.
Commit: 5a532801df073949e3c263fd6b7928ee31673b8c
https://github.com/scummvm/scummvm/commit/5a532801df073949e3c263fd6b7928ee31673b8c
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2024-11-23T14:14:25+11:00
Commit Message:
DGDS: Ensure scroll image drawn correctly
For TTM op 0xA704, make sure we draw enough tiles and add assertions for array
access. This shouldn't change any actual usage of the op in games but adds
some checks to be sure.
Changed paths:
engines/dgds/image.cpp
diff --git a/engines/dgds/image.cpp b/engines/dgds/image.cpp
index 90bbbf0e9d0..80efa3712e6 100644
--- a/engines/dgds/image.cpp
+++ b/engines/dgds/image.cpp
@@ -314,12 +314,17 @@ void Image::drawScrollBitmap(int16 x, int16 y, int16 width, int16 height, int16
int tileH = _frames[0]->h;
byte *dst = (byte *)dstSurf.getBasePtr(0, 0);
- for (int yTile = 0; yTile < height / tileH; yTile++) {
+ int nXTiles = (width + tileW - 1) / tileW;
+ int nYTiles = (height + tileH - 1) / tileH;
+
+ for (int yTile = 0; yTile < nYTiles; yTile++) {
int tileDstY = y + yTile * tileH;
int tileRowIndex = (yTile + scrollY) % _matrixY;
if (tileRowIndex < 0)
tileRowIndex += _matrixY;
- for (int xTile = 0; xTile < width / tileW; xTile++) {
+ assert(tileRowIndex >= 0 && tileRowIndex < _matrixY);
+
+ for (int xTile = 0; xTile < nXTiles; xTile++) {
int tileDstX = x + xTile * tileW;
Common::Rect tileDest(Common::Point(tileDstX, tileDstY), tileW, tileH);
tileDest.clip(drawWin);
@@ -329,6 +334,7 @@ void Image::drawScrollBitmap(int16 x, int16 y, int16 width, int16 height, int16
int tileColIndex = (xTile + scrollX) % _matrixX;
if (tileColIndex < 0)
tileColIndex += _matrixX;
+ assert(tileColIndex >= 0 && tileColIndex < _matrixX);
uint16 tileNo = _tileMatrix[tileRowIndex + tileColIndex * _matrixY];
Common::SharedPtr<Graphics::ManagedSurface> tile = _frames[tileNo];
More information about the Scummvm-git-logs
mailing list