From 90788cec113de7c9d26058cfa5e103c475105c21 Mon Sep 17 00:00:00 2001 From: uruk Date: Wed, 17 Jul 2013 12:27:08 +0200 Subject: AVALANCHE: Implement Lucerna::showscore(). --- engines/avalanche/gyro2.h | 2 +- engines/avalanche/lucerna2.cpp | 48 +++++++++++++++++------------------------- 2 files changed, 20 insertions(+), 30 deletions(-) (limited to 'engines') diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index 39fabf8cce..1f9d9a15ab 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -525,7 +525,7 @@ public: byte *digit[10]; // digitsize and rwlitesize are defined in Lucerna::load_digits() !!! byte *rwlite[9]; // Maybe it will be needed to move them to the class itself instead. byte oldrw; - Common::String lastscore; + int8 lastscore[3]; byte cmp; /* current mouse-void **/ Common::String verbstr; /* what you can do with your object. :-) */ diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index a72b5b1b41..b4febf2617 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -848,14 +848,12 @@ 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}; + uint16 score = _vm->_gyro.dna.score; + int8 numbers[3] = {0, 0, 0}; for (byte i = 0; i < 2; i++) { byte divisor = 1; for (byte j = 0; j < (2 - i); j++) @@ -865,38 +863,29 @@ void Lucerna::showscore() { } numbers[2] = score; + _vm->_gyro.off(); + //setactivepage(3); + for (byte fv = 0; fv < 3; fv ++) + if (_vm->_gyro.lastscore[fv] != numbers[fv]) { + Graphics::Surface *digit = _vm->_graph.readImage(_vm->_gyro.digit[numbers[fv]]); - //Á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->_graph.copySurface(*digit, 250 + (fv + 1) * 15, 177); - //_vm->_gyro.off(); + digit->free(); - ////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); + delete digit; + } - //for (byte fv = 0; fv <= 1; fv ++) - // _vm->_trip.getset[fv].remember(scorespace); + for (byte fv = 0; fv < 2; fv ++) + _vm->_trip.getset[fv].remember(scorespace); //setactivepage(1 - cp); - _vm->_gyro.on(); - _vm->_gyro.lastscore = q; - warning("STUB: Lucerna::showscore()"); + _vm->_gyro.on(); + for (byte i = 0; i < 3; i++) + _vm->_gyro.lastscore[i] = numbers[i]; } void Lucerna::points(byte num) { /* Add on no. of points */ @@ -1252,8 +1241,9 @@ void Lucerna::minor_redraw() { _vm->_gyro.cp = 1 - _vm->_gyro.cp; _vm->_trip.getback(); } - - _vm->_gyro.lastscore = "TJA"; /* impossible digits */ + + for (byte i = 0; i < 3; i++) + _vm->_gyro.lastscore[i] = -1; /* impossible digits */ showscore(); dawn(); -- cgit v1.2.3