AVALANCHE: Modify Graphics and Lucerna, so the engine saves the background and redraws it every time before a sprite is drawn.

This commit is contained in:
uruk 2013-07-29 12:22:59 +02:00
parent b182fd814e
commit a1f87fdaeb
3 changed files with 8 additions and 4 deletions

View File

@ -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++) {

View File

@ -57,7 +57,9 @@ public:
static const int16 kScreenWidth = 640;
static const int16 kScreenHeight = 200;
::Graphics::Surface _background;
Graphics(AvalancheEngine *vm);

View File

@ -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();