From a1f87fdaebc86be92b189086bba1dba0d3e049c6 Mon Sep 17 00:00:00 2001 From: uruk Date: Mon, 29 Jul 2013 12:22:59 +0200 Subject: AVALANCHE: Modify Graphics and Lucerna, so the engine saves the background and redraws it every time before a sprite is drawn. --- engines/avalanche/graphics.cpp | 2 ++ engines/avalanche/graphics.h | 4 +++- engines/avalanche/lucerna2.cpp | 6 +++--- 3 files changed, 8 insertions(+), 4 deletions(-) (limited to 'engines') diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index bed8136dd4..6338893dbf 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -62,6 +62,7 @@ void Graphics::init() { Graphics::~Graphics() { _surface.free(); + _background.free(); } @@ -85,6 +86,7 @@ void Graphics::drawBar(int16 x1, int16 y1, int16 x2, int16 y2, int16 color) { } void Graphics::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y) { + drawPicture(_background, 0, 10); /* First we make the pixels of the spirte blank. */ for (byte qay = 0; qay < sprite.yl; qay++) { diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index 3d32bdafcb..d0adb17767 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -57,7 +57,9 @@ public: static const int16 kScreenWidth = 640; static const int16 kScreenHeight = 200; - + ::Graphics::Surface _background; + + Graphics(AvalancheEngine *vm); diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index eb5f5094c9..047301cf3e 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -245,11 +245,11 @@ void Lucerna::load(byte n) { /* Load2, actually */ byte backgroundHeight = 8 * 12080 / _vm->_graphics->kScreenWidth; // With 640 width it's 151 // The 8 = number of bits in a byte, and 12080 comes from the original code (see above) - ::Graphics::Surface background = _vm->_graphics->loadPictureRow(f, backgroundWidht, backgroundHeight); + _vm->_graphics->_background = _vm->_graphics->loadPictureRow(f, backgroundWidht, backgroundHeight); - _vm->_graphics->drawPicture(background, 0, 10); + _vm->_graphics->drawPicture(_vm->_graphics->_background, 0, 10); - background.free(); + _vm->_graphics->refreshScreen(); f.close(); -- cgit v1.2.3