aboutsummaryrefslogtreecommitdiff
path: root/engines/startrek
diff options
context:
space:
mode:
authorMatthew Stewart2018-02-25 02:18:02 -0500
committerEugene Sandulenko2018-08-09 08:37:30 +0200
commit060d10c463f10077d733a41ad0a827b678e8b15d (patch)
treef69a7850160a07225bf264d4ef3e527e0ce67edc /engines/startrek
parenta69f025818224c9bfeb52be11f31a2b6387bb76f (diff)
downloadscummvm-rg350-060d10c463f10077d733a41ad0a827b678e8b15d.tar.gz
scummvm-rg350-060d10c463f10077d733a41ad0a827b678e8b15d.tar.bz2
scummvm-rg350-060d10c463f10077d733a41ad0a827b678e8b15d.zip
STARTREK: Fix off-by-1 bug in drawSprite
Diffstat (limited to 'engines/startrek')
-rwxr-xr-xengines/startrek/graphics.cpp18
-rwxr-xr-xengines/startrek/startrek.cpp6
2 files changed, 12 insertions, 12 deletions
diff --git a/engines/startrek/graphics.cpp b/engines/startrek/graphics.cpp
index 467d1f5605..a717ec70a7 100755
--- a/engines/startrek/graphics.cpp
+++ b/engines/startrek/graphics.cpp
@@ -165,8 +165,8 @@ void Graphics::drawSprite(const Sprite &sprite, const Common::Rect &rect) {
int priOffset = rect.top*SCREEN_WIDTH + rect.left;
- for (int y=rect.top; y<rect.bottom; y++) {
- for (int x=rect.left; x<rect.right; x++) {
+ for (int y=rect.top; y<=rect.bottom; y++) {
+ for (int x=rect.left; x<=rect.right; x++) {
byte priByte = _priData[priOffset/2];
byte bgPriority;
if ((priOffset%2) == 1)
@@ -183,9 +183,9 @@ void Graphics::drawSprite(const Sprite &sprite, const Common::Rect &rect) {
*dest++ = b;
}
- src += sprite.bitmap->width - rect.width();
- dest += SCREEN_WIDTH - rect.width();
- priOffset += SCREEN_WIDTH - rect.width();
+ src += sprite.bitmap->width - rect.width() - 1;
+ dest += SCREEN_WIDTH - rect.width() - 1;
+ priOffset += SCREEN_WIDTH - rect.width() - 1;
}
break;
}
@@ -197,8 +197,8 @@ void Graphics::drawSprite(const Sprite &sprite, const Common::Rect &rect) {
byte *src = sprite.bitmap->pixels + (rect.left - sprite.drawX)
+ (rect.top - sprite.drawY) * sprite.bitmap->width;
- for (int y=rect.top; y<rect.bottom; y++) {
- for (int x=rect.left; x<rect.right; x++) {
+ for (int y=rect.top; y<=rect.bottom; y++) {
+ for (int x=rect.left; x<=rect.right; x++) {
byte b = *src;
if (b == 0) // Transparent (darken the pixel)
@@ -210,8 +210,8 @@ void Graphics::drawSprite(const Sprite &sprite, const Common::Rect &rect) {
dest++;
}
- src += sprite.bitmap->width - rect.width();
- dest += SCREEN_WIDTH - rect.width();
+ src += sprite.bitmap->width - rect.width() - 1;
+ dest += SCREEN_WIDTH - rect.width() - 1;
}
break;
diff --git a/engines/startrek/startrek.cpp b/engines/startrek/startrek.cpp
index 726fc3fe6e..b79811128d 100755
--- a/engines/startrek/startrek.cpp
+++ b/engines/startrek/startrek.cpp
@@ -117,8 +117,8 @@ Common::Error StarTrekEngine::run() {
_gfx->addSprite(spr);
spr->bitmap = _gfx->loadBitmap("KWALKS00");
spr->drawPriority = 1;
- spr->pos.x = 200;
- spr->pos.y = 140;
+ spr->pos.x = 230;
+ spr->pos.y = 100;
spr->drawMode = 2;
/*
@@ -141,7 +141,7 @@ Common::Error StarTrekEngine::run() {
*/
- _gfx->showText(&Graphics::tmpFunction, 0, 150, 50, 0xb3, 0, 10, 0);
+ _gfx->showText(&Graphics::tmpFunction, 0, 150, 180, 0xb3, 0, 10, 0);
while (!shouldQuit()) {
pollEvents();