diff --git a/engines/asylum/scene.cpp b/engines/asylum/scene.cpp index 1f070661754..9902014e623 100644 --- a/engines/asylum/scene.cpp +++ b/engines/asylum/scene.cpp @@ -144,14 +144,23 @@ void Scene::update() { scrollScreen = true; } - if (scrollScreen) - _screen->copyToBackBuffer(((byte *)bg->surface.pixels) + _startY * bg->surface.w + _startX, bg->surface.w, 0, 0, 640, 480); - - updateActor(_screen, _resPack, 7); // the "crazy prisoner banging head" anim + // Copy the background to the back buffer before updating the scene animations + _screen->copyToBackBuffer(((byte *)bg->surface.pixels) + _startY * bg->surface.w + _startX, bg->surface.w, 0, 0, 640, 480); + updateActor(_screen, _resPack, 0); // the "statue with fireworks" animation + //updateActor(_screen, _resPack, 1); // inside the middle room + //updateActor(_screen, _resPack, 2); // the lit candles at the base of the statue + updateActor(_screen, _resPack, 3); // the rat animation (in front of the statue) + updateActor(_screen, _resPack, 4); // inside the bottom room + updateActor(_screen, _resPack, 6); // inside the top room (should be shown before the rat animation) + updateActor(_screen, _resPack, 5); // the rat animation (outside the second room) + updateActor(_screen, _resPack, 7); // the "crazy prisoner banging head" animation + //updateActor(_screen, _resPack, 8); // going up the ladder + //updateActor(_screen, _resPack, 9); // going down the ladder // TODO } +#if 0 void Scene::copyToSceneBackground(GraphicFrame *frame, int x, int y) { int h = frame->surface.h; int w = frame->surface.w; @@ -164,6 +173,7 @@ void Scene::copyToSceneBackground(GraphicFrame *frame, int x, int y) { buffer += frame->surface.w; } } +#endif void Scene::copyToBackBufferClipped(GraphicFrame *frame, int x, int y) { Common::Rect screenRect(_startX, _startY, _startX + 640, _startY + 480); @@ -175,13 +185,14 @@ void Scene::copyToBackBufferClipped(GraphicFrame *frame, int x, int y) { animRect.translate(-_startX, -_startY); int startX = animRect.right == 640 ? 0 : frame->surface.w - animRect.width(); - _screen->copyToBackBuffer(((byte*)frame->surface.pixels) + - (frame->surface.h - animRect.height()) * frame->surface.pitch + startX, - frame->surface.pitch, - animRect.left, - animRect.top, - animRect.width(), - animRect.height()); + _screen->copyToBackBufferWithTransparency(((byte*)frame->surface.pixels) + + (frame->surface.h - animRect.height()) * + frame->surface.pitch + startX, + frame->surface.pitch, + animRect.left, + animRect.top, + animRect.width(), + animRect.height()); } } diff --git a/engines/asylum/scene.h b/engines/asylum/scene.h index a8bf97ef003..cceb0545e46 100644 --- a/engines/asylum/scene.h +++ b/engines/asylum/scene.h @@ -50,7 +50,9 @@ public: void enterScene(); private: +#if 0 void copyToSceneBackground(GraphicFrame *frame, int x, int y); +#endif void copyToBackBufferClipped(GraphicFrame *frame, int x, int y); Screen *_screen; diff --git a/engines/asylum/screen.cpp b/engines/asylum/screen.cpp index ea3e4a6f2e9..b2fdbac2c10 100644 --- a/engines/asylum/screen.cpp +++ b/engines/asylum/screen.cpp @@ -51,6 +51,20 @@ void Screen::copyToBackBuffer(byte *buffer, int pitch, int x, int y, int width, } } +void Screen::copyToBackBufferWithTransparency(byte *buffer, int pitch, int x, int y, int width, int height) { + int h = height; + int w = width; + byte *dest = (byte *)_backBuffer.pixels; + + for (int curY = 0; curY < height; curY++) { + for (int curX = 0; curX < width; curX++) { + if (buffer[curX + curY * width] != 0) { + dest[x + curX + (y + curY) * 640] = buffer[curX + curY * pitch]; + } + } + } +} + void Screen::copyRectToScreen(byte *buffer, int pitch, int x, int y, int width, int height) { _sys->copyRectToScreen(buffer, pitch, x, y, width, height); } diff --git a/engines/asylum/screen.h b/engines/asylum/screen.h index 285d8de15fc..0d3bb58fe97 100644 --- a/engines/asylum/screen.h +++ b/engines/asylum/screen.h @@ -41,6 +41,7 @@ public: ~Screen(); void copyToBackBuffer(byte *buffer, int pitch, int x, int y, int width, int height); + void copyToBackBufferWithTransparency(byte *buffer, int pitch, int x, int y, int width, int height); void copyBackBufferToScreen(); void copyRectToScreen(byte *buffer, int pitch, int x, int y, int width, int height); void copyRectToScreenWithTransparency(byte *buffer, int pitch, int x, int y, int width, int height);