[Scummvm-cvs-logs] CVS: scummvm/queen cutaway.cpp,1.118,1.119 graphics.cpp,1.88,1.89 graphics.h,1.64,1.65 logic.cpp,1.181,1.182 structs.h,1.34,1.35 talk.cpp,1.85,1.86

Gregory Montoir cyx at sc8-pr-cvs1.sourceforge.net
Thu Jan 22 14:32:15 CET 2004


Update of /cvsroot/scummvm/scummvm/queen
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32678/queen

Modified Files:
	cutaway.cpp graphics.cpp graphics.h logic.cpp structs.h 
	talk.cpp 
Log Message:
(slightly) less hackish bounding box code

Index: cutaway.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/cutaway.cpp,v
retrieving revision 1.118
retrieving revision 1.119
diff -u -d -r1.118 -r1.119
--- cutaway.cpp	20 Jan 2004 01:13:07 -0000	1.118
+++ cutaway.cpp	22 Jan 2004 22:28:13 -0000	1.119
@@ -503,21 +503,9 @@
 	if (0 == header) {
 		anim.object = 0;
 		anim.originalFrame = 29 + FRAMES_JOE_XTRA;
-		
-		// 21/9/94, Make sure that bobs are clipped on 150 screens
-		if (_vm->display()->fullscreen())
-			_vm->graphics()->bob(0)->box.y2 = 199;
 	}
 	else {
-		//warning("Stuff not yet implemented in Cutaway::getCutawayAnim()");
-		
 		anim.object = _vm->logic()->findBob(header);
-
-		// If fullscreen cutaway then clip to 199 down
-
-		// 21/9/94, Make sure that bobs are clipped on 150 screens
-		// XXX if(COMPANEL==2 && OBJ_CUT[6]<=0 && BDyres==200) bobs[Param].y2=199;
-
 		anim.originalFrame = _vm->logic()->findFrame(header);
 	}
 
@@ -1026,13 +1014,6 @@
 
 	joeBob->animating = 0;
 	joeBob->moving    = 0;
-	if (_vm->resource()->isInterview()) {
-		_vm->graphics()->bob(20)->box.y2 = 149;
-		_vm->graphics()->bob(21)->box.y2 = 149;
-		_vm->graphics()->bob(22)->box.y2 = 149;
-	}
-	// Make sure Joe is clipped!
-	joeBob->box.y2    = 149;
 
 	_vm->input()->cutawayRunning(false);
 	_vm->input()->cutawayQuitReset();

Index: graphics.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/graphics.cpp,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -d -r1.88 -r1.89
--- graphics.cpp	20 Jan 2004 21:58:26 -0000	1.88
+++ graphics.cpp	22 Jan 2004 22:28:29 -0000	1.89
@@ -32,6 +32,8 @@
 
 namespace Queen {
 
+const Box BobSlot::_defaultBox(-1, -1, -1, -1);
+
 void BobSlot::curPos(int16 xx, int16 yy) {
 	active = true;
 	x = xx;
@@ -163,18 +165,18 @@
 
 void BobSlot::clear() {
 	active = false;
-	xflip  = false;
+	xflip = false;
 	animating = false;
 	anim.string.buffer = NULL;
 	moving = false;
-	scale  = 100;
-	box.x1 = 0;
-	box.y1 = 0;
-	box.x2 = GAME_SCREEN_WIDTH - 1;
-	box.y2 = ROOM_ZONE_HEIGHT - 1;
+	scale = 100;
+	box = _defaultBox;
 }
 
 
+const Box Graphics::_gameScreenBox(0, 0, GAME_SCREEN_WIDTH - 1, ROOM_ZONE_HEIGHT - 1);
+const Box Graphics::_fullScreenBox(0, 0, GAME_SCREEN_WIDTH - 1, GAME_SCREEN_HEIGHT - 1);
+
 Graphics::Graphics(QueenEngine *vm)
 	: _cameraBob(0), _vm(vm) {
 	memset(_bobs, 0, sizeof(_bobs));
@@ -200,7 +202,7 @@
 	_vm->display()->setMouseCursor(bf->data, bf->width, bf->height);
 }
 
-void Graphics::drawBob(const BobSlot *bs, const BobFrame *bf, int16 x, int16 y) {
+void Graphics::drawBob(const BobSlot *bs, const BobFrame *bf, const Box *bbox, int16 x, int16 y) {
 	debug(9, "Graphics::drawBob(%d, %d, %d)", bs->frameNum, x, y);
 
 	uint16 w, h;
@@ -211,7 +213,7 @@
 	w = bf->width;
 	h = bf->height;
 
-	const Box *box = &bs->box;
+	const Box *box = (bs->box == BobSlot::_defaultBox) ? bbox : &bs->box;
 
 	if(w != 0 && h != 0 && box->intersects(x, y, w, h)) {
 		uint8 *src = bf->data;
@@ -315,9 +317,6 @@
 void Graphics::clearBob(uint32 bobNum) {
 	BobSlot *pbs = bob(bobNum);
 	pbs->clear();
-	if (_vm->display()->fullscreen()) {
-		pbs->box.y2 = GAME_SCREEN_HEIGHT - 1;
-	}
 }
 
 void Graphics::sortBobs() {
@@ -362,8 +361,8 @@
 }
 
 void Graphics::drawBobs() {
-	int i;
-	for (i = 0; i < _sortedBobsCount; ++i) {
+	const Box *bobBox = _vm->display()->fullscreen() ? &_fullScreenBox : &_gameScreenBox;
+	for (int i = 0; i < _sortedBobsCount; ++i) {
 		BobSlot *pbs = _sortedBobs[i];
 		if (pbs->active) {
 
@@ -387,7 +386,7 @@
 			x = pbs->x - xh - _vm->display()->horizontalScroll();
 			y = pbs->y - yh;
 
-			drawBob(pbs, pbf, x, y);
+			drawBob(pbs, pbf, bobBox, x, y);
 		}
 	}
 }
@@ -524,7 +523,6 @@
 }
 
 void Graphics::handleParallax(uint16 roomNum) {
-	int i;
 	uint16 screenScroll = _vm->display()->horizontalScroll();
 	switch (roomNum) {
 	case ROOM_AMAZON_HIDEOUT:
@@ -543,27 +541,10 @@
 	case ROOM_VALLEY_CARCASS:
 		_bobs[5].x = 600 - screenScroll / 2;
 		break;
-	case ROOM_HOTEL_LOBBY:
-		if(_vm->display()->fullscreen()) {
-			for(i = 1; i <= 3; ++i) {
-				_bobs[i].box.y2 = 199;
-			}
-			_bobs[24].box.y2 = 199;
-		}
-		break;
 	case ROOM_UNUSED_INTRO_1:
 		_bobs[5].x = 340 - screenScroll / 2;
 		_bobs[6].x = 50 - screenScroll / 2;
 		_bobs[7].x = 79 - screenScroll / 2;
-		for(i = 1; i <= 8; ++i) {
-			_bobs[i].box.y2 = 199;
-		}
-		_bobs[20].box.y2 = 199;
-		break;
-	case ROOM_UNUSED_INTRO_5:
-		for(i = 0; i < 3; ++i) {
-			_bobs[i].box.y2 = 199;
-		}
 		break;
 	case ROOM_CAR_CHASE:
 		_vm->bam()->updateCarAnimation();
@@ -591,7 +572,7 @@
 }
 
 void Graphics::setupNewRoom(const char *room, uint16 roomNum, int16 *furniture, uint16 furnitureCount) {
-	// reset sprites table (bounding box...)
+	// reset sprites table
 	clearBobs();
 
 	// load/setup objects associated to this room
@@ -1003,8 +984,6 @@
 				++curImage;
 				clearBob(curBob);
 
-				// XXX if((COMPANEL==2) && (FULLSCREEN==1)) bobs[CURRBOB].y2=199;
-
 				_vm->bankMan()->unpack(pgd->firstFrame, curImage, 15);
 				++_numFrames;
 				if (pod->name > 0) {

Index: graphics.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/graphics.h,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -d -r1.64 -r1.65
--- graphics.h	20 Jan 2004 21:58:26 -0000	1.64
+++ graphics.h	22 Jan 2004 22:28:30 -0000	1.65
@@ -73,6 +73,8 @@
 	uint16 dx, dy;
 	uint16 total;
 
+	static const Box _defaultBox;
+
 	void curPos(int16 xx, int16 yy);
 	void move(int16 dstx, int16 dsty, int16 spd);
 	void moveOneStep();
@@ -95,7 +97,7 @@
 	void unpackControlBank();
 	void setupMouseCursor();
 
-	void drawBob(const BobSlot *bs, const BobFrame *bf, int16 x, int16 y);
+	void drawBob(const BobSlot *bs, const BobFrame *bf, const Box *box, int16 x, int16 y);
 	void drawInventoryItem(uint32 frameNum, uint16 x, uint16 y);
 	void pasteBob(uint16 objNum, uint16 image);
 	void shrinkFrame(const BobFrame *bf, uint16 percentage);
@@ -178,6 +180,9 @@
 	int _cameraBob;
 
 	QueenEngine *_vm;
+
+	static const Box _gameScreenBox;
+	static const Box _fullScreenBox;
 };
 
 class BamScene {

Index: logic.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/logic.cpp,v
retrieving revision 1.181
retrieving revision 1.182
diff -u -d -r1.181 -r1.182
--- logic.cpp	21 Jan 2004 22:04:39 -0000	1.181
+++ logic.cpp	22 Jan 2004 22:28:30 -0000	1.182
@@ -1196,9 +1196,6 @@
 
 	joe->frameNum = _vm->input()->mousePosX() / 36 + 43 + FRAMES_JOE_XTRA;
 
-	// adjust bounding box for fullscreen
-	joe->box.y2 = piton->box.y2 = GAME_SCREEN_HEIGHT - 1;
-
 	// bobs have been unpacked from animating objects, we don't need them
 	// to animate anymore ; so turn animating off
 	joe->animating = piton->animating = false;
@@ -1483,7 +1480,6 @@
 	BobSlot *bobFrank = _vm->graphics()->bob(5);
 	bobFrank->frameNum = 38;
 	bobFrank->curPos(160, 200);
-	bobFrank->box.y2 = GAME_SCREEN_HEIGHT - 1;
 
 	int i;
 	for (i = 10; i <= 100; i += 4) {
@@ -1507,7 +1503,6 @@
 	BobSlot *bobRobot = _vm->graphics()->bob(5);
 	bobRobot->frameNum = 38;
 	bobRobot->curPos(160, 200);
-	bobRobot->box.y2 = GAME_SCREEN_HEIGHT - 1;
 
 	int i;
 	for (i = 10; i <= 100; i += 4) {
@@ -1694,7 +1689,6 @@
 	BobSlot *planeBob     = _vm->graphics()->bob(5);
 	BobSlot *lightningBob = _vm->graphics()->bob(20);
 
-	planeBob->box.y2 = lightningBob->box.y2 = 199;
 	planeBob->y = 135;
 
 	planeBob->scale = 20;

Index: structs.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/structs.h,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- structs.h	12 Jan 2004 13:40:02 -0000	1.34
+++ structs.h	22 Jan 2004 22:28:52 -0000	1.35
@@ -29,6 +29,14 @@
 struct Box {
 	int16 x1, y1, x2, y2;
 
+	Box()
+		: x1(0), y1(0), x2(0), y2(0) {
+	}
+
+	Box(int16 xx1, int16 yy1, int16 xx2, int16 yy2)
+		: x1(xx1), y1(yy1), x2(xx2), y2(yy2) {
+	}
+
 	void readFromBE(byte *&ptr) {
 		x1 = (int16)READ_BE_UINT16(ptr); ptr += 2;
 		y1 = (int16)READ_BE_UINT16(ptr); ptr += 2;
@@ -58,6 +66,10 @@
 	bool contains(int16 x, int16 y) const {
 		return (x >= x1) && (x <= x2) && (y >= y1) && (y <= y2);
 	}
+
+	bool operator==(const Box &b) const {
+		return (x1 == b.x1) && (x2 == b.x2) && (y1 == b.y1) && (y2 == b.y2);
+	}
 };
 
 

Index: talk.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/talk.cpp,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -d -r1.85 -r1.86
--- talk.cpp	20 Jan 2004 22:35:53 -0000	1.85
+++ talk.cpp	22 Jan 2004 22:28:57 -0000	1.86
@@ -1305,13 +1305,11 @@
 	arrowBobUp->x         = 303 + 8 + scrollX;
 	arrowBobUp->y         = 150 + 1;
 	arrowBobUp->frameNum  = 3;
-	arrowBobUp->box.y2    = 199;
 	arrowBobUp->active    = false;
 
 	arrowBobDown->x         = 303 + scrollX;
 	arrowBobDown->y         = 175;
 	arrowBobDown->frameNum  = 4;
-	arrowBobDown->box.y2    = 199;
 	arrowBobDown->active    = false;
 
 	bool rezone = true;





More information about the Scummvm-git-logs mailing list