[Scummvm-cvs-logs] CVS: scummvm/queen display.h,1.3,1.4 display.cpp,1.6,1.7 graphics.h,1.20,1.21 graphics.cpp,1.23,1.24

Gregory Montoir cyx at users.sourceforge.net
Fri Oct 17 07:28:09 CEST 2003


Update of /cvsroot/scummvm/scummvm/queen
In directory sc8-pr-cvs1:/tmp/cvs-serv15274

Modified Files:
	display.h display.cpp graphics.h graphics.cpp 
Log Message:
preliminar parallax scrolling support (Rita/Joe intro scene), not perfect as Bobs coordinates are also modified in cutaway/action_special_move

Index: display.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/display.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- display.h	17 Oct 2003 13:12:50 -0000	1.3
+++ display.h	17 Oct 2003 14:26:05 -0000	1.4
@@ -86,7 +86,9 @@
 	void textDraw(uint16 x, uint16 y, uint8 color, const char *text, bool outlined = true);
 	uint16 textWidth(const char *text) const;
 
+	void horizontalScrollUpdate(uint16 xCamera); // calc_screen_scroll
 	void horizontalScroll(uint16 scroll);
+	uint16 horizontalScroll() const { return _horizontalScroll; }
 
 	bool fullscreen() const { return _fullscreen; }
 

Index: display.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/display.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- display.cpp	17 Oct 2003 13:12:50 -0000	1.6
+++ display.cpp	17 Oct 2003 14:26:05 -0000	1.7
@@ -724,6 +724,21 @@
 }
 
 
+void Display::horizontalScrollUpdate(uint16 xCamera) {
+
+	debug(9, "Display::horizontalScrollUpdate(%d)", xCamera);
+	_horizontalScroll = 0;
+	if (_bdWidth > 320) {
+		if (xCamera > 160 && xCamera < 480) {
+			_horizontalScroll = xCamera - 160;
+		}
+		else if (xCamera >= 480) {
+			_horizontalScroll = 320;
+		}
+	}
+}
+
+
 void Display::horizontalScroll(uint16 scroll) {
 
 	_horizontalScroll = scroll;

Index: graphics.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/graphics.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- graphics.h	16 Oct 2003 16:55:13 -0000	1.20
+++ graphics.h	17 Oct 2003 14:26:05 -0000	1.21
@@ -135,6 +135,7 @@
 	void bobDrawAll(); // drawbobs()
 	void bobClearAll(); // clearallbobs()
 	BobSlot *bob(int index);
+	void bobCustomParallax(uint16 roomNum);
 
 	void textCurrentColor(uint8 color); // ink()
 	void textSet(uint16 x, uint16 y, const char *text, bool outlined = true); // text()
@@ -153,6 +154,8 @@
 	void journalBobSetup(uint32 bobnum, uint16 x, uint16 y, uint16 frame);
 	void journalBobPreDraw();
 
+	void setCameraBob(int bobNum);
+
 	void update();
 
 
@@ -187,7 +190,9 @@
 	TextSlot _texts[GAME_SCREEN_HEIGHT];
 	uint8 _curTextColor;
 
-	uint16 _cameraBob; // cambob
+	int _cameraBob; // cambob
+
+	uint16 _lastRoom; // TEMP
 
 	Display *_display;
 	Resource *_resource;

Index: graphics.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/graphics.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- graphics.cpp	17 Oct 2003 08:40:48 -0000	1.23
+++ graphics.cpp	17 Oct 2003 14:26:05 -0000	1.24
@@ -530,6 +530,75 @@
 }
 
 
+void Graphics::bobCustomParallax(uint16 roomNum) {
+	
+	int i;
+	uint16 screenScroll = _display->horizontalScroll();
+	switch (roomNum) {
+	case 17:
+		_bobs[8].x = 250 - screenScroll + screenScroll / 2;
+		break;
+	case 100:
+		_bobs[5].x = 410 - screenScroll + screenScroll / 2;
+		_bobs[6].x = 790 - screenScroll + screenScroll / 2;
+		break;
+	case 43:
+		_bobs[5].x = 320 - screenScroll + screenScroll / 2;
+		break;
+	case 51:
+		_bobs[5].x = 280 - screenScroll + screenScroll / 2;
+		break;
+	case 67:
+		_bobs[5].x = 600 - screenScroll + screenScroll / 2;
+		break;
+	case 73 :
+		if(_display->fullscreen()) {
+			for(i = 1; i <= 3; ++i) {
+				_bobs[i].box.y2 = 199;
+			}
+			_bobs[24].box.y2 = 199;
+		}
+		break;
+	case 90 :
+		_bobs[5].x = 340 - screenScroll + screenScroll / 2;
+		_bobs[6].x = 50 - screenScroll + screenScroll / 2;
+		_bobs[7].x = 79 - screenScroll + screenScroll / 2;
+		for(i = 1; i <= 8; ++i) {
+			_bobs[i].box.y2 = 199;
+		}
+		_bobs[20].box.y2 = 199;
+		break;
+	case 94 :
+		for(i = 0; i < 3; ++i) {
+			_bobs[i].box.y2=199;
+		}
+		break;
+	case 74 : // Carbam
+		warning("Graphics::bobCustomParallax() - room 74 not handled");
+		break;
+	case 69 : // Fight1
+		warning("Graphics::bobCustomParallax() - room 69 not handled");
+		break;
+	case 116: // CR 2 - CD-Rom pan right while Rita talks...
+		_cameraBob = -1;
+		if (screenScroll < 80) {
+			_display->horizontalScroll(screenScroll + 4);
+			// Joe's body and head
+			_bobs[ 1].x += 4;
+			_bobs[20].x += 4;
+			// Rita's body and head
+			_bobs[ 2].x -= 2;
+			_bobs[21].x -= 2;
+		}
+		break;
+	case 123: // CR 2 - CD-Rom the guys move off screen
+		_bobs[21].x += 2;
+		_bobs[21].y += 2;
+		break;
+	}
+}
+
+
 void Graphics::textCurrentColor(uint8 color) {
 	_curTextColor = color;
 }
@@ -617,6 +686,7 @@
 	if (room >= 90) {
 		_cameraBob = 0;
 	}
+	_lastRoom = room; // TEMP
 }
 
 
@@ -690,9 +760,23 @@
 }
 
 
+void Graphics::setCameraBob(int bobNum) {
+	_cameraBob = bobNum;
+}
+
+
 void Graphics::update() {
 	// FIXME: temporary code, move to Logic::update()
 	bobSortAll();
+	if (_cameraBob >= 0) {
+		_display->horizontalScrollUpdate(_bobs[_cameraBob].x);
+	}
+	// FIXME: currently, we use the _lastRoom variable only
+	// to know in which current room we are. This is necessary
+	// for the parallax stuff as it relies on the room number.
+	// When we switch to the Logic::update() method, we will be
+	// able to get rid of this variable...
+	bobCustomParallax(_lastRoom);
 	_display->prepareUpdate();
 	bobDrawAll();
 	textDrawAll();





More information about the Scummvm-git-logs mailing list