aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorGregory Montoir2006-11-12 03:02:20 +0000
committerGregory Montoir2006-11-12 03:02:20 +0000
commit196c8a37718052c3b465af53f0b3324d0ee77533 (patch)
tree61f0fa2d4f3c1381db4e81a9a4fc9b3e5bba2193 /engines
parente61526555c7e1a6cca20d8824b0ae5c0fb12f184 (diff)
downloadscummvm-rg350-196c8a37718052c3b465af53f0b3324d0ee77533.tar.gz
scummvm-rg350-196c8a37718052c3b465af53f0b3324d0ee77533.tar.bz2
scummvm-rg350-196c8a37718052c3b465af53f0b3324d0ee77533.zip
cleanup
svn-id: r24683
Diffstat (limited to 'engines')
-rw-r--r--engines/touche/graphics.cpp31
-rw-r--r--engines/touche/graphics.h5
-rw-r--r--engines/touche/touche.cpp46
-rw-r--r--engines/touche/touche.h4
-rw-r--r--engines/touche/ui.cpp6
5 files changed, 42 insertions, 50 deletions
diff --git a/engines/touche/graphics.cpp b/engines/touche/graphics.cpp
index 5f1e479d91..db3c687471 100644
--- a/engines/touche/graphics.cpp
+++ b/engines/touche/graphics.cpp
@@ -152,21 +152,12 @@ void Graphics::drawLine(uint8 *dst, int dstPitch, int x1, int y1, int x2, int y2
void Graphics::copyRect(uint8 *dst, int dstPitch, int dstX, int dstY, const uint8 *src, int srcPitch, int srcX, int srcY, int w, int h, int flags) {
if (w != 0 && h != 0) {
- if (flags & kHFlipped) {
- srcY += h - 1;
- srcPitch = -srcPitch;
- }
- int u = 1;
- if (flags & kVFlipped) {
- srcX += w - 1;
- u = -1;
- }
dst += dstY * dstPitch + dstX;
src += srcY * srcPitch + srcX;
while (h--) {
for (int i = 0; i < w; ++i) {
- if ((flags & kTransparent) == 0 || src[u * i] != 0) {
- dst[i] = src[u * i];
+ if ((flags & kTransparent) == 0 || src[i] != 0) {
+ dst[i] = src[i];
}
}
dst += dstPitch;
@@ -176,16 +167,18 @@ void Graphics::copyRect(uint8 *dst, int dstPitch, int dstX, int dstY, const uint
}
void Graphics::copyMask(uint8 *dst, int dstPitch, int dstX, int dstY, const uint8 *src, int srcPitch, int srcX, int srcY, int w, int h, uint8 fillColor) {
- dst += dstY * dstPitch + dstX;
- src += srcY * srcPitch + srcX;
- while (h--) {
- for (int i = 0; i < w; ++i) {
- if (src[i] != 0) {
- dst[i] = fillColor;
+ if (w != 0 && h != 0) {
+ dst += dstY * dstPitch + dstX;
+ src += srcY * srcPitch + srcX;
+ while (h--) {
+ for (int i = 0; i < w; ++i) {
+ if (src[i] != 0) {
+ dst[i] = fillColor;
+ }
}
+ dst += dstPitch;
+ src += srcPitch;
}
- dst += dstPitch;
- src += srcPitch;
}
}
diff --git a/engines/touche/graphics.h b/engines/touche/graphics.h
index 9c5bbf98fa..ab9ed3475a 100644
--- a/engines/touche/graphics.h
+++ b/engines/touche/graphics.h
@@ -28,10 +28,9 @@
namespace Touche {
struct Graphics {
+
enum {
- kVFlipped = 1 << 0,
- kHFlipped = 1 << 1,
- kTransparent = 1 << 2
+ kTransparent = 1 << 0
};
static int getStringWidth16(const char *str);
diff --git a/engines/touche/touche.cpp b/engines/touche/touche.cpp
index 9ab32fa6df..191a605d12 100644
--- a/engines/touche/touche.cpp
+++ b/engines/touche/touche.cpp
@@ -1244,10 +1244,10 @@ int ToucheEngine::getStringWidth(int num) const {
return Graphics::getStringWidth16(str);
}
-void ToucheEngine::drawString(uint8 *dst, int dstPitch, uint16 color, int x, int y, int16 num) {
+void ToucheEngine::drawString(uint16 color, int x, int y, int16 num) {
if (num) {
const char *str = getString(num);
- Graphics::drawString16(dst, dstPitch, color, x, y, str);
+ Graphics::drawString16(_offscreenBuffer, 640, color, x, y, str);
}
}
@@ -1810,9 +1810,9 @@ int ToucheEngine::handleActionMenuUnderCursor(const int16 *actions, int offs, in
if (actionsTable[i] == 0) {
break;
}
- drawString(_offscreenBuffer, 640, 0xF8F9, offs, y + i * 16, actionsTable[i]);
+ drawString(0xF8F9, offs, y + i * 16, actionsTable[i]);
}
- updateScreenArea(_offscreenBuffer, 640, cursorPosX, cursorPosY, cursorPosX, cursorPosY, cursorW, cursorH);
+ updateScreenArea(cursorPosX, cursorPosY, cursorW, cursorH);
_redrawScreenCounter1 = 2;
Common::Rect rect(0, y, 640, y + h);
@@ -1823,18 +1823,18 @@ int ToucheEngine::handleActionMenuUnderCursor(const int16 *actions, int offs, in
if (c != i) {
if (i >= 0) {
drawY = y + i * 16;
- drawString(_offscreenBuffer, 640, 0xF8F9, offs, drawY, actionsTable[i]);
- updateScreenArea(_offscreenBuffer, 640, offs, drawY, offs, drawY, strW, 16);
+ drawString(0xF8F9, offs, drawY, actionsTable[i]);
+ updateScreenArea(offs, drawY, strW, 16);
}
i = c;
drawY = y + i * 16;
- drawString(_offscreenBuffer, 640, 0xF8FF, offs, drawY, actionsTable[i]);
- updateScreenArea(_offscreenBuffer, 640, offs, drawY, offs, drawY, strW, 16);
+ drawString(0xF8FF, offs, drawY, actionsTable[i]);
+ updateScreenArea(offs, drawY, strW, 16);
}
} else if (i >= 0) {
drawY = y + i * 16;
- drawString(_offscreenBuffer, 640, 0xF8F9, offs, drawY, actionsTable[i]);
- updateScreenArea(_offscreenBuffer, 640, offs, drawY, offs, drawY, strW, 16);
+ drawString(0xF8F9, offs, drawY, actionsTable[i]);
+ updateScreenArea(offs, drawY, strW, 16);
i = -1;
}
processEvents(false);
@@ -2064,7 +2064,7 @@ void ToucheEngine::drawInventory(int index, int flag) {
}
}
drawAmountOfMoneyInInventory();
- updateScreenArea(_offscreenBuffer, 640, 0, 352, 0, 352, 640, 48);
+ updateScreenArea(0, 352, 640, 48);
}
}
@@ -2074,14 +2074,14 @@ void ToucheEngine::drawAmountOfMoneyInInventory() {
sprintf(text, "%d", _keyCharsTable[0].money);
Graphics::fillRect(_offscreenBuffer, 640, 74, 354, 40, 16, 0xD2);
drawGameString(217, 94, 355, text);
- updateScreenArea(_offscreenBuffer, 640, 74, 354, 74, 354, 40, 16);
+ updateScreenArea(74, 354, 40, 16);
Graphics::fillRect(_offscreenBuffer, 640, 150, 353, 40, 41, 0xD2);
if (_currentAmountOfMoney != 0) {
drawIcon(141, 348, 1);
sprintf(text, "%d", _currentAmountOfMoney);
drawGameString(217, 170, 378, text);
}
- updateScreenArea(_offscreenBuffer, 640, 150, 353, 150, 353, 40, 41);
+ updateScreenArea(150, 353, 40, 41);
}
}
@@ -2432,21 +2432,21 @@ void ToucheEngine::drawCharacterConversation() {
}
drawConversationPanel();
for (int i = 0; i < 4; ++i) {
- drawString(_offscreenBuffer, 640, 214, 42, 328 + i * 16, _conversationChoicesTable[_scrollConversationChoiceOffset + i].msg);
+ drawString(214, 42, 328 + i * 16, _conversationChoicesTable[_scrollConversationChoiceOffset + i].msg);
}
- updateScreenArea(_offscreenBuffer, 640, 0, 320, 0, 320, 640, 80);
+ updateScreenArea(0, 320, 640, 80);
_conversationAreaCleared = false;
}
void ToucheEngine::drawConversationString(int num, uint16 color) {
const int y = 328 + num * 16;
- drawString(_offscreenBuffer, 640, color, 42, y, _conversationChoicesTable[num + _scrollConversationChoiceOffset].msg);
- updateScreenArea(_offscreenBuffer, 640, 0, y, 0, y, 640, 16);
+ drawString(color, 42, y, _conversationChoicesTable[num + _scrollConversationChoiceOffset].msg);
+ updateScreenArea(0, y, 640, 16);
}
void ToucheEngine::clearConversationArea() {
drawConversationPanel();
- updateScreenArea(_offscreenBuffer, 640, 0, 320, 0, 320, 640, 80);
+ updateScreenArea(0, 320, 640, 80);
_conversationAreaCleared = true;
}
@@ -3230,8 +3230,8 @@ void ToucheEngine::setPalette(int firstColor, int colorCount, int rScale, int gS
_system->setPalette(&pal[firstColor * 4], firstColor, colorCount);
}
-void ToucheEngine::updateScreenArea(const uint8 *src, int srcPitch, int srcX, int srcY, int dstX, int dstY, int w, int h) {
- _system->copyRectToScreen(src + srcY * srcPitch + srcX, srcPitch, dstX, dstY, w, h);
+void ToucheEngine::updateScreenArea(int x, int y, int w, int h) {
+ _system->copyRectToScreen(_offscreenBuffer + y * 640 + x, 640, x, y, w, h);
_system->updateScreen();
}
@@ -3243,18 +3243,18 @@ void ToucheEngine::updateEntireScreen() {
void ToucheEngine::updateDirtyScreenAreas() {
// XXX
- updateScreenArea(_offscreenBuffer, 640, 0, 0, 0, 0, 640, 400);
+ updateScreenArea(0, 0, 640, 400);
if (_fullRedrawCounter) {
// updateEntireScreen();
--_fullRedrawCounter;
} else {
// for (int i = 0; i < _dirtyRectsCount; ++i) {
// Common::Rect *r = &_dirtyRects[i];
-// updateScreenArea(_offscreenBuffer, 640, r->x, r->y, r->x, r->y, r->w, r->h);
+// updateScreenArea(r->x, r->y, r->w, r->h);
// }
if (_redrawScreenCounter1) {
--_redrawScreenCounter1;
-// updateScreenArea(_offscreenBuffer, 640, _cursorObjectRect.x, _cursorObjectRect.y, _cursorObjectRect.x, _cursorObjectRect.y, _cursorObjectRect.w, _cursorObjectRect.h);
+// updateScreenArea(_cursorObjectRect.x, _cursorObjectRect.y, _cursorObjectRect.w, _cursorObjectRect.h);
}
}
}
diff --git a/engines/touche/touche.h b/engines/touche/touche.h
index 812e4a528c..dd37f0bf92 100644
--- a/engines/touche/touche.h
+++ b/engines/touche/touche.h
@@ -380,7 +380,7 @@ protected:
void setKeyCharMoney();
const char *getString(int num) const;
int getStringWidth(int num) const;
- void drawString(uint8 *dst, int dstPitch, uint16 color, int x, int y, int16 num);
+ void drawString(uint16 color, int x, int y, int16 num);
void drawGameString(uint16 color, int x1, int y, const char *str);
int restartKeyCharScriptOnAction(int action, int obj1, int obj2);
void buildSpriteScalingTable(int z1, int z2);
@@ -463,7 +463,7 @@ protected:
void addToDirtyRect(const Common::Rect &r);
void clearDirtyRects();
void setPalette(int firstColor, int colorCount, int redScale, int greenScale, int blueScale);
- void updateScreenArea(const uint8 *src, int srcPitch, int srcX, int srcY, int dstX, int dstY, int w, int h);
+ void updateScreenArea(int x, int y, int w, int h);
void updateEntireScreen();
void updateDirtyScreenAreas();
void updatePalette();
diff --git a/engines/touche/ui.cpp b/engines/touche/ui.cpp
index 7c9c28b9cf..d2c2f1c3eb 100644
--- a/engines/touche/ui.cpp
+++ b/engines/touche/ui.cpp
@@ -406,7 +406,7 @@ void ToucheEngine::handleOptions(int forceDisplay) {
break;
}
}
- updateScreenArea(_offscreenBuffer, 640, 90, 102, 90, 102, 460, 196);
+ updateScreenArea(90, 102, 460, 196);
_system->updateScreen();
_system->delayMillis(50);
}
@@ -513,14 +513,14 @@ void ToucheEngine::printStatusString(const char *str) {
Graphics::fillRect(_offscreenBuffer, 640, 0, 0, 640, 16, 0xD7);
Graphics::drawRect(_offscreenBuffer, 640, 0, 0, 640, 16, 0xD6, 0xD8);
Graphics::drawString16(_offscreenBuffer, 640, 0xFF, 0, 0, str);
- updateScreenArea(_offscreenBuffer, 640, 0, 0, 0, 0, 640, 16);
+ updateScreenArea(0, 0, 640, 16);
}
void ToucheEngine::clearStatusString() {
Graphics::copyRect(_offscreenBuffer, 640, 0, 0,
_backdropBuffer, _currentBitmapWidth, _flagsTable[614], _flagsTable[615],
640, 16);
- updateScreenArea(_offscreenBuffer, 640, 0, 0, 0, 0, 640, 16);
+ updateScreenArea(0, 0, 640, 16);
}
int ToucheEngine::displayQuitDialog() {