2013-06-24 10:15:42 +02:00
|
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
|
*
|
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
|
* file distributed with this source distribution.
|
|
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* This code is based on the original source code of Lord Avalot d'Argent version 1.3.
|
|
|
|
|
* Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman.
|
|
|
|
|
*/
|
|
|
|
|
|
2013-07-02 16:46:56 +02:00
|
|
|
|
/* SCROLLS The scroll driver. */
|
|
|
|
|
|
2013-06-28 17:41:02 +02:00
|
|
|
|
#include "avalanche/avalanche.h"
|
|
|
|
|
|
2013-06-24 10:15:42 +02:00
|
|
|
|
#include "avalanche/scrolls2.h"
|
|
|
|
|
#include "avalanche/gyro2.h"
|
2013-06-25 18:04:52 +02:00
|
|
|
|
#include "avalanche/enhanced2.h"
|
2013-06-29 16:36:40 +02:00
|
|
|
|
#include "avalanche/lucerna2.h"
|
|
|
|
|
#include "avalanche/trip6.h"
|
|
|
|
|
#include "avalanche/acci2.h"
|
|
|
|
|
#include "avalanche/visa2.h"
|
|
|
|
|
#include "avalanche/timeout2.h"
|
2013-06-24 10:15:42 +02:00
|
|
|
|
|
|
|
|
|
#include "common/textconsole.h"
|
2013-07-05 23:13:33 +02:00
|
|
|
|
#include "common/file.h"
|
2013-06-24 10:15:42 +02:00
|
|
|
|
|
2013-06-29 16:36:40 +02:00
|
|
|
|
//#include "avalanche/joystick2.h" - Will be implemented later, if it will be implemented at all...
|
|
|
|
|
|
2013-06-24 10:15:42 +02:00
|
|
|
|
namespace Avalanche {
|
|
|
|
|
|
2013-07-24 19:43:10 +02:00
|
|
|
|
Scrolls::Scrolls(AvalancheEngine *vm) {
|
2013-06-28 17:41:02 +02:00
|
|
|
|
_vm = vm;
|
|
|
|
|
}
|
2013-06-24 10:15:42 +02:00
|
|
|
|
|
2013-07-02 15:10:16 +02:00
|
|
|
|
void Scrolls::init() {
|
|
|
|
|
loadfont();
|
|
|
|
|
resetscrolldriver();
|
|
|
|
|
}
|
|
|
|
|
|
2013-06-28 17:41:02 +02:00
|
|
|
|
void Scrolls::state(byte x) { /* Sets "Ready" light to whatever */
|
2013-07-24 18:25:07 +02:00
|
|
|
|
if (_vm->_gyro->ledstatus == x)
|
2013-07-12 10:43:13 +02:00
|
|
|
|
return; /* Already like that! */
|
|
|
|
|
|
2013-09-04 13:16:27 +02:00
|
|
|
|
byte color = black;
|
2013-07-12 10:43:13 +02:00
|
|
|
|
switch (x) {
|
|
|
|
|
case 0:
|
|
|
|
|
color = black;
|
|
|
|
|
break; /* Off */
|
|
|
|
|
case 1:
|
|
|
|
|
case 2:
|
|
|
|
|
case 3:
|
|
|
|
|
color = green;
|
|
|
|
|
break; /* Hit a key */
|
|
|
|
|
}
|
2013-07-02 01:10:45 +02:00
|
|
|
|
warning("STUB: Scrolls::state()");
|
2013-07-12 10:43:13 +02:00
|
|
|
|
|
2013-08-16 13:40:58 +02:00
|
|
|
|
CursorMan.showMouse(false);
|
2013-07-12 10:43:13 +02:00
|
|
|
|
|
2013-07-24 17:52:57 +02:00
|
|
|
|
_vm->_graphics->drawBar(419, 195, 438, 197, color);
|
2013-07-12 10:43:13 +02:00
|
|
|
|
|
2013-08-16 13:40:58 +02:00
|
|
|
|
CursorMan.showMouse(true);
|
2013-07-24 18:25:07 +02:00
|
|
|
|
_vm->_gyro->ledstatus = x;
|
2013-06-28 17:41:02 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Scrolls::easteregg() {
|
2013-07-02 01:10:45 +02:00
|
|
|
|
warning("STUB: Scrolls::easteregg()");
|
2013-06-28 17:41:02 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Scrolls::say(int16 x, int16 y, Common::String z) { /* Fancy FAST screenwriting */
|
2013-08-11 14:06:15 +02:00
|
|
|
|
fontType itw;
|
2013-08-06 01:17:44 +02:00
|
|
|
|
byte lz = z.size();
|
|
|
|
|
|
2013-08-12 14:50:05 +02:00
|
|
|
|
bool offset = x % 8 == 4;
|
|
|
|
|
x = x / 8;
|
|
|
|
|
y++;
|
|
|
|
|
int16 i = 0;
|
2013-08-06 01:17:44 +02:00
|
|
|
|
for (byte xx = 0; xx < lz; xx++) {
|
2013-08-05 15:25:44 +02:00
|
|
|
|
switch (z[xx]) {
|
|
|
|
|
case kControlRoman: {
|
|
|
|
|
cfont = roman;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case kControlItalic: {
|
|
|
|
|
cfont = italic;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default: {
|
2013-08-06 01:17:44 +02:00
|
|
|
|
for (byte yy = 0; yy < 12; yy++)
|
2013-08-12 12:52:17 +02:00
|
|
|
|
itw[(byte)z[xx]][yy] = ch[cfont][(byte)z[xx]][yy + 2];
|
2013-08-11 14:06:15 +02:00
|
|
|
|
|
2013-08-12 14:50:05 +02:00
|
|
|
|
// We have to draw the characters one-by-one because of the accidental font changes.
|
|
|
|
|
i++;
|
|
|
|
|
Common::String chr(z[xx]);
|
2013-08-17 15:07:02 +02:00
|
|
|
|
_vm->_graphics->drawText(_vm->_graphics->_scrolls, chr, itw, 12, (x - 1) * 8 + offset * 4 + i * 8, y, black);
|
2013-08-05 15:25:44 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2013-06-28 17:41:02 +02:00
|
|
|
|
}
|
2013-06-25 13:05:04 +02:00
|
|
|
|
|
2013-08-04 12:54:11 +02:00
|
|
|
|
/* Here are the procedures that Scroll calls */ /* So they must be... */ /*$F+*/
|
2013-06-25 13:05:04 +02:00
|
|
|
|
|
2013-06-28 17:41:02 +02:00
|
|
|
|
void Scrolls::normscroll() {
|
2013-08-05 17:35:17 +02:00
|
|
|
|
Common::String egg = Common::String(kControlParagraph) + kControlLeftJustified + kControlNegative + kControlBell + kControlBackspace + "***";
|
|
|
|
|
Common::String e = "(c) 1994";
|
|
|
|
|
|
|
|
|
|
state(3);
|
|
|
|
|
_vm->_gyro->seescroll = true;
|
2013-08-16 13:40:58 +02:00
|
|
|
|
CursorMan.showMouse(true);
|
2013-08-05 17:35:17 +02:00
|
|
|
|
_vm->_gyro->newpointer(4);
|
|
|
|
|
_vm->_lucerna->mousepage(1 - _vm->_gyro->cp);
|
|
|
|
|
|
2013-08-06 01:17:44 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
::Graphics::Surface temp;
|
|
|
|
|
temp.copyFrom(_vm->_graphics->_surface);
|
2013-08-07 10:37:59 +02:00
|
|
|
|
_vm->_graphics->_surface.copyFrom(_vm->_graphics->_scrolls); // TODO: Rework it using getSubArea !!!!!!!
|
2013-08-16 19:24:40 +02:00
|
|
|
|
|
2013-08-06 01:17:44 +02:00
|
|
|
|
Common::Event event;
|
2013-08-07 10:37:59 +02:00
|
|
|
|
while (!_vm->shouldQuit()) {
|
2013-08-16 19:24:40 +02:00
|
|
|
|
_vm->_graphics->refreshScreen();
|
|
|
|
|
|
2013-08-06 01:17:44 +02:00
|
|
|
|
_vm->getEvent(event);
|
2013-08-16 19:24:40 +02:00
|
|
|
|
if ((event.type == Common::EVENT_LBUTTONUP) ||
|
|
|
|
|
((event.type == Common::EVENT_KEYDOWN) && ((event.kbd.keycode == Common::KEYCODE_ESCAPE) || (event.kbd.keycode == Common::KEYCODE_RETURN) || (event.kbd.keycode == Common::KEYCODE_HASH) || (event.kbd.keycode == Common::KEYCODE_PLUS))))
|
2013-08-06 01:17:44 +02:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_vm->_graphics->_surface.copyFrom(temp);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-09-04 11:43:02 +02:00
|
|
|
|
// char r;
|
|
|
|
|
// bool oktoexit;
|
2013-08-05 17:35:17 +02:00
|
|
|
|
// do {
|
|
|
|
|
// do {
|
|
|
|
|
// _vm->_gyro->check(); /* was "checkclick;" */
|
|
|
|
|
//
|
|
|
|
|
//#ifdef RECORD slowdown(); basher::count += 1; #endif
|
|
|
|
|
//
|
|
|
|
|
// if (_vm->_gyro->demo) {
|
|
|
|
|
// if (_vm->_basher->demo_ready())
|
|
|
|
|
// break;
|
|
|
|
|
// if (_vm->_enhanced->keypressede())
|
|
|
|
|
// return;
|
|
|
|
|
// } else if (_vm->_enhanced->keypressede())
|
|
|
|
|
// break;
|
|
|
|
|
// } while (!((mrelease > 0) || (buttona1()) || (buttonb1())));
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// if (mrelease == 0) {
|
|
|
|
|
// inkey();
|
|
|
|
|
// if (aboutscroll) {
|
|
|
|
|
// move(e[2 - 1], e[1 - 1], 7);
|
|
|
|
|
// e[8 - 1] = inchar;
|
|
|
|
|
// if (egg == e) easteregg();
|
|
|
|
|
// }
|
|
|
|
|
// oktoexit = set::of('\15', '\33', '+', '#', eos).has(inchar);
|
|
|
|
|
// if (! oktoexit) errorled();
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// } while (!((oktoexit) || (mrelease > 0)));
|
|
|
|
|
//
|
|
|
|
|
//#ifdef RECORD record_one(); #endif
|
|
|
|
|
//
|
2013-08-16 19:24:40 +02:00
|
|
|
|
// _vm->_gyro->screturn = r == '#'; /* "back door" */
|
|
|
|
|
|
2013-08-05 17:35:17 +02:00
|
|
|
|
state(0);
|
|
|
|
|
_vm->_gyro->seescroll = false;
|
|
|
|
|
_vm->_lucerna->mousepage(_vm->_gyro->cp);
|
2013-08-16 13:40:58 +02:00
|
|
|
|
CursorMan.showMouse(false);
|
2013-08-16 23:02:53 +02:00
|
|
|
|
_vm->_lucerna->holdLeftMouse = false; // Used in Lucerna::checkclick().
|
2013-08-05 17:35:17 +02:00
|
|
|
|
|
2013-06-28 17:41:02 +02:00
|
|
|
|
warning("STUB: Scrolls::normscroll()");
|
|
|
|
|
}
|
2013-06-25 13:05:04 +02:00
|
|
|
|
|
2013-06-28 17:41:02 +02:00
|
|
|
|
void Scrolls::dialogue() {
|
|
|
|
|
warning("STUB: Scrolls::dialogue()");
|
|
|
|
|
}
|
2013-06-25 13:05:04 +02:00
|
|
|
|
|
2013-07-02 01:10:45 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-06-28 17:41:02 +02:00
|
|
|
|
void Scrolls::store_(byte what, tunetype &played) {
|
2013-07-02 01:10:45 +02:00
|
|
|
|
memcpy(played+1, played+2, sizeof(played) - 1);
|
|
|
|
|
played[31] = what;
|
2013-06-28 17:41:02 +02:00
|
|
|
|
}
|
2013-06-25 13:05:04 +02:00
|
|
|
|
|
2013-06-28 17:41:02 +02:00
|
|
|
|
bool Scrolls::they_match(tunetype &played) {
|
|
|
|
|
byte fv, mistakes;
|
2013-06-24 10:15:42 +02:00
|
|
|
|
|
2013-06-28 17:41:02 +02:00
|
|
|
|
mistakes = 0;
|
2013-06-24 10:15:42 +02:00
|
|
|
|
|
2013-09-04 13:34:58 +02:00
|
|
|
|
for (fv = 1; fv <= sizeof(played); fv++)
|
2013-07-24 18:25:07 +02:00
|
|
|
|
if (played[fv] != _vm->_gyro->tune[fv]) {
|
2013-07-02 01:10:45 +02:00
|
|
|
|
mistakes += 1;
|
|
|
|
|
}
|
2013-06-28 17:41:02 +02:00
|
|
|
|
|
2013-07-02 01:10:45 +02:00
|
|
|
|
return mistakes < 5;
|
2013-06-28 17:41:02 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Scrolls::music_scroll() {
|
2013-08-27 19:41:54 +02:00
|
|
|
|
state(3);
|
|
|
|
|
_vm->_gyro->seescroll = true;
|
|
|
|
|
_vm->_gyro->on();
|
|
|
|
|
_vm->_gyro->newpointer(4);
|
|
|
|
|
|
|
|
|
|
// Since there are no sounds in the game yet, it's pretty pointless to implement this function further.
|
|
|
|
|
// For now we act like the player just played the right tone.
|
|
|
|
|
//if (they_match(played)) {
|
|
|
|
|
_vm->_gyro->screturn = true;
|
|
|
|
|
_vm->_gyro->off();
|
|
|
|
|
state(0);
|
|
|
|
|
_vm->_gyro->seescroll = false;
|
|
|
|
|
|
|
|
|
|
_vm->_timeout->set_up_timer(8, _vm->_timeout->procjacques_wakes_up, _vm->_timeout->reason_jacques_waking_up);
|
|
|
|
|
return;
|
|
|
|
|
//}
|
2013-07-02 01:10:45 +02:00
|
|
|
|
warning("STUB: Scrolls::music_scroll()");
|
2013-08-27 19:41:54 +02:00
|
|
|
|
|
|
|
|
|
_vm->_gyro->screturn = false;
|
|
|
|
|
_vm->_gyro->off();
|
|
|
|
|
state(0);
|
|
|
|
|
_vm->_gyro->seescroll = false;
|
2013-07-02 01:10:45 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ThatsAll, so put us back to */ /*$F-*/
|
|
|
|
|
|
|
|
|
|
void Scrolls::resetscrolldriver() { /* phew */
|
2013-07-24 18:25:07 +02:00
|
|
|
|
_vm->_gyro->scrollbells = 0;
|
2013-07-02 01:10:45 +02:00
|
|
|
|
cfont = roman;
|
|
|
|
|
use_icon = 0;
|
2013-07-24 18:25:07 +02:00
|
|
|
|
_vm->_gyro->interrogation = 0; /* always reset after a scroll comes up. */
|
2013-07-02 01:10:45 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Scrolls::dingdongbell() { /* Pussy's in the well. Who put her in? Little... */
|
|
|
|
|
byte fv;
|
|
|
|
|
|
2013-08-09 15:42:10 +02:00
|
|
|
|
for (fv = 0; fv < _vm->_gyro->scrollbells; fv++)
|
|
|
|
|
_vm->_lucerna->errorled(); /* ring the bell "x" times */
|
2013-07-02 01:10:45 +02:00
|
|
|
|
}
|
|
|
|
|
|
2013-08-16 17:29:22 +02:00
|
|
|
|
void Scrolls::dodgem() {
|
|
|
|
|
dodgeCoord = _vm->getMousePos();
|
|
|
|
|
g_system->warpMouse(dodgeCoord.x, _vm->_gyro->underscroll); // Move the pointer off the scroll.
|
2013-07-02 01:10:45 +02:00
|
|
|
|
}
|
|
|
|
|
|
2013-08-16 17:29:22 +02:00
|
|
|
|
void Scrolls::undodgem() {
|
|
|
|
|
Common::Point actCoord = _vm->getMousePos();
|
|
|
|
|
if ((actCoord.x == dodgeCoord.x) && (actCoord.y == _vm->_gyro->underscroll))
|
|
|
|
|
g_system->warpMouse(dodgeCoord.x, dodgeCoord.y); // No change, so restore the pointer's original position.
|
2013-07-02 01:10:45 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Scrolls::geticon(int16 x, int16 y, byte which) {
|
2013-07-05 23:13:33 +02:00
|
|
|
|
Common::File f;
|
|
|
|
|
byte *p;
|
|
|
|
|
|
|
|
|
|
if (!f.open("icons.avd")) {
|
|
|
|
|
warning("AVALANCHE: Scrolls: File not found: icons.avd");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
which--;
|
|
|
|
|
f.seek(which * 426);
|
|
|
|
|
|
|
|
|
|
p = new byte[426];
|
2013-07-09 18:54:53 +02:00
|
|
|
|
f.read(p, 426);
|
2013-07-05 23:13:33 +02:00
|
|
|
|
|
|
|
|
|
//putimage(x, y, p, 0);
|
2013-07-02 01:10:45 +02:00
|
|
|
|
warning("STUB: Scrolls::geticon()");
|
2013-07-05 23:13:33 +02:00
|
|
|
|
|
|
|
|
|
delete[] p;
|
|
|
|
|
f.close();
|
2013-07-02 01:10:45 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Scrolls::block_drop(Common::String fn, int16 xl, int16 yl, int16 y) {
|
2013-07-05 23:13:33 +02:00
|
|
|
|
Common::File f;
|
|
|
|
|
uint16 st;
|
|
|
|
|
|
2013-07-24 18:25:07 +02:00
|
|
|
|
st = (y - 1) * 80 + (40 - xl / 2) + ((1 - _vm->_gyro->cp) * _vm->_gyro->pagetop);
|
2013-07-05 23:13:33 +02:00
|
|
|
|
|
|
|
|
|
Common::String filename;
|
|
|
|
|
filename = filename.format("%s.avd", fn.c_str());
|
|
|
|
|
if (!f.open(filename)) {
|
|
|
|
|
warning("AVALANCHE: Scrolls: File not found: %s", filename.c_str());
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2013-09-04 11:43:02 +02:00
|
|
|
|
/*byte bit;
|
2013-09-04 13:34:58 +02:00
|
|
|
|
for (uint16 fv = 1; fv <= yl; fv++)
|
|
|
|
|
for (bit = 0; bit <= 3; bit++) {
|
2013-09-04 11:43:02 +02:00
|
|
|
|
port[0x3c4] = 2;
|
|
|
|
|
port[0x3ce] = 4;
|
|
|
|
|
port[0x3c5] = 1 << bit;
|
|
|
|
|
port[0x3cf] = bit;
|
|
|
|
|
blockread(f, mem[0xa000 * st + (fv * 80)], xl);
|
|
|
|
|
}
|
2013-07-05 23:13:33 +02:00
|
|
|
|
bit = getpixel(0, 0);*/
|
2013-08-07 10:30:44 +02:00
|
|
|
|
|
2013-07-02 01:10:45 +02:00
|
|
|
|
warning("STUB: Scrolls::block_drop()");
|
2013-07-05 23:13:33 +02:00
|
|
|
|
|
|
|
|
|
f.close();
|
2013-07-02 01:10:45 +02:00
|
|
|
|
}
|
|
|
|
|
|
2013-08-04 12:54:11 +02:00
|
|
|
|
void Scrolls::drawscroll(func2 gotoit) { // This is one of the oldest procs in the game.
|
|
|
|
|
byte b, groi;
|
|
|
|
|
int16 lx, ly, mx, my, ex, ey;
|
|
|
|
|
bool centre;
|
2013-08-05 15:25:44 +02:00
|
|
|
|
byte icon_indent = 0;
|
2013-08-04 12:54:11 +02:00
|
|
|
|
|
|
|
|
|
//setvisualpage(cp);
|
|
|
|
|
//setactivepage(1 - cp);
|
|
|
|
|
_vm->_gyro->oncandopageswap = false; /* On can now no longer swap pages. So we can do what we want without its interference! */
|
|
|
|
|
|
|
|
|
|
lx = 0;
|
2013-08-09 15:42:10 +02:00
|
|
|
|
ly = (_vm->_gyro->scrolln) * 6;
|
|
|
|
|
for (b = 0; b < _vm->_gyro->scrolln; b++) {
|
2013-08-04 12:54:11 +02:00
|
|
|
|
ex = _vm->_gyro->scroll[b].size() * 8;
|
|
|
|
|
if (lx < ex)
|
|
|
|
|
lx = ex;
|
|
|
|
|
}
|
|
|
|
|
mx = 320;
|
|
|
|
|
my = 100; // Getmaxx & getmaxy div 2, both.
|
|
|
|
|
lx = lx / 2;
|
|
|
|
|
ly -= 2;
|
|
|
|
|
|
|
|
|
|
if ((1 <= use_icon) && (use_icon <= 34))
|
|
|
|
|
lx += halficonwidth;
|
2013-08-06 01:17:44 +02:00
|
|
|
|
|
|
|
|
|
_vm->_graphics->_scrolls.copyFrom(_vm->_graphics->_surface);
|
|
|
|
|
|
2013-08-16 13:40:58 +02:00
|
|
|
|
CursorMan.showMouse(false);
|
2013-08-08 00:57:10 +02:00
|
|
|
|
|
|
|
|
|
// The right corners of the scroll.
|
2013-08-08 04:05:27 +02:00
|
|
|
|
_vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, mx + lx, my - ly, 0, 90, 15, lightgray);
|
|
|
|
|
_vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, mx + lx, my + ly, 270, 360, 15, lightgray);
|
2013-08-08 00:57:10 +02:00
|
|
|
|
_vm->_graphics->drawArc(_vm->_graphics->_scrolls, mx + lx, my - ly, 0, 90, 15, red);
|
|
|
|
|
_vm->_graphics->drawArc(_vm->_graphics->_scrolls, mx + lx, my + ly, 270, 360, 15, red);
|
2013-08-07 23:51:12 +02:00
|
|
|
|
|
2013-08-08 00:57:10 +02:00
|
|
|
|
// The body of the scroll.
|
2013-08-06 01:17:44 +02:00
|
|
|
|
_vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 30, my + ly, mx + lx, my + ly + 6), lightgray);
|
2013-08-11 00:21:15 +02:00
|
|
|
|
_vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 30, my - ly - 6, mx + lx, my - ly + 1), lightgray);
|
|
|
|
|
_vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 15, my - ly, mx + lx + 15, my + ly + 1), lightgray);
|
2013-08-06 01:17:44 +02:00
|
|
|
|
|
2013-08-08 00:57:10 +02:00
|
|
|
|
// The left corners of the scroll.
|
|
|
|
|
_vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, mx - lx - 31, my - ly, 0, 180, 15, darkgray);
|
|
|
|
|
_vm->_graphics->drawArc(_vm->_graphics->_scrolls, mx - lx - 31, my - ly, 0, 180, 15, red);
|
|
|
|
|
_vm->_graphics->_scrolls.drawLine(mx - lx - 31 - 15, my - ly, mx - lx - 31 + 15, my - ly, red);
|
|
|
|
|
_vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, mx - lx - 31, my + ly, 180, 360, 15, darkgray);
|
|
|
|
|
_vm->_graphics->drawArc(_vm->_graphics->_scrolls, mx - lx - 31, my + ly, 180, 360, 15, red);
|
|
|
|
|
_vm->_graphics->_scrolls.drawLine(mx - lx - 31 - 15, my + ly, mx - lx - 31 + 15, my + ly, red);
|
2013-08-06 01:17:44 +02:00
|
|
|
|
|
2013-08-08 00:57:10 +02:00
|
|
|
|
// The rear borders of the scroll.
|
2013-08-06 01:17:44 +02:00
|
|
|
|
_vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 30, my - ly - 6, mx + lx, my - ly - 5), red);
|
|
|
|
|
_vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 30, my + ly + 6, mx + lx, my + ly + 7), red);
|
|
|
|
|
_vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 15, my - ly, mx - lx - 14, my + ly), red);
|
|
|
|
|
_vm->_graphics->_scrolls.fillRect(Common::Rect(mx + lx + 15, my - ly, mx + lx + 16, my + ly), red);
|
|
|
|
|
|
2013-08-04 12:54:11 +02:00
|
|
|
|
ex = mx - lx;
|
|
|
|
|
ey = my - ly;
|
|
|
|
|
mx -= lx;
|
|
|
|
|
my -= ly + 2;
|
2013-08-08 00:57:10 +02:00
|
|
|
|
|
2013-08-04 12:54:11 +02:00
|
|
|
|
centre = false;
|
|
|
|
|
|
|
|
|
|
switch (use_icon) {
|
|
|
|
|
case 0:
|
|
|
|
|
icon_indent = 0;
|
|
|
|
|
break; /* No icon. */
|
|
|
|
|
case 34: {
|
|
|
|
|
block_drop("about", 28, 76, 15);
|
|
|
|
|
icon_indent = 0;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 35: {
|
|
|
|
|
block_drop("gameover", 52, 59, 71);
|
|
|
|
|
icon_indent = 0;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((1 <= use_icon) && (use_icon <= 33)) { // Standard icon.
|
|
|
|
|
geticon(mx, my + ly / 2, use_icon);
|
|
|
|
|
icon_indent = 53;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2013-08-09 15:42:10 +02:00
|
|
|
|
for (b = 0; b < _vm->_gyro->scrolln; b++) {
|
2013-08-07 10:30:44 +02:00
|
|
|
|
if (!_vm->_gyro->scroll[b].empty())
|
|
|
|
|
switch (_vm->_gyro->scroll[b][_vm->_gyro->scroll[b].size() - 1]) {
|
|
|
|
|
case kControlCenter: {
|
|
|
|
|
centre = true;
|
|
|
|
|
_vm->_gyro->scroll[b].deleteLastChar();
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case kControlLeftJustified: {
|
|
|
|
|
centre = false;
|
|
|
|
|
_vm->_gyro->scroll[b].deleteLastChar();
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case kControlQuestion: {
|
|
|
|
|
//settextjustify(1, 1);
|
|
|
|
|
dix = mx + lx;
|
|
|
|
|
diy = my + ly;
|
|
|
|
|
_vm->_gyro->scroll[b].setChar(' ', 0);
|
|
|
|
|
groi = *_vm->_graphics->getPixel(0, 0);
|
|
|
|
|
// inc(diy,14);
|
|
|
|
|
_vm->_gyro->shbox(dix - 65, diy - 24, dix - 5, diy - 10, "Yes.");
|
|
|
|
|
_vm->_gyro->shbox(dix + 5, diy - 24, dix + 65, diy - 10, "No.");
|
|
|
|
|
}
|
|
|
|
|
break;
|
2013-08-04 12:54:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (centre)
|
|
|
|
|
say(320 - _vm->_gyro->scroll[b].size() * 4 + icon_indent, my, _vm->_gyro->scroll[b]);
|
|
|
|
|
else
|
|
|
|
|
say(mx + icon_indent, my, _vm->_gyro->scroll[b]);
|
|
|
|
|
|
|
|
|
|
my += 12;
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-17 16:54:23 +02:00
|
|
|
|
_vm->_gyro->underscroll = my * 2 + 6; // Multiplying because of the doubled screen height.
|
2013-08-04 12:54:11 +02:00
|
|
|
|
//setvisualpage(1 - cp);
|
|
|
|
|
dingdongbell();
|
|
|
|
|
//my = getpixel(0, 0);
|
|
|
|
|
_vm->_gyro->dropsok = false;
|
|
|
|
|
dodgem();
|
|
|
|
|
|
|
|
|
|
(this->*gotoit)();
|
|
|
|
|
|
|
|
|
|
undodgem();
|
|
|
|
|
_vm->_gyro->dropsok = true;
|
|
|
|
|
//setvisualpage(cp);
|
|
|
|
|
//mousepage(cp);
|
2013-08-16 13:40:58 +02:00
|
|
|
|
CursorMan.showMouse(false);
|
2013-08-04 12:54:11 +02:00
|
|
|
|
/* mblit(ex-46,ey-6,ex+lx*2+15,ey+ly*2+6,3,0);*/
|
|
|
|
|
//mblit((ex - 46) / 8, ey - 6, 1 + (ex + lx * 2 + 15) / 8, ey + ly * 2 + 6, cp, 1 - cp);
|
|
|
|
|
//blitfix();
|
|
|
|
|
_vm->_gyro->oncandopageswap = true; // Normality again.
|
2013-08-16 13:40:58 +02:00
|
|
|
|
CursorMan.showMouse(true);
|
2013-08-04 12:54:11 +02:00
|
|
|
|
//settextjustify(0, 0); /*sink*/
|
|
|
|
|
resetscrolldriver();
|
|
|
|
|
if (_vm->_gyro->mpress > 0)
|
|
|
|
|
_vm->_gyro->after_the_scroll = true;
|
|
|
|
|
|
2013-07-02 01:10:45 +02:00
|
|
|
|
warning("STUB: Scrolls::drawscroll()");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Scrolls::bubble(func2 gotoit) {
|
2013-08-11 00:21:15 +02:00
|
|
|
|
int16 xl, yl, my, xw, yw;
|
|
|
|
|
Common::Point p[3];
|
2013-09-04 11:43:02 +02:00
|
|
|
|
// byte *rp1, *rp2; /* replace: 1=bubble, 2=pointer */
|
2013-08-11 00:21:15 +02:00
|
|
|
|
int16 xc; /* x correction */
|
|
|
|
|
|
|
|
|
|
/*setvisualpage(cp);
|
|
|
|
|
setactivepage(1 - cp);*/
|
|
|
|
|
_vm->_gyro->oncandopageswap = false; /* On can now no longer swap pages. So we can do what we want without its interference! */
|
|
|
|
|
//mousepage(1 - cp); /* Mousepage */
|
|
|
|
|
|
2013-08-16 13:40:58 +02:00
|
|
|
|
CursorMan.showMouse(false);
|
2013-08-11 00:21:15 +02:00
|
|
|
|
|
|
|
|
|
xl = 0;
|
|
|
|
|
yl = _vm->_gyro->scrolln * 5;
|
2013-09-04 17:54:08 +02:00
|
|
|
|
for (byte fv = 0; fv < _vm->_gyro->scrolln; fv++) {
|
2013-08-11 00:21:15 +02:00
|
|
|
|
uint16 textWidth = _vm->_gyro->scroll[fv].size() * 8;
|
|
|
|
|
if (textWidth > xl)
|
|
|
|
|
xl = textWidth;
|
|
|
|
|
}
|
|
|
|
|
xl = xl / 2;
|
|
|
|
|
|
|
|
|
|
xw = xl + 18;
|
|
|
|
|
yw = yl + 7;
|
|
|
|
|
my = yw * 2 - 2;
|
|
|
|
|
xc = 0;
|
|
|
|
|
|
|
|
|
|
if ((_vm->_gyro->talkx - xw) < 0)
|
|
|
|
|
xc = -(_vm->_gyro->talkx - xw);
|
|
|
|
|
if ((_vm->_gyro->talkx + xw) > 639)
|
|
|
|
|
xc = 639 - (_vm->_gyro->talkx + xw);
|
|
|
|
|
|
|
|
|
|
p[0].x = _vm->_gyro->talkx - 10;
|
|
|
|
|
p[0].y = yw;
|
|
|
|
|
p[1].x = _vm->_gyro->talkx + 10;
|
|
|
|
|
p[1].y = yw;
|
|
|
|
|
p[2].x = _vm->_gyro->talkx;
|
|
|
|
|
p[2].y = _vm->_gyro->talky;
|
|
|
|
|
|
2013-08-11 15:06:57 +02:00
|
|
|
|
// Backup the screen before drawing the bubble.
|
2013-08-11 00:21:15 +02:00
|
|
|
|
_vm->_graphics->_scrolls.copyFrom(_vm->_graphics->_surface);
|
|
|
|
|
|
|
|
|
|
// The body of the bubble.
|
|
|
|
|
_vm->_graphics->_scrolls.fillRect(Common::Rect(xc + _vm->_gyro->talkx - xw + 9, 7, _vm->_gyro->talkx + xw - 8 + xc, my + 1), _vm->_gyro->talkb);
|
|
|
|
|
_vm->_graphics->_scrolls.fillRect(Common::Rect(xc + _vm->_gyro->talkx - xw - 1, 12, _vm->_gyro->talkx + xw + xc + 2, my - 4), _vm->_gyro->talkb);
|
|
|
|
|
|
|
|
|
|
// Top right corner of the bubble.
|
|
|
|
|
_vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_gyro->talkx + xw - 10, 11, 0, 90, 9, _vm->_gyro->talkb);
|
|
|
|
|
// Bottom right corner of the bubble.
|
|
|
|
|
_vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_gyro->talkx + xw - 10, my - 4, 270, 360, 9, _vm->_gyro->talkb);
|
|
|
|
|
// Top left corner of the bubble.
|
|
|
|
|
_vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_gyro->talkx - xw + 10, 11, 90, 180, 9, _vm->_gyro->talkb);
|
|
|
|
|
// Bottom left corner of the bubble.
|
|
|
|
|
_vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_gyro->talkx - xw + 10, my - 4, 180, 270, 9, _vm->_gyro->talkb);
|
|
|
|
|
|
|
|
|
|
// "Tail" of the speech bubble.
|
|
|
|
|
_vm->_graphics->drawTriangle(_vm->_graphics->_scrolls, p, _vm->_gyro->talkb);
|
|
|
|
|
|
2013-08-11 14:59:53 +02:00
|
|
|
|
|
2013-08-11 00:21:15 +02:00
|
|
|
|
yl -= 3;
|
2013-08-11 14:59:53 +02:00
|
|
|
|
|
2013-08-11 15:06:57 +02:00
|
|
|
|
// Draw the text of the bubble. The centering of the text was improved here compared to Pascal's settextjustify().
|
|
|
|
|
// The font is not the same that outtextxy() uses in Pascal. I don't have that, so I used Gyro::characters instead.
|
|
|
|
|
// It's almost the same, only notable differences are '?', '!', etc.
|
2013-09-04 17:54:08 +02:00
|
|
|
|
for (byte fv = 0; fv < _vm->_gyro->scrolln; fv++) {
|
2013-08-12 14:27:36 +02:00
|
|
|
|
int16 x = xc + _vm->_gyro->talkx - _vm->_gyro->scroll[fv].size() / 2 * 8;
|
2013-08-11 14:59:53 +02:00
|
|
|
|
bool offset = _vm->_gyro->scroll[fv].size() % 2;
|
2013-08-12 14:17:42 +02:00
|
|
|
|
_vm->_graphics->drawText(_vm->_graphics->_scrolls, _vm->_gyro->scroll[fv], _vm->_gyro->characters, 8, x - offset * 4, (fv * 10) + 12, _vm->_gyro->talkf);
|
2013-08-11 14:59:53 +02:00
|
|
|
|
}
|
2013-08-11 00:21:15 +02:00
|
|
|
|
|
|
|
|
|
//setvisualpage(1 - cp);
|
|
|
|
|
dingdongbell();
|
|
|
|
|
_vm->_gyro->oncandopageswap = false;
|
2013-08-16 13:40:58 +02:00
|
|
|
|
CursorMan.showMouse(true);
|
2013-08-11 00:21:15 +02:00
|
|
|
|
_vm->_gyro->dropsok = false;
|
|
|
|
|
|
2013-08-11 15:06:57 +02:00
|
|
|
|
// This does the actual drawing to the screen.
|
2013-08-11 00:21:15 +02:00
|
|
|
|
(this->*gotoit)();
|
|
|
|
|
|
2013-08-16 13:40:58 +02:00
|
|
|
|
CursorMan.showMouse(false);
|
2013-08-11 00:21:15 +02:00
|
|
|
|
_vm->_gyro->dropsok = true;
|
|
|
|
|
|
2013-08-16 19:24:40 +02:00
|
|
|
|
//setvisualpage(cp);
|
2013-08-16 13:40:58 +02:00
|
|
|
|
CursorMan.showMouse(true); /*sink;*/
|
2013-08-11 00:21:15 +02:00
|
|
|
|
_vm->_gyro->oncandopageswap = true;
|
|
|
|
|
resetscrolldriver();
|
|
|
|
|
if (_vm->_gyro->mpress > 0)
|
|
|
|
|
_vm->_gyro->after_the_scroll = true;
|
2013-07-02 01:10:45 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool Scrolls::ask(Common::String question) {
|
|
|
|
|
warning("STUB: Scrolls::ask()");
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Scrolls::resetscroll() {
|
2013-08-09 15:42:10 +02:00
|
|
|
|
_vm->_gyro->scrolln = 1;
|
2013-09-04 13:34:58 +02:00
|
|
|
|
for (int j = 0; j < 15; j++)
|
2013-08-02 14:15:36 +02:00
|
|
|
|
if (!_vm->_gyro->scroll[j].empty())
|
|
|
|
|
_vm->_gyro->scroll[j].clear();
|
2013-07-02 01:10:45 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Scrolls::natural() { /* Natural state of bubbles */
|
2013-07-24 18:25:07 +02:00
|
|
|
|
_vm->_gyro->talkx = 320;
|
|
|
|
|
_vm->_gyro->talky = 200;
|
|
|
|
|
_vm->_gyro->talkb = 8;
|
|
|
|
|
_vm->_gyro->talkf = 15;
|
2013-07-02 01:10:45 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Common::String Scrolls::lsd() {
|
|
|
|
|
Common::String x;
|
|
|
|
|
|
2013-08-17 15:07:02 +02:00
|
|
|
|
if (_vm->_gyro->dna.pence < 12) { // just pence
|
2013-07-24 18:25:07 +02:00
|
|
|
|
x = _vm->_gyro->strf(_vm->_gyro->dna.pence) + 'd';
|
2013-08-17 15:07:02 +02:00
|
|
|
|
} 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('<EFBFBD>') + _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;
|
2013-07-02 01:10:45 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-08-04 12:54:11 +02:00
|
|
|
|
void Scrolls::strip(Common::String &q) {
|
2013-08-02 13:17:50 +02:00
|
|
|
|
while (q[q.size() - 1] == ' ') {
|
|
|
|
|
q.deleteLastChar();
|
|
|
|
|
}
|
2013-07-02 01:10:45 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Scrolls::solidify(byte n) {
|
2013-08-02 13:17:50 +02:00
|
|
|
|
if (!_vm->_gyro->scroll[n].contains(' '))
|
|
|
|
|
return; // No spaces.
|
|
|
|
|
|
|
|
|
|
// So there MUST be a space there, somewhere...
|
|
|
|
|
do {
|
|
|
|
|
_vm->_gyro->scroll[n + 1] = _vm->_gyro->scroll[n][_vm->_gyro->scroll[n].size() - 1] + _vm->_gyro->scroll[n + 1];
|
|
|
|
|
_vm->_gyro->scroll[n].deleteLastChar();
|
2013-08-04 12:54:11 +02:00
|
|
|
|
} while (_vm->_gyro->scroll[n][_vm->_gyro->scroll[n].size() - 1] != ' ');
|
2013-08-02 13:17:50 +02:00
|
|
|
|
|
|
|
|
|
strip(_vm->_gyro->scroll[n]);
|
2013-07-02 01:10:45 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Scrolls::calldrivers() {
|
2013-08-02 13:17:50 +02:00
|
|
|
|
uint16 fv;
|
|
|
|
|
byte nn;
|
|
|
|
|
char nnn;
|
|
|
|
|
bool mouthnext;
|
|
|
|
|
bool call_spriterun; // Only call sprite_run the FIRST time.
|
2013-09-04 11:43:02 +02:00
|
|
|
|
// bool was_virtual; // Was the mouse cursor virtual on entry to this proc?
|
2013-08-02 13:17:50 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//nosound();
|
2013-07-02 01:10:45 +02:00
|
|
|
|
warning("STUB: Scrolls::calldrivers()");
|
2013-08-02 13:17:50 +02:00
|
|
|
|
|
|
|
|
|
state(0);
|
|
|
|
|
_vm->_gyro->screturn = false;
|
|
|
|
|
mouthnext = false;
|
|
|
|
|
call_spriterun = true;
|
|
|
|
|
|
|
|
|
|
switch (_vm->_gyro->buffer[_vm->_gyro->bufsize - 1]) {
|
|
|
|
|
case kControlToBuffer:
|
|
|
|
|
_vm->_gyro->bufsize--;
|
|
|
|
|
break; // ^D = (D)on't include pagebreak
|
|
|
|
|
case kControlSpeechBubble:
|
|
|
|
|
case kControlQuestion:
|
|
|
|
|
break; // ^B = speech (B)ubble, ^Q = (Q)uestion in dialogue box
|
|
|
|
|
default: {
|
|
|
|
|
_vm->_gyro->bufsize++;
|
|
|
|
|
_vm->_gyro->buffer[_vm->_gyro->bufsize - 1] = kControlParagraph;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-17 15:07:02 +02:00
|
|
|
|
uint16 size = _vm->_gyro->bufsize;
|
|
|
|
|
|
|
|
|
|
for (fv = 0; fv < size; fv++)
|
2013-08-02 13:17:50 +02:00
|
|
|
|
if (mouthnext) {
|
|
|
|
|
if (_vm->_gyro->buffer[fv] == kControlRegister)
|
|
|
|
|
param = 0;
|
|
|
|
|
else
|
2013-08-07 10:30:44 +02:00
|
|
|
|
if (('0' <= _vm->_gyro->buffer[fv]) && (_vm->_gyro->buffer[fv] <= '9'))
|
2013-08-02 13:17:50 +02:00
|
|
|
|
param = _vm->_gyro->buffer[fv] - 48;
|
2013-08-07 10:30:44 +02:00
|
|
|
|
else if (('A' <= _vm->_gyro->buffer[fv]) && (_vm->_gyro->buffer[fv] <= 'Z'))
|
2013-08-02 13:17:50 +02:00
|
|
|
|
param = _vm->_gyro->buffer[fv] - 55;
|
|
|
|
|
|
|
|
|
|
mouthnext = false;
|
|
|
|
|
} else
|
|
|
|
|
switch (_vm->_gyro->buffer[fv]) {
|
|
|
|
|
case kControlParagraph: {
|
2013-08-09 15:42:10 +02:00
|
|
|
|
if ((_vm->_gyro->scrolln == 1) && (_vm->_gyro->scroll[0].empty()))
|
2013-08-02 13:17:50 +02:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
if (call_spriterun)
|
|
|
|
|
_vm->_lucerna->sprite_run();
|
|
|
|
|
call_spriterun = false;
|
|
|
|
|
|
|
|
|
|
drawscroll(&Avalanche::Scrolls::normscroll);
|
|
|
|
|
|
|
|
|
|
resetscroll();
|
|
|
|
|
|
|
|
|
|
if (_vm->_gyro->screturn)
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case kControlBell:
|
|
|
|
|
_vm->_gyro->scrollbells++;
|
|
|
|
|
break; // #7 = "Bel"
|
|
|
|
|
case kControlSpeechBubble: {
|
2013-08-09 15:42:10 +02:00
|
|
|
|
if ((_vm->_gyro->scrolln == 1) && (_vm->_gyro->scroll[0].empty()))
|
2013-08-02 13:17:50 +02:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
if (call_spriterun)
|
|
|
|
|
_vm->_lucerna->sprite_run();
|
|
|
|
|
call_spriterun = false;
|
|
|
|
|
|
|
|
|
|
if (param == 0)
|
|
|
|
|
natural();
|
|
|
|
|
else if ((1 <= param) && (param <= 9))
|
2013-08-11 00:21:15 +02:00
|
|
|
|
if ((param > _vm->_trip->numtr) || (!_vm->_trip->tr[param - 1].quick)) { // Not valid.
|
2013-08-02 13:17:50 +02:00
|
|
|
|
_vm->_lucerna->errorled();
|
|
|
|
|
natural();
|
|
|
|
|
} else
|
2013-08-12 13:53:18 +02:00
|
|
|
|
_vm->_trip->tr[param - 1].chatter(); // Normal sprite talking routine.
|
2013-08-02 13:17:50 +02:00
|
|
|
|
else if ((10 <= param) && (param <= 36)) {
|
|
|
|
|
/* Quasi-peds. (This routine performs the same
|
|
|
|
|
thing with QPs as triptype.chatter does with the
|
|
|
|
|
sprites.) */
|
2013-08-11 00:21:15 +02:00
|
|
|
|
_vm->_gyro->talkx = _vm->_gyro->peds[_vm->_gyro->quasipeds[param - 10].whichped - 1].x;
|
|
|
|
|
_vm->_gyro->talky = _vm->_gyro->peds[_vm->_gyro->quasipeds[param - 10].whichped - 1].y; // Position.
|
2013-08-02 13:17:50 +02:00
|
|
|
|
|
2013-08-11 00:21:15 +02:00
|
|
|
|
_vm->_gyro->talkf = _vm->_gyro->quasipeds[param - 10].fgc;
|
2013-09-04 10:14:12 +02:00
|
|
|
|
_vm->_gyro->talkb = _vm->_gyro->quasipeds[param - 10].bgc; // Colors.
|
2013-08-02 13:17:50 +02:00
|
|
|
|
} else {
|
|
|
|
|
_vm->_lucerna->errorled(); // Not valid.
|
|
|
|
|
natural();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bubble(&Avalanche::Scrolls::normscroll);
|
|
|
|
|
|
|
|
|
|
resetscroll();
|
|
|
|
|
|
|
|
|
|
if (_vm->_gyro->screturn)
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case kControlNegative: {
|
|
|
|
|
switch (param) {
|
|
|
|
|
case 1:
|
2013-08-17 15:07:02 +02:00
|
|
|
|
display(lsd() + kControlToBuffer); // Insert cash balance. (Recursion)
|
|
|
|
|
break;
|
2013-08-02 13:17:50 +02:00
|
|
|
|
case 2:
|
2013-09-03 15:35:09 +02:00
|
|
|
|
display(_vm->_acci->kVocabulary[_vm->_acci->kFirstPassword + _vm->_gyro->dna.pass_num]._word + kControlToBuffer);
|
2013-08-02 13:17:50 +02:00
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
display(_vm->_gyro->dna.like2drink + kControlToBuffer);
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
display(_vm->_gyro->dna.favourite_song + kControlToBuffer);
|
|
|
|
|
break;
|
|
|
|
|
case 5:
|
|
|
|
|
display(_vm->_gyro->dna.worst_place_on_earth + kControlToBuffer);
|
|
|
|
|
break;
|
|
|
|
|
case 6:
|
|
|
|
|
display(_vm->_gyro->dna.spare_evening + kControlToBuffer);
|
|
|
|
|
break;
|
|
|
|
|
case 9:
|
|
|
|
|
display(_vm->_gyro->strf(_vm->_gyro->dna.cat_x) + ',' + _vm->_gyro->strf(_vm->_gyro->dna.cat_y) + kControlToBuffer);
|
|
|
|
|
break;
|
|
|
|
|
case 10:
|
|
|
|
|
switch (_vm->_gyro->dna.box_contents) {
|
|
|
|
|
case 0: { // Sixpence.
|
|
|
|
|
_vm->_visa->dixi('q', 37); // You find the sixpence.
|
|
|
|
|
_vm->_gyro->dna.pence += 6;
|
2013-09-03 15:35:09 +02:00
|
|
|
|
_vm->_gyro->dna.box_contents = _vm->_acci->kNothing;
|
2013-08-02 13:17:50 +02:00
|
|
|
|
_vm->_lucerna->points(2);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
break;
|
2013-09-04 01:06:03 +02:00
|
|
|
|
case Acci::kNothing:
|
2013-08-02 13:17:50 +02:00
|
|
|
|
display("nothing at all. It's completely empty.");
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
display(_vm->_gyro->get_better(_vm->_gyro->dna.box_contents) + '.');
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 11: {
|
|
|
|
|
nn = 1;
|
|
|
|
|
for (nnn = 0; nnn < numobjs; nnn++)
|
|
|
|
|
if (_vm->_gyro->dna.obj[nnn]) {
|
2013-09-04 13:34:58 +02:00
|
|
|
|
nn++;
|
2013-08-02 13:17:50 +02:00
|
|
|
|
display(_vm->_gyro->get_better(nnn) + ", " + kControlToBuffer);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case kControlIcon:
|
|
|
|
|
use_icon = param;
|
|
|
|
|
break;
|
|
|
|
|
case kControlNewLine:
|
|
|
|
|
_vm->_gyro->scrolln++;
|
|
|
|
|
break;
|
|
|
|
|
case kControlQuestion: {
|
|
|
|
|
if (call_spriterun)
|
|
|
|
|
_vm->_lucerna->sprite_run();
|
|
|
|
|
call_spriterun = false;
|
|
|
|
|
|
|
|
|
|
_vm->_gyro->scrolln++;
|
2013-08-09 15:42:10 +02:00
|
|
|
|
_vm->_gyro->scroll[_vm->_gyro->scrolln - 1] = kControlQuestion;
|
2013-08-02 13:17:50 +02:00
|
|
|
|
|
|
|
|
|
drawscroll(&Avalanche::Scrolls::dialogue);
|
|
|
|
|
|
|
|
|
|
resetscroll();
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case kControlRegister:
|
|
|
|
|
mouthnext = true;
|
|
|
|
|
break;
|
|
|
|
|
case kControlInsertSpaces:
|
2013-08-07 10:30:44 +02:00
|
|
|
|
for (nn = 0; nn < 9; nn++)
|
2013-08-09 15:42:10 +02:00
|
|
|
|
_vm->_gyro->scroll[_vm->_gyro->scrolln - 1] += ' ';
|
2013-08-02 13:17:50 +02:00
|
|
|
|
break;
|
|
|
|
|
default: { // Add new char.
|
2013-08-09 15:42:10 +02:00
|
|
|
|
if (_vm->_gyro->scroll[_vm->_gyro->scrolln - 1].size() == 50) {
|
|
|
|
|
solidify(_vm->_gyro->scrolln - 1);
|
2013-08-02 13:17:50 +02:00
|
|
|
|
_vm->_gyro->scrolln++;
|
|
|
|
|
}
|
2013-08-09 15:42:10 +02:00
|
|
|
|
_vm->_gyro->scroll[_vm->_gyro->scrolln - 1] += _vm->_gyro->buffer[fv];
|
2013-08-02 13:17:50 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2013-07-02 01:10:45 +02:00
|
|
|
|
}
|
|
|
|
|
|
2013-08-02 14:15:36 +02:00
|
|
|
|
void Scrolls::display(Common::String z) { // TODO: REPLACE BUFFER WITH A STRING!!!!!!!!!!
|
2013-07-24 18:25:07 +02:00
|
|
|
|
_vm->_gyro->bufsize = z.size();
|
2013-08-02 13:17:50 +02:00
|
|
|
|
memcpy(_vm->_gyro->buffer, z.c_str(), _vm->_gyro->bufsize);
|
2013-07-02 01:10:45 +02:00
|
|
|
|
calldrivers();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Scrolls::loadfont() {
|
2013-07-10 13:26:49 +02:00
|
|
|
|
Common::File f;
|
|
|
|
|
|
|
|
|
|
if (!f.open("avalot.fnt")) {
|
|
|
|
|
warning("AVALANCHE: Scrolls: File not found: avalot.fnt");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
for (int16 i = 0; i < 256; i++)
|
2013-08-12 12:52:17 +02:00
|
|
|
|
f.read(ch[0][i], 16);
|
2013-07-10 13:26:49 +02:00
|
|
|
|
f.close();
|
|
|
|
|
|
|
|
|
|
if (!f.open("avitalic.fnt")) {
|
|
|
|
|
warning("AVALANCHE: Scrolls: File not found: avitalic.fnt");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
for (int16 i = 0; i < 256; i++)
|
2013-08-12 12:52:17 +02:00
|
|
|
|
f.read(ch[1][i], 16);
|
2013-07-10 13:26:49 +02:00
|
|
|
|
f.close();
|
|
|
|
|
|
|
|
|
|
if (!f.open("ttsmall.fnt")) {
|
|
|
|
|
warning("AVALANCHE: Scrolls: File not found: ttsmall.fnt");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
for (int16 i = 0; i < 256; i++)
|
2013-07-27 15:19:16 +02:00
|
|
|
|
f.read(_vm->_gyro->characters[i],16);
|
2013-07-10 13:26:49 +02:00
|
|
|
|
f.close();
|
2013-07-02 01:10:45 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Scrolls::okay() {
|
|
|
|
|
display("Okay!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Scrolls::musical_scroll() {
|
2013-08-27 19:41:54 +02:00
|
|
|
|
display(Common::String("To play the harp...") + kControlNewLine + kControlNewLine + "Use these keys:" + + kControlNewLine
|
|
|
|
|
+ kControlInsertSpaces + "Q W E R T Y U I O P [ ]" + kControlNewLine + kControlNewLine + "Or press Enter to stop playing."
|
|
|
|
|
+ kControlToBuffer);
|
2013-06-28 17:41:02 +02:00
|
|
|
|
|
2013-07-24 19:43:10 +02:00
|
|
|
|
_vm->_lucerna->sprite_run();
|
2013-06-28 17:41:02 +02:00
|
|
|
|
|
2013-07-02 01:10:45 +02:00
|
|
|
|
drawscroll(&Avalanche::Scrolls::music_scroll);
|
2013-06-25 13:05:04 +02:00
|
|
|
|
|
2013-07-02 01:10:45 +02:00
|
|
|
|
resetscroll();
|
2013-06-28 17:41:02 +02:00
|
|
|
|
}
|
2013-06-25 13:05:04 +02:00
|
|
|
|
|
2013-06-24 10:15:42 +02:00
|
|
|
|
} // End of namespace Avalanche
|