diff options
author | Matthew Stewart | 2018-02-25 02:18:02 -0500 |
---|---|---|
committer | Eugene Sandulenko | 2018-08-09 08:37:30 +0200 |
commit | 060d10c463f10077d733a41ad0a827b678e8b15d (patch) | |
tree | f69a7850160a07225bf264d4ef3e527e0ce67edc /engines/startrek | |
parent | a69f025818224c9bfeb52be11f31a2b6387bb76f (diff) | |
download | scummvm-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-x | engines/startrek/graphics.cpp | 18 | ||||
-rwxr-xr-x | engines/startrek/startrek.cpp | 6 |
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(); |