aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorNicola Mettifogo2007-03-13 19:59:45 +0000
committerNicola Mettifogo2007-03-13 19:59:45 +0000
commit33093f3452e0dc1a5e6449ee5fa3ab3459832817 (patch)
tree9e38f2babc000971b3e422315bb470ed20e83319 /engines
parent753c13111ccc5f133ed75a94d640529ea3d5bcc4 (diff)
downloadscummvm-rg350-33093f3452e0dc1a5e6449ee5fa3ab3459832817.tar.gz
scummvm-rg350-33093f3452e0dc1a5e6449ee5fa3ab3459832817.tar.bz2
scummvm-rg350-33093f3452e0dc1a5e6449ee5fa3ab3459832817.zip
made hi-level graphics routine use Common::Rect instead of (x,y,w,h) t-uples
svn-id: r26121
Diffstat (limited to 'engines')
-rw-r--r--engines/parallaction/animation.cpp6
-rw-r--r--engines/parallaction/dialogue.cpp33
-rw-r--r--engines/parallaction/graphics.cpp39
-rw-r--r--engines/parallaction/graphics.h8
-rw-r--r--engines/parallaction/intro.cpp9
-rw-r--r--engines/parallaction/zone.cpp16
6 files changed, 60 insertions, 51 deletions
diff --git a/engines/parallaction/animation.cpp b/engines/parallaction/animation.cpp
index e4971743eb..67f1eba0f3 100644
--- a/engines/parallaction/animation.cpp
+++ b/engines/parallaction/animation.cpp
@@ -233,8 +233,10 @@ void jobEraseAnimations(void *arg_0, Job *j) {
if (((a->_zone._flags & kFlagsActive) == 0) && ((a->_zone._flags & kFlagsRemove) == 0)) continue;
- // printf("jobEraseAnimations %s, x: %i, y: %i, w: %i, h: %i\n", a->_zone._name, a->_zone.pos._oldposition._x, a->_zone.pos._oldposition._y, a->_cnv._width, a->_cnv._height);
- _vm->_gfx->restoreBackground(a->_zone.pos._oldposition._x, a->_zone.pos._oldposition._y, a->_cnv._width, a->_cnv._height);
+ Common::Rect r(a->_cnv._width, a->_cnv._height);
+ r.moveTo(a->_zone.pos._oldposition._x, a->_zone.pos._oldposition._y);
+ _vm->_gfx->restoreBackground(r);
+
if (arg_0) {
a->_zone.pos._oldposition._x = a->_zone.pos._position._x;
a->_zone.pos._oldposition._y = a->_zone.pos._position._y;
diff --git a/engines/parallaction/dialogue.cpp b/engines/parallaction/dialogue.cpp
index 5455f9fad2..732c11ba99 100644
--- a/engines/parallaction/dialogue.cpp
+++ b/engines/parallaction/dialogue.cpp
@@ -283,13 +283,10 @@ void runDialogue(SpeakData *data) {
&question_height
);
- _vm->_gfx->drawBalloon(
- QUESTION_BALLOON_X,
- QUESTION_BALLOON_Y,
- question_width,
- question_height,
- v60->_mood & 0x10
- );
+ Common::Rect r(question_width, question_height);
+ r.moveTo(QUESTION_BALLOON_X, QUESTION_BALLOON_Y);
+
+ _vm->_gfx->drawBalloon(r, v60->_mood & 0x10);
_vm->_gfx->displayWrappedString(
v60->_text,
@@ -334,13 +331,10 @@ void runDialogue(SpeakData *data) {
v60->_answers[_si]
);
- _vm->_gfx->drawBalloon(
- _answerBalloonX[_si],
- _answerBalloonY[_si],
- _answerBalloonW[_si],
- _answerBalloonH[_si],
- 1
- );
+ Common::Rect r(_answerBalloonW[_si], _answerBalloonH[_si]);
+ r.moveTo(_answerBalloonX[_si], _answerBalloonY[_si]);
+
+ _vm->_gfx->drawBalloon(r, 1);
_answerBalloonY[_si+1] = 10 + _answerBalloonY[_si] + _answerBalloonH[_si];
@@ -406,13 +400,10 @@ void runDialogue(SpeakData *data) {
strcpy(password, ".......");
_vm->_gfx->copyScreen(Gfx::kBitBack, Gfx::kBitFront);
- _vm->_gfx->drawBalloon(
- _answerBalloonX[0],
- _answerBalloonY[0],
- _answerBalloonW[0],
- _answerBalloonH[0],
- 1
- );
+ Common::Rect r(_answerBalloonW[0], _answerBalloonH[0]);
+ r.moveTo(_answerBalloonX[0], _answerBalloonY[0]);
+
+ _vm->_gfx->drawBalloon(r, 1);
_vm->_gfx->displayWrappedString(
v60->_answers[0],
diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp
index 4ff09e86e4..4f50d28dc7 100644
--- a/engines/parallaction/graphics.cpp
+++ b/engines/parallaction/graphics.cpp
@@ -108,16 +108,15 @@ byte _resBalloon[2][BALLOON_WIDTH*BALLOON_HEIGHT] = {
}
};
-void Gfx::drawBalloon(int16 left, int16 top, uint16 width, uint16 height, uint16 winding) {
+void Gfx::drawBalloon(const Common::Rect& r, uint16 winding) {
// printf("Gfx::drawBalloon(%i, %i, %i, %i, %i)...", left, top, width, height, winding);
- width+=5;
- floodFill(0, left, top, left+width, top+height, kBitFront);
- floodFill(1, left+1, top+2, left+width-1, top+height-1, kBitFront);
+ floodFill(0, r.left, r.top, r.right+5, r.bottom, kBitFront);
+ floodFill(1, r.left+1, r.top+2, r.right+5-1, r.bottom-1, kBitFront);
winding = (winding == 0 ? 1 : 0);
byte *s = _resBalloon[winding];
- byte *d = _buffers[kBitFront] + (left + width/2 - 5) + (top + height - 1) * SCREEN_WIDTH;
+ byte *d = _buffers[kBitFront] + (r.left + (r.width()+5)/2 - 5) + (r.bottom - 1) * SCREEN_WIDTH;
for (uint16 i = 0; i < BALLOON_HEIGHT; i++) {
for (uint16 j = 0; j < BALLOON_WIDTH; j++) {
@@ -490,8 +489,9 @@ void jobEraseLabel(void *parm, Job *j) {
if (label->_cnv._width + _si > SCREEN_WIDTH)
_si = SCREEN_WIDTH - label->_cnv._width;
-
- _vm->_gfx->restoreBackground(Gfx::_labelPosition[1]._x, Gfx::_labelPosition[1]._y, label->_cnv._width, label->_cnv._height);
+ Common::Rect r(label->_cnv._width, label->_cnv._height);
+ r.moveTo(Gfx::_labelPosition[1]._x, Gfx::_labelPosition[1]._y);
+ _vm->_gfx->restoreBackground(r);
Gfx::_labelPosition[1]._x = Gfx::_labelPosition[0]._x;
Gfx::_labelPosition[1]._y = Gfx::_labelPosition[0]._y;
@@ -605,17 +605,17 @@ void Gfx::backupGetBackground(GetData *data, int16 x, int16 y) {
//
// copies a rectangular bitmap on the background
//
-void Gfx::restoreZoneBackground(byte *data, int16 x, int16 y, uint16 w, uint16 h) {
+void Gfx::restoreZoneBackground(const Common::Rect& r, byte *data) {
StaticCnv cnv;
cnv._data0 = data;
cnv._data1 = NULL;
- cnv._width = w;
- cnv._height = h;
+ cnv._width = r.width();
+ cnv._height = r.height();
- flatBlitCnv(&cnv, x, y, kBitBack, cnv._data1);
- flatBlitCnv(&cnv, x, y, kBit2, cnv._data1);
+ flatBlitCnv(&cnv, r.left, r.top, kBitBack, cnv._data1);
+ flatBlitCnv(&cnv, r.left, r.top, kBit2, cnv._data1);
return;
}
@@ -795,9 +795,14 @@ void Gfx::setFont(const char* name) {
}
-void Gfx::restoreBackground(int16 left, int16 top, uint16 width, uint16 height) {
+void Gfx::restoreBackground(const Common::Rect& r) {
// printf("restoreBackground(%i, %i, %i, %i)\n", left, top, width, height);
+ int16 left = r.left;
+ int16 top = r.top;
+ int16 width = r.width();
+ int16 height = r.height();
+
if (left < 0) left = 0;
if (top < 0) top = 0;
@@ -994,12 +999,12 @@ void Gfx::maskOpNot(uint16 x, uint16 y, uint16 unused, Gfx::Buffers mask) {
-void Gfx::maskClearRectangle(uint16 left, uint16 top, uint16 right, uint16 bottom, Gfx::Buffers mask) {
+void Gfx::maskClearRectangle(const Common::Rect& r, Gfx::Buffers mask) {
- uint16 _di = left/4 + top*80;
+ uint16 _di = r.left/4 + r.top*80;
- for (uint16 _si = top; _si < bottom; _si++) {
- memset(&_buffers[mask][_di], 0, (right - left)/4+1);
+ for (uint16 _si = r.top; _si < r.bottom; _si++) {
+ memset(&_buffers[mask][_di], 0, r.width()/4+1);
_di += 80;
}
diff --git a/engines/parallaction/graphics.h b/engines/parallaction/graphics.h
index 64358312cb..ba7dc05823 100644
--- a/engines/parallaction/graphics.h
+++ b/engines/parallaction/graphics.h
@@ -80,7 +80,7 @@ public:
public:
// dialogue and text
- void drawBalloon(int16 left, int16 top, uint16 width, uint16 height, uint16 arg_8);
+ void drawBalloon(const Common::Rect& r, uint16 arg_8);
void displayBalloonString(uint16 x, uint16 y, const char *text, byte color);
void displayString(uint16 x, uint16 y, const char *text);
bool displayWrappedString(char *text, uint16 x, uint16 y, uint16 maxwidth, byte color);
@@ -93,7 +93,7 @@ public:
void freeStaticCnv(StaticCnv *cnv);
void backupDoorBackground(DoorData *data, int16 x, int16 y);
void backupGetBackground(GetData *data, int16 x, int16 y);
- void restoreZoneBackground(byte *data, int16 x, int16 y, uint16 w, uint16 h);
+ void restoreZoneBackground(const Common::Rect& r, byte *data);
// location
void setBackground(byte *background);
@@ -102,10 +102,10 @@ public:
void parseBackground(Common::SeekableReadStream &stream);
int16 queryMask(int16 v);
void intGrottaHackMask();
- void restoreBackground(int16 left, int16 top, uint16 width, uint16 height);
+ void restoreBackground(const Common::Rect& r);
// intro
- void maskClearRectangle(uint16 left, uint16 top, uint16 right, uint16 bottom, Gfx::Buffers mask);
+ void maskClearRectangle(const Common::Rect& r, Gfx::Buffers mask);
void maskOpNot(uint16 x, uint16 y, uint16 unused, Gfx::Buffers mask);
// low level
diff --git a/engines/parallaction/intro.cpp b/engines/parallaction/intro.cpp
index a24842b885..fc7f0d0a98 100644
--- a/engines/parallaction/intro.cpp
+++ b/engines/parallaction/intro.cpp
@@ -318,11 +318,14 @@ void _c_sketch(void *parm) {
void _c_shade(void *parm) {
- _vm->_gfx->maskClearRectangle(_rightHandAnim->_zone.pos._position._x - 36,
+ Common::Rect r(
+ _rightHandAnim->_zone.pos._position._x - 36,
_rightHandAnim->_zone.pos._position._y - 36,
_rightHandAnim->_zone.pos._position._x,
- _rightHandAnim->_zone.pos._position._y,
- Gfx::kMask0 );
+ _rightHandAnim->_zone.pos._position._y
+ );
+
+ _vm->_gfx->maskClearRectangle(r, Gfx::kMask0 );
return;
diff --git a/engines/parallaction/zone.cpp b/engines/parallaction/zone.cpp
index c656e48140..e6f48d28c1 100644
--- a/engines/parallaction/zone.cpp
+++ b/engines/parallaction/zone.cpp
@@ -377,7 +377,9 @@ void displayCharacterComment(ExamineData *data) {
int16 v26, v28;
_vm->_gfx->getStringExtent(data->_description, 130, &v28, &v26);
- _vm->_gfx->drawBalloon(140, 10, v28, v26, 0);
+ Common::Rect r(v28, v26);
+ r.moveTo(140, 10);
+ _vm->_gfx->drawBalloon(r, 0);
_vm->_gfx->displayWrappedString(data->_description, 140, 10, 130, 0);
waitUntilLeftClick();
@@ -410,7 +412,9 @@ void displayItemComment(ExamineData *data) {
_vm->_gfx->setFont("comic");
_vm->_gfx->getStringExtent(data->_description, 130, &v6C, &v6A);
- _vm->_gfx->drawBalloon(0, 90, v6C, v6A, 0);
+ Common::Rect r(v6C, v6A);
+ r.moveTo(0, 90);
+ _vm->_gfx->drawBalloon(r, 0);
_vm->_gfx->flatBlitCnv(&_yourHead, 100, 152, Gfx::kBitFront, _yourHead._data1);
_vm->_gfx->displayWrappedString(data->_description, 0, 90, 130, 0);
@@ -487,7 +491,9 @@ void jobToggleDoor(void *parm, Job *j) {
v14._width = v18->_width;
v14._height = v18->_height;
- _vm->_gfx->restoreZoneBackground(z->u.door->_background, z->_limits._left, z->_limits._top, v18->_width, v18->_height);
+ Common::Rect r(z->_limits._left, z->_limits._top, z->_limits._left+v18->_width, z->_limits._top+v18->_height);
+
+ _vm->_gfx->restoreZoneBackground(r, z->u.door->_background);
uint16 _ax = (z->_flags & kFlagsClosed ? 0 : 1);
@@ -522,7 +528,9 @@ void jobRemovePickedItem(void *parm, Job *j) {
static uint16 count = 0;
if (z->u.get->_cnv._width != 0) {
- _vm->_gfx->restoreZoneBackground(z->u.get->_backup, z->_limits._left, z->_limits._top, z->u.get->_cnv._width, z->u.get->_cnv._height);
+ Common::Rect r(z->_limits._left, z->_limits._top, z->_limits._left + z->u.get->_cnv._width, z->_limits._top + z->u.get->_cnv._height);
+
+ _vm->_gfx->restoreZoneBackground(r, z->u.get->_backup);
}
count++;