aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/avalanche/graph.cpp9
-rw-r--r--engines/avalanche/graph.h2
-rw-r--r--engines/avalanche/lucerna2.cpp8
3 files changed, 11 insertions, 8 deletions
diff --git a/engines/avalanche/graph.cpp b/engines/avalanche/graph.cpp
index 84dde5ae95..5c12884291 100644
--- a/engines/avalanche/graph.cpp
+++ b/engines/avalanche/graph.cpp
@@ -81,18 +81,20 @@ void Graph::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y)
warning("STUB: Graph::drawSprite()");
}
-void Graph::copySurface(const byte *source, uint16 destX, uint16 destY) {
- Graphics::Surface picture;
-
+void Graph::drawPicture(const byte *source, uint16 destX, uint16 destY) {
uint32 i = 0;
+ // The height and the width are stored in 2 bytes.
uint16 pictureWidth = (source[i++] + 1);
pictureWidth += (source[i++] << 8);
uint16 pictureHeight = (source[i++] + 1);
pictureHeight += (source[i++] << 8);
+ Graphics::Surface picture; // We make a Surface object for the picture itself.
+
picture.create(pictureWidth, pictureHeight, Graphics::PixelFormat::createFormatCLUT8());
+ // Produce the picture.
for (byte y = 0; y < pictureHeight; y++)
for (int8 plane = 3; plane >= 0; plane--) // The planes are in the opposite way.
for (uint16 x = 0; x < pictureWidth; x += 8) {
@@ -103,6 +105,7 @@ void Graph::copySurface(const byte *source, uint16 destX, uint16 destY) {
}
}
+ // Copy the picture to a given place on the screen.
for (uint16 y = 0; y < picture.h; y++)
for (uint16 x = 0; x < picture.w; x++)
*(byte *)_surface.getBasePtr(x + destX, y + destY) = *(byte *)picture.getBasePtr(x, y);
diff --git a/engines/avalanche/graph.h b/engines/avalanche/graph.h
index 80f79130bf..4682ca67f8 100644
--- a/engines/avalanche/graph.h
+++ b/engines/avalanche/graph.h
@@ -73,7 +73,7 @@ public:
void drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y);
- void copySurface(const byte *source, uint16 destX, uint16 destY);
+ void drawPicture(const byte *source, uint16 destX, uint16 destY);
void refreshScreen();
diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp
index d58ddfc566..614a08157d 100644
--- a/engines/avalanche/lucerna2.cpp
+++ b/engines/avalanche/lucerna2.cpp
@@ -766,7 +766,7 @@ void Lucerna::thinkabout(byte z, bool th) { /* Hey!!! Get it and put it!!! *
f.read(buffer, picsize);
- _vm->_graph.copySurface(buffer, 205, 170);
+ _vm->_graph.drawPicture(buffer, 205, 170);
delete[] buffer;
@@ -823,7 +823,7 @@ void Lucerna::toolbar() {
f.read(buffer, bufferSize);
- _vm->_graph.copySurface(buffer, 5, 169);
+ _vm->_graph.drawPicture(buffer, 5, 169);
delete[] buffer;
@@ -859,7 +859,7 @@ void Lucerna::showscore() {
for (byte fv = 0; fv < 3; fv ++)
if (_vm->_gyro.lastscore[fv] != numbers[fv])
- _vm->_graph.copySurface(_vm->_gyro.digit[numbers[fv]], 250 + (fv + 1) * 15, 177);
+ _vm->_graph.drawPicture(_vm->_gyro.digit[numbers[fv]], 250 + (fv + 1) * 15, 177);
for (byte fv = 0; fv < 2; fv ++)
_vm->_trip.getset[fv].remember(scorespace);
@@ -1052,7 +1052,7 @@ void Lucerna::showrw() { // It's data is loaded in load_digits().
putimage(0, 161, rwlite[with.rw], 0);
}*/
- _vm->_graph.copySurface(_vm->_gyro.rwlite[_vm->_gyro.dna.rw], 0, 161);
+ _vm->_graph.drawPicture(_vm->_gyro.rwlite[_vm->_gyro.dna.rw], 0, 161);
_vm->_gyro.on();
//setactivepage(1 - cp);