ASYLUM: Fixed displaying of transparent actors, and added some more test animations

git-svn-id: http://asylumengine.googlecode.com/svn/trunk@179 0bfb4aae-4ea4-11de-8d8d-752d95cf3e3c
This commit is contained in:
Filippos Karapetis authored and Eugene Sandulenko committed 2021-05-17 15:35:25 +02:00
1 parent 04fe773cd2
commit 8a7e3bfada
4 files changed
+39 -11

No files matched your search

+22 -11
View File
@@ -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());
}
}
+2
View File
@@ -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;
+14
View File
@@ -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);
}
+1
View File
@@ -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);