aboutsummaryrefslogtreecommitdiff
path: root/queen
diff options
context:
space:
mode:
authorGregory Montoir2004-01-02 14:15:45 +0000
committerGregory Montoir2004-01-02 14:15:45 +0000
commitc7965a7a04d73f6b86cb1ef6bcdde7a4a531413c (patch)
tree81330e7204667ab49bcbcc6e5964785b874d2ff8 /queen
parentf7642601fe7b708a593e1aa644d315c0429f46f4 (diff)
downloadscummvm-rg350-c7965a7a04d73f6b86cb1ef6bcdde7a4a531413c.tar.gz
scummvm-rg350-c7965a7a04d73f6b86cb1ef6bcdde7a4a531413c.tar.bz2
scummvm-rg350-c7965a7a04d73f6b86cb1ef6bcdde7a4a531413c.zip
minor rewrite of screenblanker code
svn-id: r12086
Diffstat (limited to 'queen')
-rw-r--r--queen/display.cpp79
-rw-r--r--queen/display.h10
-rw-r--r--queen/graphics.cpp5
3 files changed, 48 insertions, 46 deletions
diff --git a/queen/display.cpp b/queen/display.cpp
index 9f7d8c51c4..969cd40a44 100644
--- a/queen/display.cpp
+++ b/queen/display.cpp
@@ -105,15 +105,12 @@ Display::Display(QueenEngine *vm, Language language, OSystem *system)
_buffer[RB_BACKDROP] = new uint8[BACKDROP_W * BACKDROP_H];
_buffer[RB_PANEL] = new uint8[PANEL_W * PANEL_H];
_buffer[RB_SCREEN] = new uint8[SCREEN_W * SCREEN_H];
- _buffer[RB_MINI] = new uint8[MINI_W * MINI_H];
memset(_buffer[RB_BACKDROP], 0, BACKDROP_W * BACKDROP_H);
memset(_buffer[RB_PANEL], 0, PANEL_W * PANEL_H);
memset(_buffer[RB_SCREEN], 0, SCREEN_W * SCREEN_H);
- memset(_buffer[RB_MINI], 0, MINI_W * MINI_H);
_bufPitch[RB_BACKDROP] = BACKDROP_W;
_bufPitch[RB_PANEL] = PANEL_W;
_bufPitch[RB_SCREEN] = SCREEN_W;
- _bufPitch[RB_MINI] = MINI_W;
_pal.room = new uint8[ 256 * 3 ];
_pal.screen = new uint8[ 256 * 3 ];
@@ -129,7 +126,6 @@ Display::~Display() {
delete[] _buffer[RB_BACKDROP];
delete[] _buffer[RB_PANEL];
delete[] _buffer[RB_SCREEN];
- delete[] _buffer[RB_MINI];
delete[] _pal.room;
delete[] _pal.screen;
@@ -764,11 +760,6 @@ void Display::horizontalScrollUpdate(int16 xCamera) {
}
-void Display::horizontalScroll(int16 scroll) {
- _horizontalScroll = scroll;
-}
-
-
void Display::handleTimer() {
_gotTick = true;
}
@@ -849,17 +840,24 @@ void Display::blankScreen() {
&Display::blankScreenEffect3
};
(this->*effects[_curBlankingEffect])();
- _curBlankingEffect = (_curBlankingEffect + 1) % 3;
+ _curBlankingEffect = (_curBlankingEffect + 1) % ARRAYSIZE(effects);
}
void Display::blankScreenEffect1() {
+ uint8 buf[32 * 32];
while (_vm->input()->idleTime() >= Input::DELAY_SCREEN_BLANKER) {
for(int i = 0; i < 2; ++i) {
- uint16 x = _vm->randomizer.getRandomNumber(SCREEN_W - MINI_W - 2) + 1;
- uint16 y = _vm->randomizer.getRandomNumber(SCREEN_H - MINI_H - 2) + 1;
+ uint16 x = _vm->randomizer.getRandomNumber(SCREEN_W - 32 - 2) + 1;
+ uint16 y = _vm->randomizer.getRandomNumber(SCREEN_H - 32 - 2) + 1;
uint8 *p = _buffer[RB_SCREEN] + _bufPitch[RB_SCREEN] * y + x;
- blit(RB_MINI, 0, 0, p, MINI_W, MINI_H, _bufPitch[RB_SCREEN], false, false);
+ uint8 *q = buf;
+ uint16 h = 32;
+ while (h--) {
+ memcpy(q, p, 32);
+ p += _bufPitch[RB_SCREEN];
+ q += 32;
+ }
if (_vm->randomizer.getRandomNumber(1)) {
--x;
} else {
@@ -870,8 +868,9 @@ void Display::blankScreenEffect1() {
} else {
++y;
}
- blit(RB_SCREEN, x, y, _buffer[RB_MINI], MINI_W, MINI_H, _bufPitch[RB_MINI], false, false);
- drawScreen();
+ _system->copy_rect(buf, 32, x, y, 32, 32);
+ _system->update_screen();
+ waitForTimer();
}
}
}
@@ -881,30 +880,33 @@ void Display::blankScreenEffect2() {
while (_vm->input()->idleTime() >= Input::DELAY_SCREEN_BLANKER) {
uint16 x = _vm->randomizer.getRandomNumber(SCREEN_W - 2);
uint16 y = _vm->randomizer.getRandomNumber(SCREEN_H - 2);
+ uint8 *p = _buffer[RB_SCREEN] + y * _bufPitch[RB_SCREEN] + x;
uint8 c = 0;
switch (_vm->randomizer.getRandomNumber(3)) {
case 0:
- c = *(_buffer[RB_SCREEN] + _bufPitch[RB_SCREEN] * y + x);
+ c = *p;
break;
case 1:
- c = *(_buffer[RB_SCREEN] + _bufPitch[RB_SCREEN] * y + x + 1);
+ c = *(p + 1);
break;
case 2:
- c = *(_buffer[RB_SCREEN] + _bufPitch[RB_SCREEN] * (y + 1) + x);
+ c = *(p + _bufPitch[RB_SCREEN]);
break;
case 3:
- c = *(_buffer[RB_SCREEN] + _bufPitch[RB_SCREEN] * (y + 1) + x + 1);
+ c = *(p + _bufPitch[RB_SCREEN] + 1);
break;
default:
break;
}
- uint8 *p = _buffer[RB_SCREEN] + y * _bufPitch[RB_SCREEN] + x;
+ uint8 *buf = p;
int j = 2;
while (j--) {
memset(p, c, 2);
p += _bufPitch[RB_SCREEN];
}
- drawScreen();
+ _system->copy_rect(buf, _bufPitch[RB_SCREEN], x, y, 2, 2);
+ _system->update_screen();
+ waitForTimer();
}
}
@@ -912,24 +914,29 @@ void Display::blankScreenEffect2() {
void Display::blankScreenEffect3() {
uint32 i = 0;
while (_vm->input()->idleTime() >= Input::DELAY_SCREEN_BLANKER) {
- uint16 x = _vm->randomizer.getRandomNumber(SCREEN_W - 2);
- uint16 y = _vm->randomizer.getRandomNumber(SCREEN_H - 2);
- uint8 *p = _buffer[RB_SCREEN] + _bufPitch[RB_SCREEN] * y + x;
- uint8 p0 = *p;
- uint8 p1 = *(p + 1);
- uint8 p2 = *(p + _bufPitch[RB_SCREEN]);
- uint8 p3 = *(p + _bufPitch[RB_SCREEN] + 1);
- uint8 c = (p0 + p1 + p2 + p3) / 4;
- int j = 2;
- while (j--) {
- memset(p, c, 2);
- p += _bufPitch[RB_SCREEN];
- }
if (i > 4000000) {
memset(_buffer[RB_SCREEN], 0, SCREEN_W * SCREEN_H);
+ _system->copy_rect(_buffer[RB_SCREEN], _bufPitch[RB_SCREEN], 0, 0, SCREEN_W, SCREEN_H);
+ } else {
+ uint16 x = _vm->randomizer.getRandomNumber(SCREEN_W - 2);
+ uint16 y = _vm->randomizer.getRandomNumber(SCREEN_H - 2);
+ uint8 *p = _buffer[RB_SCREEN] + _bufPitch[RB_SCREEN] * y + x;
+ uint8 p0 = *p;
+ uint8 p1 = *(p + 1);
+ uint8 p2 = *(p + _bufPitch[RB_SCREEN]);
+ uint8 p3 = *(p + _bufPitch[RB_SCREEN] + 1);
+ uint8 c = (p0 + p1 + p2 + p3) / 4;
+ uint8 *buf = p;
+ int j = 2;
+ while (j--) {
+ memset(p, c, 2);
+ p += _bufPitch[RB_SCREEN];
+ }
+ ++i;
+ _system->copy_rect(buf, _bufPitch[RB_SCREEN], x, y, 2, 2);
}
- drawScreen();
- ++i;
+ _system->update_screen();
+ waitForTimer();
}
}
diff --git a/queen/display.h b/queen/display.h
index 645176f64b..1317a81fdd 100644
--- a/queen/display.h
+++ b/queen/display.h
@@ -97,7 +97,7 @@ public:
void readPCXPanel(const uint8 *pcxBuf, uint32 size);
void horizontalScrollUpdate(int16 xCamera);
- void horizontalScroll(int16 scroll);
+ void horizontalScroll(int16 scroll) { _horizontalScroll = scroll; }
int16 horizontalScroll() const { return _horizontalScroll; }
void fullscreen(bool fs) { debug(6, "Display::fullscreen(%d)", fs); _fullscreen = fs; }
@@ -131,9 +131,7 @@ private:
SCREEN_W = 320,
SCREEN_H = 200,
PANEL_W = 320,
- PANEL_H = 50,
- MINI_W = 32,
- MINI_H = 32
+ PANEL_H = 50
};
TextRenderer _textRenderer;
@@ -145,8 +143,8 @@ private:
bool scrollable;
} _pal;
- uint8 *_buffer[4];
- uint16 _bufPitch[4];
+ uint8 *_buffer[3];
+ uint16 _bufPitch[3];
bool _fullscreen;
diff --git a/queen/graphics.cpp b/queen/graphics.cpp
index 5f87f18130..4205f21ba9 100644
--- a/queen/graphics.cpp
+++ b/queen/graphics.cpp
@@ -335,14 +335,12 @@ void Graphics::bobDraw(const BobSlot *bs, int16 x, int16 y) {
src += w * y_skip;
if (!bs->xflip) {
src += x_skip;
- _vm->display()->blit(RB_SCREEN, x, y, src, w_new, h_new, w, bs->xflip, true);
} else {
src += w - w_new - x_skip;
x += w_new - 1;
- _vm->display()->blit(RB_SCREEN, x, y, src, w_new, h_new, w, bs->xflip, true);
}
+ _vm->display()->blit(RB_SCREEN, x, y, src, w_new, h_new, w, bs->xflip, true);
}
-
}
@@ -567,7 +565,6 @@ void Graphics::bobCustomParallax(uint16 roomNum) {
break;
case ROOM_INTRO_RITA_JOE_HEADS: // CR 2 - CD-Rom pan right while Rita talks...
_cameraBob = -1;
- debug(9, "Graphics::bobCustomParallax() - %d", screenScroll);
if (screenScroll < 80) {
_vm->display()->horizontalScroll(screenScroll + 4);
// Joe's body and head