From 060d10c463f10077d733a41ad0a827b678e8b15d Mon Sep 17 00:00:00 2001 From: Matthew Stewart Date: Sun, 25 Feb 2018 02:18:02 -0500 Subject: STARTREK: Fix off-by-1 bug in drawSprite --- engines/startrek/graphics.cpp | 18 +++++++++--------- engines/startrek/startrek.cpp | 6 +++--- 2 files changed, 12 insertions(+), 12 deletions(-) (limited to 'engines/startrek') 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; ywidth - 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; ywidth - 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(); -- cgit v1.2.3