aboutsummaryrefslogtreecommitdiff
path: root/queen
diff options
context:
space:
mode:
authorGregory Montoir2003-10-17 14:26:05 +0000
committerGregory Montoir2003-10-17 14:26:05 +0000
commitf4b5626fd763a22d96d39757c9688ffcf13bb823 (patch)
treecfe9aba53e7b35c19bbfaa1a750611784f5d6595 /queen
parent323c338169672d60b43d924c57b6e03adbd2ca21 (diff)
downloadscummvm-rg350-f4b5626fd763a22d96d39757c9688ffcf13bb823.tar.gz
scummvm-rg350-f4b5626fd763a22d96d39757c9688ffcf13bb823.tar.bz2
scummvm-rg350-f4b5626fd763a22d96d39757c9688ffcf13bb823.zip
preliminar parallax scrolling support (Rita/Joe intro scene), not perfect as Bobs coordinates are also modified in cutaway/action_special_move
svn-id: r10860
Diffstat (limited to 'queen')
-rw-r--r--queen/display.cpp15
-rw-r--r--queen/display.h2
-rw-r--r--queen/graphics.cpp84
-rw-r--r--queen/graphics.h7
4 files changed, 107 insertions, 1 deletions
diff --git a/queen/display.cpp b/queen/display.cpp
index c827f8c300..4cef4a1c2d 100644
--- a/queen/display.cpp
+++ b/queen/display.cpp
@@ -724,6 +724,21 @@ uint16 Display::textWidth(const char *text) const {
}
+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;
diff --git a/queen/display.h b/queen/display.h
index 84477f75fb..eb0cea71b9 100644
--- a/queen/display.h
+++ b/queen/display.h
@@ -86,7 +86,9 @@ public:
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; }
diff --git a/queen/graphics.cpp b/queen/graphics.cpp
index ab33cccd09..f1b87209ef 100644
--- a/queen/graphics.cpp
+++ b/queen/graphics.cpp
@@ -530,6 +530,75 @@ BobSlot *Graphics::bob(int index) {
}
+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 @@ void Graphics::loadBackdrop(const char* name, uint16 room) {
if (room >= 90) {
_cameraBob = 0;
}
+ _lastRoom = room; // TEMP
}
@@ -690,9 +760,23 @@ void Graphics::journalBobPreDraw() { // GameSettings* pgs
}
+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();
diff --git a/queen/graphics.h b/queen/graphics.h
index d68d4e8e5e..7a80bdb3d0 100644
--- a/queen/graphics.h
+++ b/queen/graphics.h
@@ -135,6 +135,7 @@ public:
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 @@ public:
void journalBobSetup(uint32 bobnum, uint16 x, uint16 y, uint16 frame);
void journalBobPreDraw();
+ void setCameraBob(int bobNum);
+
void update();
@@ -187,7 +190,9 @@ private:
TextSlot _texts[GAME_SCREEN_HEIGHT];
uint8 _curTextColor;
- uint16 _cameraBob; // cambob
+ int _cameraBob; // cambob
+
+ uint16 _lastRoom; // TEMP
Display *_display;
Resource *_resource;