aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2015-10-16 22:30:55 -0400
committerPaul Gilbert2015-10-16 22:30:55 -0400
commitf688d2806d02ad1e1a98a033774024c3d0727858 (patch)
treeeec93b2dfddcffcc7d8ee981c203effcd052b4b1
parentb548e4b482d64d0ab9df908d002709377ca8596a (diff)
downloadscummvm-rg350-f688d2806d02ad1e1a98a033774024c3d0727858.tar.gz
scummvm-rg350-f688d2806d02ad1e1a98a033774024c3d0727858.tar.bz2
scummvm-rg350-f688d2806d02ad1e1a98a033774024c3d0727858.zip
SHERLOCK: RT: Fix drawing of darts game dart throws
-rw-r--r--engines/sherlock/tattoo/tattoo_darts.cpp75
1 files changed, 37 insertions, 38 deletions
diff --git a/engines/sherlock/tattoo/tattoo_darts.cpp b/engines/sherlock/tattoo/tattoo_darts.cpp
index f05e97ef32..cf5f39fd5d 100644
--- a/engines/sherlock/tattoo/tattoo_darts.cpp
+++ b/engines/sherlock/tattoo/tattoo_darts.cpp
@@ -561,7 +561,6 @@ void Darts::drawDartThrow(const Common::Point &dartPos, int computer) {
Events &events = *_vm->_events;
Screen &screen = *_vm->_screen;
int cx, cy;
- int drawX = 0, drawY = 0, oldDrawX = 0, oldDrawY = 0;
int xSize = 0, ySize = 0, oldxSize = 0, oldySize = 0;
int handOCx = 0, handOCy = 0;
int ocx = 0, ocy = 0;
@@ -569,6 +568,7 @@ void Darts::drawDartThrow(const Common::Point &dartPos, int computer) {
int delta = 9;
int dartNum;
int hddy;
+ Common::Point drawPos, oldDrawPos;
// Draw the animation of the hand throwing the dart first
// See which hand animation to use
@@ -608,37 +608,37 @@ void Darts::drawDartThrow(const Common::Point &dartPos, int computer) {
xSize = (*_dartGraphics)[dartNum]._width;
ySize = (*_dartGraphics)[dartNum]._height;
- ocx = drawX = cx - (*_dartGraphics)[dartNum]._width / 2;
- ocy = drawY = cy - (*_dartGraphics)[dartNum]._height;
+ ocx = drawPos.x = cx - (*_dartGraphics)[dartNum]._width / 2;
+ ocy = drawPos.y = cy - (*_dartGraphics)[dartNum]._height;
// Draw dart
- screen._backBuffer1.transBlitFrom((*_dartGraphics)[dartNum], dartPos);
+ screen._backBuffer1.transBlitFrom((*_dartGraphics)[dartNum], drawPos);
- if (drawX < 0) {
- xSize += drawX;
+ if (drawPos.x < 0) {
+ xSize += drawPos.x;
if (xSize < 0)
xSize = 1;
- drawX = 0;
+ drawPos.x = 0;
}
- if (drawY < 0) {
- ySize += drawY;
+ if (drawPos.y < 0) {
+ ySize += drawPos.y;
if (ySize < 0)
ySize = 1;
- drawY = 0;
+ drawPos.y = 0;
}
// Flush the drawn dart to the screen
- screen.slamArea(drawX, drawY, xSize, ySize);
- if (oldDrawX != -1)
+ screen.slamArea(drawPos.x, drawPos.y, xSize, ySize);
+ if (oldDrawPos.x != -1)
// Flush the erased dart area
- screen.slamArea(oldDrawX, oldDrawY, oldxSize, oldySize);
+ screen.slamArea(oldDrawPos.x, oldDrawPos.y, oldxSize, oldySize);
- screen._backBuffer1.blitFrom(screen._backBuffer2, Common::Point(drawX, drawY),
- Common::Rect(drawX, drawY, drawX + xSize, drawY + ySize));
+ screen._backBuffer1.blitFrom(screen._backBuffer2, Common::Point(drawPos.x, drawPos.y),
+ Common::Rect(drawPos.x, drawPos.y, drawPos.x + xSize, drawPos.y + ySize));
- oldDrawX = drawX;
- oldDrawY = drawY;
+ oldDrawPos.x = drawPos.x;
+ oldDrawPos.y = drawPos.y;
oldxSize = xSize;
oldySize = ySize;
@@ -652,15 +652,15 @@ void Darts::drawDartThrow(const Common::Point &dartPos, int computer) {
screen.slamArea(handOCx, handOCy, handOldxSize, handOldySize);
// Erase the old dart
- if (oldDrawX != -1)
- screen.slamArea(oldDrawX, oldDrawY, oldxSize, oldySize);
+ if (oldDrawPos.x != -1)
+ screen.slamArea(oldDrawPos.x, oldDrawPos.y, oldxSize, oldySize);
- screen._backBuffer1.blitFrom(screen._backBuffer2, Common::Point(drawX, drawY),
- Common::Rect(drawX, drawY, drawX + xSize, drawY + ySize));
+ screen._backBuffer1.blitFrom(screen._backBuffer2, Common::Point(drawPos.x, drawPos.y),
+ Common::Rect(drawPos.x, drawPos.y, drawPos.x + xSize, drawPos.y + ySize));
cx = dartPos.x;
cy = dartPos.y + 2;
- oldDrawX = oldDrawY = -1;
+ oldDrawPos.x = oldDrawPos.y = -1;
for (int idx = 5; idx <= 23; ++idx) {
dartNum = idx - 4;
@@ -678,38 +678,37 @@ void Darts::drawDartThrow(const Common::Point &dartPos, int computer) {
xSize = (*_dartGraphics)[dartNum]._width;
ySize = (*_dartGraphics)[dartNum]._height;
- ocx = drawX = cx - (*_dartGraphics)[dartNum]._width / 2;
- ocy = drawY = cy - (*_dartGraphics)[dartNum]._height;
+ ocx = drawPos.x = cx - (*_dartGraphics)[dartNum]._width / 2;
+ ocy = drawPos.y = cy - (*_dartGraphics)[dartNum]._height;
- screen._backBuffer1.transBlitFrom((*_dartGraphics)[dartNum], Common::Point(drawX, drawY));
+ screen._backBuffer1.transBlitFrom((*_dartGraphics)[dartNum], Common::Point(drawPos.x, drawPos.y));
- if (drawX < 0) {
- xSize += drawX;
+ if (drawPos.x < 0) {
+ xSize += drawPos.x;
if (xSize < 0)
xSize = 1;
- drawX = 0;
+ drawPos.x = 0;
}
- if (drawY < 0) {
- ySize += drawY;
+ if (drawPos.y < 0) {
+ ySize += drawPos.y;
if (ySize < 0)
ySize = 1;
- drawY = 0;
+ drawPos.y = 0;
}
// flush the dart
- screen.slamArea(drawX, drawY, xSize, ySize);
- if (oldDrawX != -1)
- screen.slamArea(oldDrawX, oldDrawY, oldxSize, oldySize);
+ screen.slamArea(drawPos.x, drawPos.y, xSize, ySize);
+ if (oldDrawPos.x != -1)
+ screen.slamArea(oldDrawPos.x, oldDrawPos.y, oldxSize, oldySize);
if (idx != 23)
- screen._backBuffer1.blitFrom(screen._backBuffer2, Common::Point(drawX, drawY),
- Common::Rect(drawX, drawY, drawX + xSize, drawY + ySize)); // erase dart
+ screen._backBuffer1.blitFrom(screen._backBuffer2, drawPos,
+ Common::Rect(drawPos.x, drawPos.y, drawPos.x + xSize, drawPos.y + ySize)); // erase dart
events.wait(1);
- oldDrawX = drawX;
- oldDrawY = drawY;
+ oldDrawPos = drawPos;
oldxSize = xSize;
oldySize = ySize;
}