aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authoruruk2013-07-25 21:38:46 +0200
committeruruk2013-07-25 21:38:46 +0200
commit06bde8b277e0729c693243c2ba4d8566ff1e9012 (patch)
tree87a8dca322195186f2ac7a30cc151805e886090b /engines
parent63e7c5b3d110eb24563535a92b1804e4d2f4859b (diff)
downloadscummvm-rg350-06bde8b277e0729c693243c2ba4d8566ff1e9012.tar.gz
scummvm-rg350-06bde8b277e0729c693243c2ba4d8566ff1e9012.tar.bz2
scummvm-rg350-06bde8b277e0729c693243c2ba4d8566ff1e9012.zip
AVALANCHE: Implement Celer::load_chunks().
Diffstat (limited to 'engines')
-rw-r--r--engines/avalanche/celer2.cpp52
1 files changed, 46 insertions, 6 deletions
diff --git a/engines/avalanche/celer2.cpp b/engines/avalanche/celer2.cpp
index b73e16ad74..b7ee5bbfb6 100644
--- a/engines/avalanche/celer2.cpp
+++ b/engines/avalanche/celer2.cpp
@@ -301,11 +301,11 @@ void Celer::load_chunks(Common::String xx) {
if (ch.natural) {
memos[fv].flavour = ch_natural_image; // We simply read from the screen and later, in display_it() we draw it right back.
- memos[fv].size = ch.xl * ch.yl;
+ memos[fv].size = memos[fv].xl * 8 * memos[fv].yl;
memory[fv] = new byte[memos[fv].size]; // Celer::forget_chunks() deallocates it.
for (uint16 j = 0; j < memos[fv].yl; j++)
- for (uint16 i = 0; i < memos[fv].xl; i++)
- memory[fv][j * memos[fv].xl + i] = *_vm->_graphics->getPixel(memos[fv].x + i, memos[fv].y + j);
+ for (uint16 i = 0; i < memos[fv].xl * 8; i++)
+ memory[fv][j * memos[fv].xl * 8 + i] = *_vm->_graphics->getPixel(memos[fv].x * 8 + i, memos[fv].y + j);
} else {
memos[fv].size = ch.size;
memory[fv] = new byte[memos[fv].size]; // Celer::forget_chunks() deallocates it.
@@ -426,13 +426,21 @@ asm
void Celer::display_it(int16 x, int16 y, int16 xl, int16 yl, flavourtype flavour, byte *p) {
switch (flavour) {
case ch_natural_image: {
+ r.x1 = x;
+ r.y1 = y;
+ r.x2 = x + xl + 1;
+ r.y2 = y + yl;
+
+ x *= 8;
+ xl *= 8;
+
for (uint16 j = 0; j < yl; j++)
for (uint16 i = 0; i < xl; i++)
*_vm->_graphics->getPixel(x + i, y + j) = p[j * xl + i];
}
break;
case ch_bgi : {
- _vm->_graphics->drawPicture(p, x, y);
+ _vm->_graphics->drawPicture(p, x * 8, y);
//putimage(x * 8, y, p, 0);
r.x1 = x;
r.y1 = y;
@@ -441,12 +449,44 @@ void Celer::display_it(int16 x, int16 y, int16 xl, int16 yl, flavourtype flavour
}
break;
case ch_ega : {
- mdrop(x, y, xl, yl, p);
- _vm->_lucerna->blitfix();
r.x1 = x;
r.y1 = y;
r.x2 = x + xl;
r.y2 = y + yl;
+
+
+ x *= 8;
+ xl *= 8;
+
+
+
+ ::Graphics::Surface picture; // We make a Surface object for the picture itself.
+
+ picture.create(xl, yl + 1, ::Graphics::PixelFormat::createFormatCLUT8());
+
+ uint32 h = 0;
+
+ // Produce the picture.
+ for (int8 plane = 0; plane < 4; plane++) // The planes are in the opposite way.
+ for (byte j = 0; j < yl + 1; j++)
+ for (uint16 i = 0; i < xl; i += 8) {
+ byte pixel = p[h++];
+ for (byte bit = 0; bit < 8; bit++) {
+ byte pixelBit = (pixel >> bit) & 1;
+ *(byte *)picture.getBasePtr(i + 7 - bit, j) += (pixelBit << plane);
+ }
+ }
+
+ // Copy the picture to a given place on the screen.
+ for (uint16 j = 0; j < picture.h; j++)
+ for (uint16 i = 0; i < picture.w; i++)
+ *_vm->_graphics->getPixel(i + x, j + y) = *(byte *)picture.getBasePtr(i, j);
+
+ picture.free();
+
+
+
+ _vm->_lucerna->blitfix();
}
break;
}