aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/avalanche/graph.cpp12
-rw-r--r--engines/avalanche/graph.h2
-rw-r--r--engines/avalanche/lucerna2.cpp72
3 files changed, 76 insertions, 10 deletions
diff --git a/engines/avalanche/graph.cpp b/engines/avalanche/graph.cpp
index 2272fb6144..2143bcf53e 100644
--- a/engines/avalanche/graph.cpp
+++ b/engines/avalanche/graph.cpp
@@ -78,18 +78,22 @@ void Graph::drawBar(int16 x1, int16 y1, int16 x2, int16 y2, int16 color) {
_surface.fillRect(Common::Rect(x1, y1, x2, y2), color);
}
-Graphics::Surface *Graph::readImage(Common::File &f) {
+Graphics::Surface *Graph::readImage(const byte *source) {
Graphics::Surface *picture = new Graphics::Surface;
+
+ uint32 i = 0;
- uint16 pictureWidth = f.readUint16LE() + 1;
- uint16 pictureHeight = f.readUint16LE() + 1;
+ uint16 pictureWidth = (source[i++] + 1);
+ pictureWidth += (source[i++] << 8);
+ uint16 pictureHeight = (source[i++] + 1);
+ pictureHeight += (source[i++] << 8);
picture->create(pictureWidth, pictureHeight, Graphics::PixelFormat::createFormatCLUT8());
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) {
- byte pixel = f.readByte();
+ byte pixel = source[i++];
for (byte i = 0; i < 8; i++) {
byte pixelBit = (pixel >> i) & 1;
*(byte *)picture->getBasePtr(x + 7 - i, y) += (pixelBit << plane);
diff --git a/engines/avalanche/graph.h b/engines/avalanche/graph.h
index 7d5f12f20f..f1a6678fad 100644
--- a/engines/avalanche/graph.h
+++ b/engines/avalanche/graph.h
@@ -57,7 +57,7 @@ public:
void drawBar(int16 x1, int16 y1, int16 x2, int16 y2, int16 color);
// Must free the returened pointer!!!
- Graphics::Surface *readImage(Common::File &f);
+ Graphics::Surface *readImage(const byte *source);
void copySurface(const Graphics::Surface &source, uint16 destX, uint16 destY);
diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp
index 6ec856f1d4..a72b5b1b41 100644
--- a/engines/avalanche/lucerna2.cpp
+++ b/engines/avalanche/lucerna2.cpp
@@ -731,8 +731,6 @@ void Lucerna::enterroom(byte x, byte ped) {
}
void Lucerna::thinkabout(byte z, bool th) { /* Hey!!! Get it and put it!!! */
- const int16 x = 205;
- const int16 y = 170;
const int16 picsize = 966;
const bytefield thinkspace = {25, 170, 32, 200};
@@ -762,14 +760,20 @@ void Lucerna::thinkabout(byte z, bool th) { /* Hey!!! Get it and put it!!! *
f.seek(z * picsize + 65);
- Graphics::Surface *picture = _vm->_graph.readImage(f);
+ byte *buffer = new byte[picsize];
- _vm->_graph.copySurface(*picture, x, y);
+ f.read(buffer, picsize);
+
+ Graphics::Surface *picture = _vm->_graph.readImage(buffer);
+
+ _vm->_graph.copySurface(*picture, 205, 170);
picture->free();
delete picture;
+ delete[] buffer;
+
f.close();
_vm->_gyro.off();
@@ -817,7 +821,13 @@ void Lucerna::toolbar() {
/* off;*/
- Graphics::Surface *toolbar = _vm->_graph.readImage(f);
+ uint32 bufferSize = f.size()-40;
+
+ byte *buffer = new byte[bufferSize];
+
+ f.read(buffer, bufferSize);
+
+ Graphics::Surface *toolbar = _vm->_graph.readImage(buffer);
_vm->_graph.copySurface(*toolbar, 5, 169);
@@ -825,6 +835,8 @@ void Lucerna::toolbar() {
delete toolbar;
+ delete[] buffer;
+
f.close();
/* on;*/
@@ -834,6 +846,56 @@ void Lucerna::toolbar() {
}
void Lucerna::showscore() {
+
+ const bytefield scorespace = {33, 177, 39, 200};
+ Common::String q;
+
+ if (_vm->_gyro.demo)
+ return;
+
+ _vm->_gyro.dna.score = 156;
+ byte score = _vm->_gyro.dna.score;
+ byte numbers[3] = {0, 0, 0};
+ for (byte i = 0; i < 2; i++) {
+ byte divisor = 1;
+ for (byte j = 0; j < (2 - i); j++)
+ divisor *= 10;
+ numbers[i] = score / divisor;
+ score -= numbers[i] * divisor;
+ }
+ numbers[2] = score;
+
+
+
+
+ //Át kell írni a Graph::copySurface() -t hogy *byte tömböt kapjon és mindehol így is használni!!!!
+
+
+
+
+
+
+
+ //str(_vm->_gyro.dna.score, q);
+ //while (q[0] < '\3') q = string('0') + q;
+
+ //str(dna.score,q);
+ //while q[0]<#3 do q:='0'+q;
+
+ //_vm->_gyro.off();
+
+ ////setactivepage(3);
+ //for (byte fv = 0; fv < 3; fv ++)
+ // if (_vm->_gyro.lastscore[fv] != q[fv])
+ // putimage(250 + fv * 15, 177, _vm->_gyro.digit[q[fv]], 0);
+
+ //for (byte fv = 0; fv <= 1; fv ++)
+ // _vm->_trip.getset[fv].remember(scorespace);
+
+ //setactivepage(1 - cp);
+ _vm->_gyro.on();
+ _vm->_gyro.lastscore = q;
+
warning("STUB: Lucerna::showscore()");
}