[Scummvm-cvs-logs] SF.net SVN: scummvm: [26121] scummvm/trunk/engines/parallaction

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Tue Mar 13 20:59:46 CET 2007


Revision: 26121
          http://scummvm.svn.sourceforge.net/scummvm/?rev=26121&view=rev
Author:   peres001
Date:     2007-03-13 12:59:45 -0700 (Tue, 13 Mar 2007)

Log Message:
-----------
made hi-level graphics routine use Common::Rect instead of (x,y,w,h) t-uples

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/animation.cpp
    scummvm/trunk/engines/parallaction/dialogue.cpp
    scummvm/trunk/engines/parallaction/graphics.cpp
    scummvm/trunk/engines/parallaction/graphics.h
    scummvm/trunk/engines/parallaction/intro.cpp
    scummvm/trunk/engines/parallaction/zone.cpp

Modified: scummvm/trunk/engines/parallaction/animation.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/animation.cpp	2007-03-12 23:13:33 UTC (rev 26120)
+++ scummvm/trunk/engines/parallaction/animation.cpp	2007-03-13 19:59:45 UTC (rev 26121)
@@ -233,8 +233,10 @@
 
 		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;

Modified: scummvm/trunk/engines/parallaction/dialogue.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/dialogue.cpp	2007-03-12 23:13:33 UTC (rev 26120)
+++ scummvm/trunk/engines/parallaction/dialogue.cpp	2007-03-13 19:59:45 UTC (rev 26121)
@@ -283,14 +283,11 @@
 				&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,
 				QUESTION_BALLOON_X,
@@ -334,14 +331,11 @@
 						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];
 
 					askPassword = _vm->_gfx->displayWrappedString(
@@ -406,14 +400,11 @@
 						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],
 							_answerBalloonX[0],

Modified: scummvm/trunk/engines/parallaction/graphics.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.cpp	2007-03-12 23:13:33 UTC (rev 26120)
+++ scummvm/trunk/engines/parallaction/graphics.cpp	2007-03-13 19:59:45 UTC (rev 26121)
@@ -108,16 +108,15 @@
 	}
 };
 
-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,9 +489,10 @@
 	if (label->_cnv._width + _si > SCREEN_WIDTH)
 		_si = SCREEN_WIDTH - label->_cnv._width;
 
+	Common::Rect r(label->_cnv._width, label->_cnv._height);
+	r.moveTo(Gfx::_labelPosition[1]._x, Gfx::_labelPosition[1]._y);
+	_vm->_gfx->restoreBackground(r);
 
-	_vm->_gfx->restoreBackground(Gfx::_labelPosition[1]._x, Gfx::_labelPosition[1]._y, label->_cnv._width, label->_cnv._height);
-
 	Gfx::_labelPosition[1]._x = Gfx::_labelPosition[0]._x;
 	Gfx::_labelPosition[1]._y = Gfx::_labelPosition[0]._y;
 	Gfx::_labelPosition[0]._x = _si;
@@ -605,17 +605,17 @@
 //
 //	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::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::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;
 	}
 

Modified: scummvm/trunk/engines/parallaction/graphics.h
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.h	2007-03-12 23:13:33 UTC (rev 26120)
+++ scummvm/trunk/engines/parallaction/graphics.h	2007-03-13 19:59:45 UTC (rev 26121)
@@ -80,7 +80,7 @@
 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 @@
 	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 @@
 	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

Modified: scummvm/trunk/engines/parallaction/intro.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/intro.cpp	2007-03-12 23:13:33 UTC (rev 26120)
+++ scummvm/trunk/engines/parallaction/intro.cpp	2007-03-13 19:59:45 UTC (rev 26121)
@@ -318,12 +318,15 @@
 
 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;
 
 }

Modified: scummvm/trunk/engines/parallaction/zone.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/zone.cpp	2007-03-12 23:13:33 UTC (rev 26120)
+++ scummvm/trunk/engines/parallaction/zone.cpp	2007-03-13 19:59:45 UTC (rev 26121)
@@ -377,7 +377,9 @@
 
 	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 @@
 
 	_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,8 +491,10 @@
 		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);
 
 		v14._data0 = v18->_array[_ax];
@@ -522,7 +528,9 @@
 	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++;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list