aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoruruk2013-08-17 15:07:02 +0200
committeruruk2013-08-17 15:07:02 +0200
commit87159b96399b579cc79ce7d78e7710e34cabe460 (patch)
tree8aedc40b92d35179c2095a1400e22d146144ba0d
parent84bf98c9e5bd0d2b3a50f753714852e6d356d985 (diff)
downloadscummvm-rg350-87159b96399b579cc79ce7d78e7710e34cabe460.tar.gz
scummvm-rg350-87159b96399b579cc79ce7d78e7710e34cabe460.tar.bz2
scummvm-rg350-87159b96399b579cc79ce7d78e7710e34cabe460.zip
AVALANCHE: Implement the rest of Lucerna::checkclick() and everything connected to it. (Except sounds.)
-rw-r--r--engines/avalanche/acci2.cpp109
-rw-r--r--engines/avalanche/acci2.h2
-rw-r--r--engines/avalanche/lucerna2.cpp169
-rw-r--r--engines/avalanche/lucerna2.h2
-rw-r--r--engines/avalanche/scrolls2.cpp38
5 files changed, 188 insertions, 132 deletions
diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp
index 48c8118114..0ba511e8e7 100644
--- a/engines/avalanche/acci2.cpp
+++ b/engines/avalanche/acci2.cpp
@@ -44,6 +44,7 @@
#include "common/textconsole.h"
#include <cstring>
+#include <cmath>
/*#include "NimUnit.h"*/
@@ -274,33 +275,38 @@ begin
end;*/
Common::String Acci::rank() {
- byte fv;
-
- Common::String rank_result = "";
- for (fv = 1; fv <= 8; fv++) {
+ for (byte fv = 0; fv < 8; fv++) {
if ((_vm->_gyro->dna.score >= ranks[fv].score) && (_vm->_gyro->dna.score < ranks[fv + 1].score)) {
- rank_result = ranks[fv].title;
- return rank_result;
+ return ranks[fv].title;
}
}
-
- return rank_result;
+ return "";
}
Common::String Acci::totaltime() {
- const double ticks_in_1_sec = double(65535) / 3600;
+ const double ticks_in_1_sec = (double)(65535) / 3600;
uint16 h, m, s;
Common::String a;
- /* There are 65535 clock ticks in a second,
- 1092.25 in a minute, and
- 65535 in an hour. */
- Common::String totaltime_result;
-
- warning("STUB: Acci::totaltime()");
-
- totaltime_result = a;
- return totaltime_result;
+ // There are 65535 clock ticks in a second, 1092.25 in a minute, and 65535 in an hour.
+ h = _vm->_gyro->dna.total_time / ticks_in_1_sec; // No. of seconds.
+ if (h < 0)
+ h = ceil((float)h);
+ else
+ h = floor((float)h);
+ m = h % 3600;
+ h = h / 3600;
+ s = m % 60;
+ m = m / 60;
+
+ a = "You've been playing for ";
+ if (h > 0)
+ a = a + _vm->_gyro->strf(h) + " hours, ";
+ if ((m > 0) || (h != 0))
+ a = a + _vm->_gyro->strf(m) + " minutes and ";
+ a = a + _vm->_gyro->strf(s) + " seconds.";
+
+ return a;
}
@@ -602,8 +608,32 @@ void Acci::parse() {
_vm->_gyro->her = person;
}
-void Acci::examobj() { /* Examine a standard object-thing */
- warning("STUB: Acci::examobj()");
+void Acci::examobj() {
+ if (thing != _vm->_gyro->thinks)
+ _vm->_lucerna->thinkabout(thing, _vm->_gyro->a_thing);
+ switch (thing) {
+ case _vm->_gyro->wine :
+ switch (_vm->_gyro->dna.winestate) {// 4 is perfect wine. 0 is not holding the wine.
+ case 1:
+ _vm->_visa->dixi('t', 1); // Normal examine wine scroll
+ break;
+ case 2:
+ _vm->_visa->dixi('d', 6); // Bad wine
+ break;
+ case 3:
+ _vm->_visa->dixi('d', 7); // Vinegar
+ break;
+ }
+ break;
+ case _vm->_gyro->onion:
+ if (_vm->_gyro->dna.rotten_onion)
+ _vm->_visa->dixi('q', 21); // Yucky onion.
+ else
+ _vm->_visa->dixi('t', 18); // Normal onion scroll
+ break;
+ default:
+ _vm->_visa->dixi('t', thing); // <<< Ordinarily
+ }
}
bool Acci::personshere() { // Person equivalent of "holding".
@@ -624,8 +654,19 @@ void Acci::exampers() {
}
bool Acci::holding() {
- warning("STUB: Acci::holding()");
- return true;
+ if ((51 <= thing) && (thing <= 99)) // Also.
+ return true;
+
+ bool holdingResult = false;
+
+ if (thing > 100)
+ _vm->_scrolls->display("Be reasonable!");
+ else if (!_vm->_gyro->dna.obj[thing]) // Verbs that need "thing" to be in the inventory.
+ _vm->_scrolls->display("You're not holding it, Avvy.");
+ else
+ holdingResult = true;
+
+ return holdingResult;
}
@@ -635,9 +676,21 @@ void Acci::special(bool before) {
}
void Acci::examine() {
- /* Examine. EITHER it's an object OR it's an Also OR it's a person OR
- it's something else. */
- warning("STUB: Acci::examine()");
+ // EITHER it's an object OR it's an Also OR it's a person OR it's something else.
+ if ((person == pardon) && (thing != pardon)) {
+ if (holding()) {
+ // Remember: it's been Slipped! Ie subtract 49.
+ if ((1 <= thing) && (thing <= 49)) // Standard object
+ examobj();
+ else if ((50 <= thing) && (thing <= 100)) { // Also thing
+ special(true);
+ _vm->_scrolls->display(*_vm->_gyro->also[thing - 51][0]);
+ special(false);
+ }
+ }
+ } else if (person != pardon)
+ exampers();
+ else _vm->_scrolls->display("It's just as it looks on the picture."); // Don't know: guess.
}
@@ -1706,9 +1759,9 @@ void Acci::do_that() {
_vm->_lucerna->gameover();
break;
case vb_score:
- _vm->_scrolls->display(Common::String("Your score is ") + _vm->_gyro->strf(_vm->_gyro->dna.score) + ",\3\rout of a " +
- "possible 128.\r\rThis gives you a rank of " + rank() +
- ".\r\r" + totaltime());
+ _vm->_scrolls->display(Common::String("Your score is ") + _vm->_gyro->strf(_vm->_gyro->dna.score) + ',' + _vm->_scrolls->kControlCenter
+ + _vm->_scrolls->kControlNewLine + "out of a possible 128." + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine
+ + "This gives you a rank of " + rank() + '.' + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + totaltime());
break;
case vb_put:
putproc();
diff --git a/engines/avalanche/acci2.h b/engines/avalanche/acci2.h
index 2a97b98529..2b174f0a13 100644
--- a/engines/avalanche/acci2.h
+++ b/engines/avalanche/acci2.h
@@ -169,7 +169,7 @@ private:
void clearuint16s();
- void examobj();
+ void examobj(); // Examine a standard object-thing
bool personshere();
diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp
index 5762b76441..f632a66db0 100644
--- a/engines/avalanche/lucerna2.cpp
+++ b/engines/avalanche/lucerna2.cpp
@@ -879,8 +879,43 @@ void Lucerna::topcheck() {
/* Do this one */
}
-void Lucerna::mouseway() {
- warning("STUB: Lucerna::mouseway()");
+void Lucerna::mouseway(const Common::Point &cursorPos) {
+ byte col = *(byte *)_vm->_graphics->_surface.getBasePtr(cursorPos.x, cursorPos.y / 2);
+
+ switch (col) {
+ case green: {
+ _vm->_gyro->dna.rw = _vm->_trip->up;
+ _vm->_trip->rwsp(0, _vm->_trip->up);
+ showrw();
+ }
+ break;
+ case brown: {
+ _vm->_gyro->dna.rw = _vm->_trip->down;
+ _vm->_trip->rwsp(0, _vm->_trip->down);
+ showrw();
+ }
+ break;
+ case cyan: {
+ _vm->_gyro->dna.rw = _vm->_trip->left;
+ _vm->_trip->rwsp(0, _vm->_trip->left);
+ showrw();
+ }
+ break;
+ case lightmagenta: {
+ _vm->_gyro->dna.rw = _vm->_trip->right;
+ _vm->_trip->rwsp(0, _vm->_trip->right);
+ showrw();
+ }
+ break;
+ case red:
+ case white:
+ case lightcyan:
+ case yellow: { // Fall-throughs are intended.
+ _vm->_trip->stopwalking();
+ showrw();
+ }
+ break;
+ }
}
void Lucerna::inkey() {
@@ -1000,88 +1035,54 @@ void Lucerna::checkclick() {
_vm->_gyro->newpointer(4); // fletch
}
-
-
- //if (_vm->_gyro->mpress > 0) {
- // switch (_vm->_gyro->mpy) {
- // case RANGE_11(0, 10):
- // if (_vm->_gyro->dropsok) topcheck();
- // break;
- // case 11 ... 158:
- // if (!_vm->_gyro->dropsok)
- // _vm->_gyro->mousetext = Common::String('\15') + _vm->_gyro->mousetext;
- // break; /* But otherwise, it's
- // equivalent to pressing Enter. */
- // case RANGE_11(159, 169): { /* Click on command line */
- // cursor_off();
- // curpos = (_vm->_gyro->mx - 16) / 8;
- // if (curpos > length(current) + 1)
- // curpos = length(current) + 1;
- // if (curpos < 1)
- // curpos = 1;
- // cursor_on();
- // }
- // break;
- // case 170 ... 200:
- // switch (_vm->_gyro->mpx) { /* bottom check */
- // case 0 ... 207:
- // mouseway();
- // break;
- // case 208 ... 260: { /* Examine the thing */
- // do {
- // _vm->_gyro->check();
- // } while (!(_vm->_gyro->mrelease > 0));
- // if (_vm->_gyro->thinkthing) {
- // _vm->_acci->thing = _vm->_gyro->thinks;
- // _vm->_acci->thing += 49;
- // _vm->_acci->person = _vm->_acci->pardon;
- // } else {
- // _vm->_acci->person = _vm->_gyro->thinks;
- // _vm->_acci->thing = _vm->_acci->pardon;
- // }
- // callverb(_vm->_acci->vb_exam);
- // }
- // break;
- // case 261 ... 319: {
- // do {
- // checkclick();
- // } while (!(_vm->_gyro->mrelease > 0));
- // callverb(_vm->_acci->vb_score);
- // }
- // break;
- // case 320 ... 357: {
- // _vm->_trip->tr[0].xs = _vm->_gyro->walk;
- // _vm->_trip->newspeed();
- // }
- // break;
- // case 358 ... 395: {
- // _vm->_trip->tr[0].xs = _vm->_gyro->run;
- // _vm->_trip->newspeed();
- // }
- // break;
- // case 396 ... 483:
- // fxtoggle();
- // break; /* "sound" */
- // /* 484..534: begin { clock }
- // off; if getpixel(mx,my)=14 then mousetext:='#'+mousetext; on;
- // end;*/
- // case 535 ... 640:
- // _vm->_gyro->mousetext = Common::String('\15') + _vm->_gyro->mousetext;
- // break;
- // }
- // break;
- // }
- //}
-
- /* if mrelease>0 then
- begin
- if (cw<>177) and (mry>10) then
- begin to_do:=(((mrx-20) div 100)*20)+(mry div 10); closewin; end;
- end;*/
-
-
-
- warning("STUB: Lucerna::checkclick()");
+ if (holdLeftMouse)
+ if ((0 <= cursorPos.y) && (cursorPos.y <= 21)) { // Clink on the dropdown menu.
+ if (_vm->_gyro->dropsok)
+ topcheck();
+ } else if ((317 <= cursorPos.y) && (cursorPos.y <= 339)) { // Click on the command line.
+ _vm->_parser->_inputTextPos = (cursorPos.x - 23) / 8;
+ if (_vm->_parser->_inputTextPos > _vm->_parser->_inputText.size() + 1)
+ _vm->_parser->_inputTextPos = _vm->_parser->_inputText.size() + 1;
+ if (_vm->_parser->_inputTextPos < 1)
+ _vm->_parser->_inputTextPos = 1;
+ _vm->_parser->_inputTextPos--;
+ _vm->_parser->plotText();
+ } else if ((340 <= cursorPos.y) && (cursorPos.y <= 399)) { // Check the toolbar.
+ if ((137 <= cursorPos.x) && (cursorPos.x <= 207)) { // Control Avvy with the compass.
+ if (_vm->_gyro->alive && _vm->_gyro->dna.avvy_is_awake)
+ mouseway(cursorPos);
+ } else if ((208 <= cursorPos.x) && (cursorPos.x <= 260)) { // Examine the thing.
+ do {
+ _vm->updateEvents();
+ } while (holdLeftMouse);
+
+ if (_vm->_gyro->thinkthing) {
+ _vm->_acci->thing = _vm->_gyro->thinks;
+ _vm->_acci->thing += 49;
+ _vm->_acci->person = _vm->_acci->pardon;
+ } else {
+ _vm->_acci->person = _vm->_gyro->thinks;
+ _vm->_acci->thing = _vm->_acci->pardon;
+ }
+ callverb(_vm->_acci->vb_exam);
+ } else if ((261 <= cursorPos.x) && (cursorPos.x <= 319)) { // Display the score.
+ do {
+ _vm->updateEvents();
+ } while (holdLeftMouse);
+
+ callverb(_vm->_acci->vb_score);
+ } else if ((320 <= cursorPos.x) && (cursorPos.x <= 357)) { // Change speed.
+ _vm->_trip->tr[0].xs = _vm->_gyro->walk;
+ _vm->_trip->newspeed();
+ } else if ((358 <= cursorPos.x) && (cursorPos.x <= 395)) { // Change speed.
+ _vm->_trip->tr[0].xs = _vm->_gyro->run;
+ _vm->_trip->newspeed();
+ } else if ((396 <= cursorPos.x) && (cursorPos.x <= 483))
+ fxtoggle();
+ else if ((535 <= cursorPos.x) && (cursorPos.x <= 640))
+ _vm->_gyro->mousetext = Common::String(13) + _vm->_gyro->mousetext;
+ } else if (!_vm->_gyro->dropsok)
+ _vm->_gyro->mousetext = Common::String(13) + _vm->_gyro->mousetext;
}
void Lucerna::mouse_init() {
diff --git a/engines/avalanche/lucerna2.h b/engines/avalanche/lucerna2.h
index 840c69042f..8ab7342c42 100644
--- a/engines/avalanche/lucerna2.h
+++ b/engines/avalanche/lucerna2.h
@@ -70,7 +70,7 @@ public:
void points(byte num); /* Add on no. of points */
- void mouseway();
+ void mouseway(const Common::Point &cursorPos);
void inkey();
diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp
index d141edc101..104a6170bc 100644
--- a/engines/avalanche/scrolls2.cpp
+++ b/engines/avalanche/scrolls2.cpp
@@ -131,7 +131,7 @@ void Scrolls::say(int16 x, int16 y, Common::String z) { /* Fancy FAST screenwrit
// We have to draw the characters one-by-one because of the accidental font changes.
i++;
Common::String chr(z[xx]);
- _vm->_graphics->drawText(_vm->_graphics->_scrolls, chr, itw, 12, x * 8 + offset * 4 + i * 8, y, black);
+ _vm->_graphics->drawText(_vm->_graphics->_scrolls, chr, itw, 12, (x - 1) * 8 + offset * 4 + i * 8, y, black);
_vm->_logger->log_scrollchar(Common::String(z[xx]));
}
@@ -592,21 +592,21 @@ void Scrolls::natural() { /* Natural state of bubbles */
Common::String Scrolls::lsd() {
Common::String x;
- Common::String lsd_result;
- if (_vm->_gyro->dna.pence < 12) {
- /* just pence */
+ if (_vm->_gyro->dna.pence < 12) { // just pence
x = _vm->_gyro->strf(_vm->_gyro->dna.pence) + 'd';
- } else if (_vm->_gyro->dna.pence < 240) {
- /* shillings & pence */
- x = _vm->_gyro->strf(_vm->_gyro->dna.pence / int32(12)) + '/';
- if ((_vm->_gyro->dna.pence % int32(12)) == 0) x = x + '-';
- else x = x + _vm->_gyro->strf(_vm->_gyro->dna.pence % int32(12));
- } else /* L, s & d */
- x = Common::String('œ') + _vm->_gyro->strf(_vm->_gyro->dna.pence / int32(240)) + '.' + _vm->_gyro->strf((_vm->_gyro->dna.pence / int32(12)) % int32(20))
- + '.' + _vm->_gyro->strf(_vm->_gyro->dna.pence % int32(12));
- if (_vm->_gyro->dna.pence > 12) x = x + " (that's " + _vm->_gyro->strf(_vm->_gyro->dna.pence) + "d)";
- lsd_result = x;
- return lsd_result;
+ } else if (_vm->_gyro->dna.pence < 240) { // shillings & pence
+ x = _vm->_gyro->strf(_vm->_gyro->dna.pence / 12) + '/';
+ if ((_vm->_gyro->dna.pence % 12) == 0)
+ x = x + '-';
+ else
+ x = x + _vm->_gyro->strf(_vm->_gyro->dna.pence % 12);
+ } else // L, s & d
+ x = Common::String('œ') + _vm->_gyro->strf(_vm->_gyro->dna.pence / 240) + '.' + _vm->_gyro->strf((_vm->_gyro->dna.pence / 12) % 20)
+ + '.' + _vm->_gyro->strf(_vm->_gyro->dna.pence % 12);
+ if (_vm->_gyro->dna.pence > 12)
+ x = x + " (that's " + _vm->_gyro->strf(_vm->_gyro->dna.pence) + "d)";
+
+ return x;
}
@@ -661,7 +661,9 @@ void Scrolls::calldrivers() {
}
}
- for (fv = 0; fv < _vm->_gyro->bufsize; fv++)
+ uint16 size = _vm->_gyro->bufsize;
+
+ for (fv = 0; fv < size; fv++)
if (mouthnext) {
if (_vm->_gyro->buffer[fv] == kControlRegister)
param = 0;
@@ -734,8 +736,8 @@ void Scrolls::calldrivers() {
case kControlNegative: {
switch (param) {
case 1:
- display(lsd() + kControlToBuffer);
- break; /* insert cash balance (recursion) */
+ display(lsd() + kControlToBuffer); // Insert cash balance. (Recursion)
+ break;
case 2:
display(_vm->_acci->words[_vm->_acci->first_password + _vm->_gyro->dna.pass_num].w + kControlToBuffer);
break;