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 13:05:04 +02:00
|
|
|
|
#include "avalanche/logger2.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-07-02 01:10:45 +02:00
|
|
|
|
#include "avalanche/basher2.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-12 10:43:13 +02:00
|
|
|
|
byte page_;
|
|
|
|
|
|
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! */
|
|
|
|
|
|
|
|
|
|
byte color;
|
|
|
|
|
switch (x) {
|
|
|
|
|
case 0:
|
|
|
|
|
color = black;
|
|
|
|
|
break; /* Off */
|
|
|
|
|
case 1:
|
|
|
|
|
case 2:
|
|
|
|
|
case 3:
|
|
|
|
|
color = green;
|
|
|
|
|
break; /* Hit a key */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//switch (x) {
|
|
|
|
|
//case 0:
|
|
|
|
|
// setfillstyle(1, black);
|
|
|
|
|
// break; /* Off */
|
|
|
|
|
//case 1:
|
|
|
|
|
// setfillstyle(9, green);
|
|
|
|
|
// break; /* Half-on (menus) */
|
|
|
|
|
//case 2:
|
|
|
|
|
// setfillstyle(1, green);
|
|
|
|
|
// break; /* On (kbd) */
|
|
|
|
|
//case 3:
|
|
|
|
|
// setfillstyle(6, 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-07-24 18:25:07 +02:00
|
|
|
|
_vm->_gyro->super_off();
|
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-07-24 18:25:07 +02:00
|
|
|
|
_vm->_gyro->super_on();
|
|
|
|
|
_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-07-02 01:10:45 +02:00
|
|
|
|
warning("STUB: Scrolls::say()");
|
2013-06-28 17:41:02 +02:00
|
|
|
|
}
|
2013-06-25 13:05:04 +02:00
|
|
|
|
|
2013-07-02 01:10:45 +02:00
|
|
|
|
/* Here are the func2edures 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() {
|
|
|
|
|
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-07-02 01:10:45 +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-07-02 01:10:45 +02:00
|
|
|
|
warning("STUB: Scrolls::music_scroll()");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 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;
|
2013-07-24 18:47:33 +02:00
|
|
|
|
_vm->_logger->log_epsonroman();
|
2013-07-02 01:10:45 +02:00
|
|
|
|
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-07-24 19:43:10 +02:00
|
|
|
|
for (fv = 1; fv <= _vm->_gyro->scrollbells; fv ++) _vm->_lucerna->errorled(); /* ring the bell "x" times */
|
2013-07-02 01:10:45 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Scrolls::dodgem() { /* This moves the mouse pointer off the scroll so that you can read it. */
|
2013-07-24 18:25:07 +02:00
|
|
|
|
_vm->_gyro->xycheck(); /* Mx & my now contain xy pos of mouse */
|
|
|
|
|
dodgex = _vm->_gyro->mx;
|
|
|
|
|
dodgey = _vm->_gyro->my; /* Store 'em */
|
|
|
|
|
_vm->_gyro->hopto(dodgex, _vm->_gyro->underscroll); /* Move the pointer off the scroll. */
|
2013-07-02 01:10:45 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Scrolls::undodgem() { /* This is the opposite of Dodgem. It moves the
|
|
|
|
|
mouse pointer back, IF you haven't moved it in the meantime. */
|
2013-07-24 18:25:07 +02:00
|
|
|
|
_vm->_gyro->xycheck();
|
|
|
|
|
if ((_vm->_gyro->mx == dodgex) && (_vm->_gyro->my == _vm->_gyro->underscroll))
|
2013-07-02 01:10:45 +02:00
|
|
|
|
/* No change, so restore the pointer's original position. */
|
2013-07-24 18:25:07 +02:00
|
|
|
|
_vm->_gyro->hopto(dodgex, dodgey);
|
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;
|
|
|
|
|
byte bit;
|
|
|
|
|
int16 fv;
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*for (fv = 1; fv <= yl; fv ++)
|
|
|
|
|
for (bit = 0; bit <= 3; bit ++) {
|
|
|
|
|
port[0x3c4] = 2;
|
|
|
|
|
port[0x3ce] = 4;
|
|
|
|
|
port[0x3c5] = 1 << bit;
|
|
|
|
|
port[0x3cf] = bit;
|
|
|
|
|
blockread(f, mem[0xa000 * st + (fv * 80)], xl);
|
|
|
|
|
}
|
|
|
|
|
bit = getpixel(0, 0);*/
|
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
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Scrolls::drawscroll(func2 gotoit) { /* This is one of the oldest func2s in the game. */
|
|
|
|
|
warning("STUB: Scrolls::drawscroll()");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Scrolls::bubble(func2 gotoit) {
|
|
|
|
|
warning("STUB: Scrolls::bubble()");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool Scrolls::ask(Common::String question) {
|
|
|
|
|
warning("STUB: Scrolls::ask()");
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Scrolls::resetscroll() {
|
2013-07-24 18:25:07 +02:00
|
|
|
|
_vm->_gyro->scrolln = 1;
|
2013-07-02 01:10:45 +02:00
|
|
|
|
for (int j = 0; j < 15; j ++)
|
2013-07-24 18:25:07 +02:00
|
|
|
|
for (int i = 0; i < _vm->_gyro->scroll[j].size(); i++)
|
|
|
|
|
_vm->_gyro->scroll[j].setChar(0, i);
|
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;
|
|
|
|
|
|
|
|
|
|
Common::String lsd_result;
|
2013-07-24 18:25:07 +02:00
|
|
|
|
if (_vm->_gyro->dna.pence < 12) {
|
2013-07-02 01:10:45 +02:00
|
|
|
|
/* just pence */
|
2013-07-24 18:25:07 +02:00
|
|
|
|
x = _vm->_gyro->strf(_vm->_gyro->dna.pence) + 'd';
|
|
|
|
|
} else if (_vm->_gyro->dna.pence < 240) {
|
2013-07-02 01:10:45 +02:00
|
|
|
|
/* shillings & pence */
|
2013-07-24 18:25:07 +02:00
|
|
|
|
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));
|
2013-07-02 01:10:45 +02:00
|
|
|
|
} else /* L, s & d */
|
2013-07-24 18:25:07 +02:00
|
|
|
|
x = Common::String('<EFBFBD>') + _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)";
|
2013-07-02 01:10:45 +02:00
|
|
|
|
lsd_result = x;
|
|
|
|
|
return lsd_result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Scrolls::strip(Common::String &q) {
|
|
|
|
|
warning("STUB: Scrolls::strip()");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Scrolls::solidify(byte n) {
|
|
|
|
|
warning("STUB: Scrolls::solidify()");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Scrolls::calldrivers() {
|
|
|
|
|
warning("STUB: Scrolls::calldrivers()");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Scrolls::display(Common::String z) {
|
2013-07-24 18:25:07 +02:00
|
|
|
|
_vm->_gyro->bufsize = z.size();
|
|
|
|
|
memcpy(_vm->_gyro->buffer, z.c_str() + 1, _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++)
|
|
|
|
|
f.read(ch[0][i],16);
|
|
|
|
|
f.close();
|
|
|
|
|
|
|
|
|
|
if (!f.open("avitalic.fnt")) {
|
|
|
|
|
warning("AVALANCHE: Scrolls: File not found: avitalic.fnt");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
for (int16 i = 0; i < 256; i++)
|
|
|
|
|
f.read(ch[1][i],16);
|
|
|
|
|
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() {
|
|
|
|
|
bool was_virtual;
|
2013-06-28 17:41:02 +02:00
|
|
|
|
|
2013-07-02 01:10:45 +02:00
|
|
|
|
display(Common::String("To play the harp...\r\rUse these keys:\r\n") +
|
|
|
|
|
"Q W E R T Y U I O P [ ]\r\rOr press Enter to stop playing.\4");
|
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-24 18:25:07 +02:00
|
|
|
|
was_virtual = _vm->_gyro->visible == _vm->_gyro->m_virtual;
|
2013-06-28 17:41:02 +02:00
|
|
|
|
|
2013-07-02 01:10:45 +02:00
|
|
|
|
if (was_virtual)
|
2013-07-24 18:25:07 +02:00
|
|
|
|
_vm->_gyro->off_virtual();
|
2013-06-25 13:05:04 +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
|
|
|
|
if (was_virtual)
|
2013-07-24 18:25:07 +02:00
|
|
|
|
_vm->_gyro->on_virtual();
|
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
|