scummvm/engines/avalanche/acci2.cpp

2067 lines
67 KiB
C++
Raw Normal View History

/* ScummVM - Graphic Adventure Engine
2013-06-29 15:56:08 +02:00
*
* 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.
*/
/* ACCIDENCE II The parser. */
#include "avalanche/avalanche.h"
2013-06-29 16:36:40 +02:00
#include "avalanche/acci2.h"
2013-06-29 15:56:08 +02:00
#include "avalanche/gyro2.h"
#include "avalanche/lucerna2.h"
#include "avalanche/scrolls2.h"
#include "avalanche/visa2.h"
2013-09-08 11:30:23 +02:00
#include "avalanche/timer.h"
#include "avalanche/animation.h"
2013-06-29 15:56:08 +02:00
#include "avalanche/enid2.h"
#include "avalanche/celer2.h"
#include "avalanche/pingo2.h"
#include "avalanche/sequence2.h"
2013-06-29 16:36:40 +02:00
#include "common/textconsole.h"
#include <cstring>
#include <cmath>
2013-06-29 15:56:08 +02:00
namespace Avalanche {
const Acci::VocabEntry Acci::kVocabulary[kParserWordsNum] = {
// Verbs: 1-49
{1, "EXAMINE"}, {1, "READ"}, {1, "XAM"}, // short
{2, "OPEN"}, {2, "LEAVE"}, {2, "UNLOCK"},
{3, "PAUSE"}, {47, "TA"}, // Early to avoid Take and Talk.
{4, "TAKE"}, {4, "GET"}, {4, "PICK"},
{5, "DROP"}, {6, "INVENTORY"}, {7, "TALK"},
{7, "SAY"}, {7, "ASK"},
{8, "GIVE"}, {9, "DRINK"}, {9, "IMBIBE"},
{9, "DRAIN"}, {10, "LOAD"}, {10, "RESTORE"},
{11, "SAVE"}, {12, "BRIBE"}, {12, "PAY"},
{13, "LOOK"}, {14, "BREAK"}, {15, "QUIT"},
{15, "EXIT"}, {16, "SIT"}, {16, "SLEEP"},
2013-06-29 15:56:08 +02:00
{17, "STAND"},
{18, "GO"}, {19, "INFO"}, {20, "UNDRESS"},
2013-06-29 15:56:08 +02:00
{20, "DOFF"},
{21, "DRESS"}, {21, "WEAR"}, {21, "DON"},
2013-06-29 15:56:08 +02:00
{22, "PLAY"},
{22, "STRUM"}, {23, "RING"}, {24, "HELP"},
{25, "KENDAL"}, {26, "CAPYBARA"}, {27, "BOSS"},
{255, "NINET"}, // block for NINETY
{28, "URINATE"}, {28, "MINGITE"}, {29, "NINETY"},
2013-06-29 15:56:08 +02:00
{30, "ABRACADABRA"}, {30, "PLUGH"}, {30, "XYZZY"},
{30, "HOCUS"}, {30, "POCUS"}, {30, "IZZY"},
{30, "WIZZY"}, {30, "PLOVER"},
2013-06-29 15:56:08 +02:00
{30, "MELENKURION"}, {30, "ZORTON"}, {30, "BLERBI"},
{30, "THURB"}, {30, "SNOEZE"}, {30, "SAMOHT"},
{30, "NOSIDE"}, {30, "PHUGGG"}, {30, "KNERL"},
{30, "MAGIC"}, {30, "KLAETU"}, {30, "VODEL"},
2013-06-29 15:56:08 +02:00
{30, "BONESCROLLS"}, {30, "RADOF"},
{31, "RESTART"},
{32, "SWALLOW"}, {32, "EAT"}, {33, "LISTEN"},
{33, "HEAR"}, {34, "BUY"}, {34, "PURCHASE"},
{34, "ORDER"}, {34, "DEMAND"},
{35, "ATTACK"}, {35, "HIT"}, {35, "KILL"},
{35, "PUNCH"}, {35, "KICK"}, {35, "SHOOT"},
2013-06-29 15:56:08 +02:00
{35, "FIRE"},
// Passwords: 36
2013-06-29 15:56:08 +02:00
{36, "TIROS"}, {36, "WORDY"}, {36, "STACK"},
{36, "SHADOW"}, {36, "OWL"}, {36, "ACORN"},
{36, "DOMESDAY"}, {36, "FLOPPY"}, {36, "DIODE"},
{36, "FIELD"}, {36, "COWSLIP"}, {36, "OSBYTE"},
{36, "OSCLI"}, {36, "TIMBER"}, {36, "ADVAL"},
{36, "NEUTRON"}, {36, "POSITRON"}, {36, "ELECTRON"},
{36, "CIRCUIT"}, {36, "AURUM"}, {36, "PETRIFY"},
{36, "EBBY"}, {36, "CATAPULT"}, {36, "GAMERS"},
{36, "FUDGE"}, {36, "CANDLE"}, {36, "BEEB"},
{36, "MICRO"}, {36, "SESAME"}, {36, "LORDSHIP"},
{37, "DIR"}, {37, "LS"}, {38, "DIE"},
{39, "SCORE"},
{40, "PUT"}, {40, "INSERT"}, {41, "KISS"},
{41, "SNOG"}, {41, "CUDDLE"}, {42, "CLIMB"},
{42, "CLAMBER"}, {43, "JUMP"}, {44, "HIGHSCORES"},
{44, "HISCORES"}, {45, "WAKEN"}, {45, "AWAKEN"},
{46, "HELLO"}, {46, "HI"}, {46, "YO"},
{47, "THANKS"}, // = 47, "ta", which was defined earlier.
2013-06-29 15:56:08 +02:00
// Nouns - Objects: 50-100
{50, "WINE"}, {50, "BOOZE"}, {50, "NASTY"},
{50, "VINEGAR"}, {51, "MONEYBAG"},
{51, "BAG"}, {51, "CASH"}, {51, "DOSH"},
2013-06-29 15:56:08 +02:00
{51, "WALLET"},
{52, "BODKIN"}, {52, "DAGGER"}, {53, "POTION"},
{54, "CHASTITY"}, {54, "BELT"}, {55, "BOLT"},
{55, "ARROW"}, {55, "DART"},
{56, "CROSSBOW"}, {56, "BOW"}, {57, "LUTE"},
{58, "PILGRIM"}, {58, "BADGE"}, {59, "MUSHROOMS"},
2013-06-29 15:56:08 +02:00
{59, "TOADSTOOLS"}, {60, "KEY"}, {61, "BELL"},
{62, "PRESCRIPT"}, {62, "SCROLL"}, {62, "MESSAGE"},
{63, "PEN"}, {63, "QUILL"}, {64, "INK"},
{64, "INKPOT"}, {65, "CLOTHES"}, {66, "HABIT"},
{66, "DISGUISE"}, {67, "ONION"},
2013-06-29 15:56:08 +02:00
{99, "PASSWORD"},
// Objects from Also are placed between 101 and 131.
2013-06-29 15:56:08 +02:00
// Nouns - People - Male: 150-174
{150, "AVVY"}, {150, "AVALOT"}, {150, "YOURSELF"},
{150, "ME"}, {150, "MYSELF"}, {151, "SPLUDWICK"},
{151, "THOMAS"}, {151, "ALCHEMIST"}, {151, "CHEMIST"},
{152, "CRAPULUS"}, {152, "SERF"}, {152, "SLAVE"},
{158, "DU"}, // <<< Put in early for Baron DU Lustie to save confusion with Duck & Duke.
{152, "CRAPPY"}, {153, "DUCK"}, {153, "DOCTOR"},
2013-06-29 15:56:08 +02:00
{154, "MALAGAUCHE"},
{155, "FRIAR"}, {155, "TUCK"}, {156, "ROBIN"},
{156, "HOOD"}, {157, "CWYTALOT"}, {157, "GUARD"},
2013-06-29 15:56:08 +02:00
{157, "BRIDGEKEEP"}, {158, "BARON"}, {158, "LUSTIE"},
{159, "DUKE"}, {159, "GRACE"}, {160, "DOGFOOD"},
{160, "MINSTREL"}, {161, "TRADER"}, {161, "SHOPKEEPER"},
2013-06-29 15:56:08 +02:00
{161, "STALLHOLDER"},
{162, "PILGRIM"}, {162, "IBYTHNETH"}, {163, "ABBOT"},
{163, "AYLES"}, {164, "PORT"}, {165, "SPURGE"},
{166, "JACQUES"}, {166, "SLEEPER"}, {166, "RINGER"},
2013-06-29 15:56:08 +02:00
// Nouns - People - Female: 175-199
2013-06-29 15:56:08 +02:00
{175, "WIFE"}, {175, "ARKATA"}, {176, "GEDALODAVA"},
{176, "GEIDA"}, {176, "PRINCESS"}, {178, "WISE"},
{178, "WITCH"},
// Pronouns: 200-224
{200, "HIM"}, {200, "MAN"}, {200, "GUY"},
2013-06-29 15:56:08 +02:00
{200, "DUDE"}, {200, "CHAP"}, {200, "FELLOW"},
{201, "HER"}, {201, "GIRL"}, {201, "WOMAN"},
{202, "IT"}, {202, "THING"},
{203, "MONK"}, {204, "BARMAN"}, {204, "BARTENDER"},
2013-06-29 15:56:08 +02:00
// Prepositions: 225-249
2013-06-29 15:56:08 +02:00
{225, "TO"}, {226, "AT"}, {227, "UP"},
{228, "INTO"}, {228, "INSIDE"}, {229, "OFF"},
{230, "UP"}, {231, "DOWN"}, {232, "ON"},
// Please: 251
2013-06-29 15:56:08 +02:00
{251, "PLEASE"},
// About: 252
2013-06-29 15:56:08 +02:00
{252, "ABOUT"}, {252, "CONCERNING"},
// Swear words: 253
/* I M P O R T A N T M E S S A G E
2013-06-29 15:56:08 +02:00
DO *NOT* READ THE LINES BELOW IF YOU ARE OF A SENSITIVE
DISPOSITION. THOMAS IS *NOT* RESPONSIBLE FOR THEM.
GOODNESS KNOWS WHO WROTE THEM.
READ THEM AT YOUR OWN RISK. BETTER STILL, DON'T READ THEM.
WHY ARE YOU SNOOPING AROUND IN MY PROGRAM, ANYWAY? */
2013-06-29 15:56:08 +02:00
{253, "SHIT"}, {28 , "PISS"}, {28 , "PEE"},
{253, "FART"}, {253, "FUCK"}, {253, "BALLS"},
{253, "BLAST"}, {253, "BUGGER"}, {253, "KNICKERS"},
{253, "BLOODY"}, {253, "HELL"}, {253, "DAMN"},
{253, "SMEG"},
// ...and other even ruder words. You didn't read them, did you? Good. */
2013-06-29 15:56:08 +02:00
// Answer-back smart-alec words: 249
2013-06-29 15:56:08 +02:00
{249, "YES"}, {249, "NO"}, {249, "BECAUSE"},
// Noise words: 255
2013-06-29 15:56:08 +02:00
{255, "THE"}, {255, "A"}, {255, "NOW"},
{255, "SOME"}, {255, "AND"}, {255, "THAT"},
{255, "POCUS"}, {255, "HIS"},
{255, "THIS"}, {255, "SENTINEL"} // for "Ken SENT Me"
};
2013-06-29 15:56:08 +02:00
Acci::Acci(AvalancheEngine *vm) {
2013-06-29 15:56:08 +02:00
_vm = vm;
}
void Acci::init() {
2013-09-06 16:23:57 +02:00
_vm->_gyro->_weirdWord = false;
2013-06-29 15:56:08 +02:00
}
void Acci::clearWords() {
for (byte i = 0; i < 11; i++) {
if (!_realWords[i].empty())
_realWords[i].clear();
}
2013-06-29 15:56:08 +02:00
}
byte Acci::wordNum(Common::String word) {
if (word.empty())
return 0;
for (int32 i = kParserWordsNum - 1; i >= 0; i--) {
if (kVocabulary[i]._word == word)
return kVocabulary[i]._number;
}
2013-08-25 17:10:29 +02:00
// If not found as a whole, we look for it as a substring.
for (int32 i = kParserWordsNum - 1; i >= 0; i--) {
if (Common::String(kVocabulary[i]._word.c_str(), word.size()) == word)
return kVocabulary[i]._number;
}
return kPardon;
2013-06-29 15:56:08 +02:00
}
void Acci::replace(Common::String oldChars, byte newChar) {
int16 pos = _vm->_parser->pos(oldChars, _thats);
while (pos != -1) {
if (newChar == 0)
_thats.deleteChar(pos);
else {
for (byte i = pos; i < pos + oldChars.size(); i++)
_thats.deleteChar(pos);
_thats.insertChar(newChar, pos);
}
pos = _vm->_parser->pos(oldChars, _thats);
}
2013-06-29 15:56:08 +02:00
}
Common::String Acci::rank() {
2013-09-07 00:41:39 +02:00
static const RankType kRanks[9] = {
{0, "Beginner"}, {10, "Novice"},
{20, "Improving"}, {35, "Not bad"},
{50, "Passable"}, {65, "Good"},
{80, "Experienced"}, {108, "The BEST!"},
{32767, "copyright'93"}
};
for (byte i = 0; i < 8; i++) {
2013-09-06 16:23:57 +02:00
if ((_vm->_gyro->_dna._score >= kRanks[i]._score) && (_vm->_gyro->_dna._score < kRanks[i + 1]._score)) {
return kRanks[i]._title;
2013-06-29 15:56:08 +02:00
}
}
return "";
2013-06-29 15:56:08 +02:00
}
Common::String Acci::totalTime() {
// There are 65535 clock ticks in a second, 1092.25 in a minute, and 65535 in an hour.
const double ticksInOneSec = (double)(65535) / 3600;
2013-06-29 15:56:08 +02:00
uint16 h, m, s;
2013-09-06 16:23:57 +02:00
h = _vm->_gyro->_dna._totalTime / ticksInOneSec; // No. of seconds.
2013-09-05 01:27:51 +02:00
h = floor((float)h);
m = h % 3600;
h = h / 3600;
s = m % 60;
m = m / 60;
Common::String result = "You've been playing for ";
if (h > 0)
2013-09-08 23:13:58 +02:00
result += _vm->_gyro->intToStr(h) + " hours, ";
if ((m > 0) || (h != 0))
2013-09-08 23:13:58 +02:00
result += _vm->_gyro->intToStr(m) + " minutes and ";
2013-09-06 16:23:57 +02:00
return result + _vm->_gyro->intToStr(s) + " seconds.";
2013-06-29 15:56:08 +02:00
}
void Acci::cheatParse(Common::String codes) {
2013-09-04 12:32:10 +02:00
// uint16 num;
// int16 e;
// char cmd;
// int16 se, sx, sy;
2013-06-29 15:56:08 +02:00
warning("STUB: Acci::cheatParse()");
2013-06-29 15:56:08 +02:00
}
void Acci::stripPunctuation(Common::String &word) {
const char punct[] = "~`!@#$%^&*()_+-={}[]:\"|;'\\,./<>?";
for (byte i = 0; i < 32; i++) {
for (;;) {
int16 pos = _vm->_parser->pos(Common::String(punct[i]), word);
if (pos == -1)
break;
word.deleteChar(pos);
}
}
2013-06-29 15:56:08 +02:00
}
void Acci::displayWhat(byte target, bool animate, bool &ambiguous) {
if (target == kPardon) {
ambiguous = true;
if (animate)
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("Whom?");
else
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("What?");
} else {
2013-09-08 23:13:58 +02:00
if (animate) {
Common::String tmpStr = Common::String::format("{ %s }", _vm->_gyro->getName(target).c_str());
_vm->_scrolls->displayText(tmpStr);
} else {
2013-09-06 16:23:57 +02:00
Common::String z = _vm->_gyro->getItem(target);
2013-09-08 23:13:58 +02:00
if (z != "") {
Common::String tmpStr = Common::String::format("{ %s }", z.c_str());
_vm->_scrolls->displayText(tmpStr);
}
}
}
2013-06-29 15:56:08 +02:00
}
bool Acci::doPronouns() {
bool ambiguous = false;
2013-06-29 15:56:08 +02:00
for (byte i = 0; i < _thats.size(); i++) {
byte wordCode = _thats[i];
switch (wordCode) {
case 200: {
2013-09-06 16:23:57 +02:00
displayWhat(_vm->_gyro->_him, true, ambiguous);
_thats.setChar(_vm->_gyro->_him, i);
}
break;
case 201: {
2013-09-06 16:23:57 +02:00
displayWhat(_vm->_gyro->_her, true, ambiguous);
_thats.setChar(_vm->_gyro->_her, i);
}
break;
case 202: {
2013-09-06 16:23:57 +02:00
displayWhat(_vm->_gyro->_it, false, ambiguous);
_thats.setChar(_vm->_gyro->_it, i);
}
break;
}
}
2013-06-29 15:56:08 +02:00
return ambiguous;
2013-06-29 15:56:08 +02:00
}
void Acci::properNouns() {
_vm->_parser->_inputText.toLowercase();
// We set every word's first character to uppercase.
for (byte i = 1; i < (_vm->_parser->_inputText.size() - 1); i++) {
if (_vm->_parser->_inputText[i] == ' ')
_vm->_parser->_inputText.setChar(toupper(_vm->_parser->_inputText[i + 1]), i + 1);
}
// And the first character as well.
_vm->_parser->_inputText.setChar(toupper(_vm->_parser->_inputText[0]), 0);
2013-06-29 15:56:08 +02:00
}
void Acci::sayIt() {
Common::String x = _vm->_parser->_inputText;
x.setChar(toupper(x[0]), 0);
2013-09-08 23:37:13 +02:00
Common::String tmpStr = Common::String::format("%c1%s.%c%c2", Scrolls::kControlRegister, x.c_str(), Scrolls::kControlSpeechBubble, Scrolls::kControlRegister);
_vm->_scrolls->displayText(tmpStr);
2013-06-29 15:56:08 +02:00
}
void Acci::storeInterrogation(byte interrogation) {
if (_vm->_parser->_inputText.empty())
return;
// Strip _vm->_parser->_inputText:
while ((_vm->_parser->_inputText[0] == ' ') && (!_vm->_parser->_inputText.empty()))
_vm->_parser->_inputText.deleteChar(0);
while ((_vm->_parser->_inputText.lastChar() == ' ') && (!_vm->_parser->_inputText.empty()))
_vm->_parser->_inputText.deleteLastChar();
2013-09-08 11:30:23 +02:00
_vm->_timer->loseTimer(_vm->_timer->kReasonCardiffsurvey); // If you want to use any other timer, put this into the case statement.
switch (interrogation) {
case 1:
_vm->_parser->_inputText.toLowercase();
sayIt();
2013-09-06 16:23:57 +02:00
_vm->_gyro->_dna._favouriteDrink = _vm->_parser->_inputText;
_vm->_gyro->_dna._cardiffQuestionNum = 2;
break;
case 2:
properNouns();
sayIt();
2013-09-06 16:23:57 +02:00
_vm->_gyro->_dna._favouriteSong = _vm->_parser->_inputText;
_vm->_gyro->_dna._cardiffQuestionNum = 3;
break;
case 3:
properNouns();
sayIt();
2013-09-06 16:23:57 +02:00
_vm->_gyro->_dna._worstPlaceOnEarth = _vm->_parser->_inputText;
_vm->_gyro->_dna._cardiffQuestionNum = 4;
break;
case 4:
_vm->_parser->_inputText.toLowercase();
sayIt();
2013-09-06 16:23:57 +02:00
if (!_vm->_gyro->_dna._spareEvening.empty())
_vm->_gyro->_dna._spareEvening.clear();
_vm->_gyro->_dna._spareEvening = _vm->_parser->_inputText;
_vm->_visa->displayScrollChain('z', 5); // His closing statement...
_vm->_animation->_sprites[1].walkTo(4); // The end of the drawbridge
_vm->_animation->_sprites[1]._vanishIfStill = true; // Then go away!
2013-09-06 16:23:57 +02:00
_vm->_gyro->_magics[1]._operation = _vm->_gyro->kMagicNothing;
_vm->_gyro->_dna._cardiffQuestionNum = 5;
break;
case 99:
//store_high(_vm->_parser->_inputText);
warning("STUB: Acci::store_interrogation()");
break;
}
2013-06-29 15:56:08 +02:00
if (interrogation < 4)
2013-09-08 11:30:23 +02:00
_vm->_timer->cardiffSurvey();
2013-06-29 15:56:08 +02:00
}
void Acci::parse() {
// First parsing - word identification
if (!_thats.empty())
_thats.clear();
byte n = 0;
_polite = false;
_verb = kPardon;
_thing = kPardon;
_thing2 = kPardon;
_person = kPardon;
clearWords();
// A cheat mode attempt.
if (_vm->_parser->_inputText[0] == '.') {
cheatParse(_vm->_parser->_inputText);
_thats = kNothing;
return;
}
// Are we being interrogated right now?
2013-09-05 23:57:58 +02:00
if (_vm->_gyro->_interrogation > 0) {
storeInterrogation(_vm->_gyro->_interrogation);
2013-09-06 16:23:57 +02:00
_vm->_gyro->_weirdWord = true;
return;
}
// Actually process the command.
Common::String inputText = _vm->_parser->_inputText + ' ';
Common::String inputTextUpper = inputText;
inputTextUpper.toUppercase();
while (!inputTextUpper.empty()) {
while ((!inputTextUpper.empty()) && (inputTextUpper[0] == ' ')) {
inputTextUpper.deleteChar(0);
inputText.deleteChar(0);
}
if (inputTextUpper.empty())
2013-07-30 21:32:14 +02:00
break;
// Get the following word of the strings.
byte size = _vm->_parser->pos(Common::String(' '), inputTextUpper) + 1;
char *subStr = new char[size];
Common::strlcpy(subStr, inputTextUpper.c_str(), size);
Common::String thisword = subStr;
Common::strlcpy(subStr, inputText.c_str(), size);
_realWords[n] = subStr;
delete[] subStr;
stripPunctuation(inputTextUpper);
bool notfound = true;
// Check also[] first, which conatins words about the actual room.
if (!thisword.empty()) {
for (byte i = 0; i < 31; i++) {
2013-09-06 16:23:57 +02:00
if ((_vm->_gyro->_also[i][0] != 0) && (_vm->_parser->pos(',' + thisword, *_vm->_gyro->_also[i][0]) > -1)) {
2013-09-08 23:37:13 +02:00
_thats += Common::String(99 + i);
notfound = false;
}
}
}
// Check Accis's own table (words[]) for "global" commands.
if (notfound) {
byte answer = wordNum(thisword);
if (answer == kPardon) {
notfound = true;
_thats = _thats + kPardon;
} else
_thats = _thats + answer;
n++;
}
// Delete words we already processed.
int16 spacePos = _vm->_parser->pos(Common::String(' '), inputTextUpper);
if (spacePos > -1) {
for (byte i = 0; i <= spacePos; i++)
inputTextUpper.deleteChar(0);
}
spacePos = _vm->_parser->pos(Common::String(' '), inputText);
if (spacePos > -1) {
for (byte i = 0; i <= spacePos; i++)
inputText.deleteChar(0);
}
}
Common::String unkString;
int16 pos = _vm->_parser->pos(Common::String('\xFE'), _thats);
if (pos > -1)
unkString = _realWords[pos];
else
unkString.clear();
// Replace words' codes that mean the same.
replace(Common::String('\xFF'), 0); // zap noise words
2013-09-04 12:32:10 +02:00
replace(Common::String('\xD') + '\xE2', 1); // "look at" = "examine"
replace(Common::String('\xD') + '\xE4', 1); // "look in" = "examine"
replace(Common::String('\x4') + '\xE6', 17); // "get up" = "stand"
2013-09-04 12:32:10 +02:00
replace(Common::String('\x4') + '\xE7', 17); // "get down" = "stand"... well, why not?
replace(Common::String('\x12') + '\xE4', 2); // "go in" = "open [door]"
replace(Common::String('\x1C') + '\xE5', 253); // "P' off" is a swear word
replace(Common::String('\x4') + '\x6' , 6); // "Take inventory" (remember Colossal Adventure?)
replace(Common::String('\x28') + '\xE8', 21); // "put on" = "don"
replace(Common::String('\x4') + '\xE5', 20); // "take off" = "doff"
// Words that could mean more than one _person
2013-09-06 16:23:57 +02:00
if (_vm->_gyro->_dna._room == r__nottspub)
2013-09-04 12:32:10 +02:00
replace(Common::String('\xCC'), 164); // Barman = Port
else
2013-09-04 12:32:10 +02:00
replace(Common::String('\xCC'), 154); // Barman = Malagauche
2013-09-06 16:23:57 +02:00
switch (_vm->_gyro->_dna._room) {
case r__aylesoffice:
2013-09-04 12:32:10 +02:00
replace(Common::String('\xCB'), 163); // Monk = Ayles
break;
case r__musicroom:
2013-09-04 12:32:10 +02:00
replace(Common::String('\xCB'), 166); // Monk = Jacques
break;
default:
2013-09-04 12:32:10 +02:00
replace(Common::String('\xCB'), 162); // Monk = Ibythneth
}
if (doPronouns()) {
2013-09-06 16:23:57 +02:00
_vm->_gyro->_weirdWord = true;
_thats = kNothing;
return;
}
// Second parsing.
2013-09-06 16:23:57 +02:00
if (!_vm->_gyro->_subject.empty())
_vm->_gyro->_subject.clear();
_vm->_gyro->_subjectNum = 0; // Find subject of conversation.
2013-09-05 01:27:51 +02:00
for (int i = 0; (i < 11) && !_realWords[i].empty(); i++) {
if ((_realWords[i][0] == '\'') || (_realWords[i][0] == '\"')) {
2013-09-06 16:23:57 +02:00
_vm->_gyro->_subjectNum = (byte)_thats[i];
_thats.setChar(kMoved, i);
break;
}
}
2013-09-06 16:23:57 +02:00
if ((_vm->_gyro->_subjectNum == 0) && !_thats.empty()) { // Still not found.
2013-09-05 01:27:51 +02:00
for (uint16 i = 0; i < _thats.size() - 1; i++) {
if ((byte)_thats[i] == 252) { // The word is "about", or something similar.
2013-09-06 16:23:57 +02:00
_vm->_gyro->_subjectNum = (byte)_thats[i + 1];
_thats.setChar(0, i + 1);
break;
}
}
}
2013-09-06 16:23:57 +02:00
if ((_vm->_gyro->_subjectNum == 0) && !_thats.empty()) { // STILL not found! Must be the word after "say".
2013-09-05 01:27:51 +02:00
for (uint16 i = 0; i < _thats.size() - 1; i++) {
if (((byte)_thats[i] == 7) && ((byte)_thats[i + 1] != 0) && !((225 <= (byte)_thats[i + 1]) && ((byte)_thats[i + 1] <= 229))) {
// SAY not followed by a preposition
2013-09-06 16:23:57 +02:00
_vm->_gyro->_subjectNum = (byte)_thats[i + 1];
_thats.setChar(0, i + 1);
break;
}
}
}
2013-09-05 01:27:51 +02:00
for (int16 i = _thats.size() - 1; i >= 0; i--) { // Reverse order, so first will be used.
if (((byte)_thats[i] == 253) || ((byte)_thats[i] == 249) || ((1 <= (byte)_thats[i]) && ((byte)_thats[i] <= 49)))
_verb = (byte)_thats[i];
else if ((50 <= (byte)_thats[i]) && ((byte)_thats[i] <= 149)) {
_thing2 = _thing;
_thing = (byte)_thats[i];
} else if ((150 <= (byte)_thats[i]) && ((byte)_thats[i] <= 199))
_person = (byte)_thats[i];
else if ((byte)_thats[i] == 251)
_polite = true;
}
if ((!unkString.empty()) && (_verb != kVerbCodeExam) && (_verb != kVerbCodeTalk) && (_verb != kVerbCodeSave) && (_verb != kVerbCodeLoad) && (_verb != kVerbCodeDir)) {
2013-09-08 23:37:13 +02:00
Common::String tmpStr = Common::String::format("Sorry, but I have no idea what \"%s\" means. Can you rephrase it?", unkString.c_str());
_vm->_scrolls->displayText(tmpStr);
_vm->_gyro->_weirdWord = true;
} else
2013-09-06 16:23:57 +02:00
_vm->_gyro->_weirdWord = false;
if (_thats.empty())
_thats = kNothing;
if (_thing != kPardon)
2013-09-06 16:23:57 +02:00
_vm->_gyro->_it = _thing;
if (_person != kPardon) {
if (_person < 175)
2013-09-06 16:23:57 +02:00
_vm->_gyro->_him = _person;
else
2013-09-06 16:23:57 +02:00
_vm->_gyro->_her = _person;
}
2013-06-29 15:56:08 +02:00
}
void Acci::examineObject() {
2013-09-06 16:23:57 +02:00
if (_thing != _vm->_gyro->_thinks)
_vm->_lucerna->thinkAbout(_thing, Gyro::kThing);
switch (_thing) {
2013-09-06 16:23:57 +02:00
case Gyro::kObjectWine :
switch (_vm->_gyro->_dna._wineState) {// 4 is perfect wine. 0 is not holding the wine.
case 1:
_vm->_visa->displayScrollChain('t', 1); // Normal examine wine scroll
break;
case 2:
_vm->_visa->displayScrollChain('d', 6); // Bad wine
break;
case 3:
_vm->_visa->displayScrollChain('d', 7); // Vinegar
break;
}
break;
2013-09-06 16:23:57 +02:00
case Gyro::kObjectOnion:
if (_vm->_gyro->_dna._rottenOnion)
_vm->_visa->displayScrollChain('q', 21); // Yucky onion.
else
_vm->_visa->displayScrollChain('t', 18); // Normal onion scroll
break;
default:
_vm->_visa->displayScrollChain('t', _thing); // <<< Ordinarily
}
2013-06-29 15:56:08 +02:00
}
bool Acci::isPersonHere() { // Person equivalent of "holding".
2013-09-06 16:23:57 +02:00
if ((_person == kPardon) || (_person == 0) || (_vm->_gyro->_whereIs[_person - 150] == _vm->_gyro->_dna._room))
return true;
else {
2013-09-08 23:37:13 +02:00
Common::String tmpStr;
if (_person < 175)
2013-09-08 23:37:13 +02:00
tmpStr = Common::String::format("H%ce isn't around at the moment.", Scrolls::kControlToBuffer);
else
2013-09-08 23:37:13 +02:00
tmpStr = Common::String::format("Sh%ce isn't around at the moment.", Scrolls::kControlToBuffer);
_vm->_scrolls->displayText(tmpStr);
return false;
}
2013-06-29 15:56:08 +02:00
}
void Acci::exampers() {
if (isPersonHere()) {
2013-09-06 16:23:57 +02:00
if (_thing != _vm->_gyro->_thinks)
_vm->_lucerna->thinkAbout(_person, Gyro::kPerson);
_person -= 149;
switch (_person) { // Special cases
case 11:
2013-09-06 16:23:57 +02:00
if (_vm->_gyro->_dna._wonNim) {
_vm->_visa->displayScrollChain('Q', 8); // "I'm Not Playing!"
return;
}
break;
case 99:
2013-09-06 16:23:57 +02:00
if (_vm->_gyro->_dna._lustieIsAsleep) {
_vm->_visa->displayScrollChain('Q', 65); // He's asleep. (65! Wow!)
return;
}
break;
}
// Otherwise...
_vm->_visa->displayScrollChain('p', _person);
}
// And afterwards...
2013-09-06 16:23:57 +02:00
if ((_person == 14) && (!_vm->_gyro->_dna._aylesIsAwake))
_vm->_visa->displayScrollChain('Q', 13);
2013-06-29 15:56:08 +02:00
}
/**
* Return whether Avvy is holding an object or not
* @remarks Originally called 'holding'
*/
bool Acci::isHolding() {
if ((51 <= _thing) && (_thing <= 99)) // Also.
return true;
bool holdingResult = false;
if (_thing > 100)
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("Be reasonable!");
2013-09-06 16:23:57 +02:00
else if (!_vm->_gyro->_dna._objects[_thing - 1]) // Verbs that need "_thing" to be in the inventory.
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("You're not holding it, Avvy.");
else
holdingResult = true;
return holdingResult;
2013-06-29 15:56:08 +02:00
}
void Acci::openBox(bool isOpening) {
2013-09-06 16:23:57 +02:00
if ((_vm->_gyro->_dna._room == r__yours) && (_thing == 54)) {
2013-09-03 22:22:42 +02:00
_vm->_celer->drawBackgroundSprite(-1, -1, 5);
_vm->_celer->updateBackgroundSprites();
_vm->_animation->animLink();
_vm->_graphics->refreshScreen();
_vm->_system->delayMillis(55);
if (!isOpening) {
2013-09-03 22:22:42 +02:00
_vm->_celer->drawBackgroundSprite(-1, -1, 6);
_vm->_celer->updateBackgroundSprites();
_vm->_animation->animLink();
_vm->_graphics->refreshScreen();
}
}
2013-06-29 15:56:08 +02:00
}
void Acci::examine() {
// EITHER it's an object OR it's an Also OR it's a _person OR it's something else.
if ((_person == kPardon) && (_thing != kPardon)) {
if (isHolding()) {
// Remember: it's been Slipped! Ie subtract 49.
if ((1 <= _thing) && (_thing <= 49)) // Standard object
examineObject();
else if ((50 <= _thing) && (_thing <= 100)) { // Also _thing
openBox(true);
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText(*_vm->_gyro->_also[_thing - 50][1]);
openBox(false);
}
}
} else if (_person != kPardon)
exampers();
else
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("It's just as it looks on the picture."); // Don't know: guess.
2013-06-29 15:56:08 +02:00
}
void Acci::inventory() {
byte itemNum = 0;
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText(Common::String("You're carrying ") + _vm->_scrolls->kControlToBuffer);
2013-09-06 16:23:57 +02:00
for (byte i = 0; i < kObjectNum; i++) {
if (_vm->_gyro->_dna._objects[i]) {
itemNum++;
2013-09-06 16:23:57 +02:00
if (itemNum == _vm->_gyro->_dna._carryNum)
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText(Common::String("and ") + _vm->_scrolls->kControlToBuffer);
_vm->_scrolls->displayText(_vm->_gyro->getItem(i + 1) + _vm->_scrolls->kControlToBuffer);
2013-09-06 16:23:57 +02:00
if ((i + 1) == _vm->_gyro->_dna._wearing)
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText(Common::String(", which you're wearing") + _vm->_scrolls->kControlToBuffer);
2013-09-06 16:23:57 +02:00
if (itemNum < _vm->_gyro->_dna._carryNum)
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText(Common::String(", ") + _vm->_scrolls->kControlToBuffer);
}
2013-08-26 11:45:06 +02:00
}
2013-09-06 16:23:57 +02:00
if (_vm->_gyro->_dna._wearing == kNothing)
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText(Common::String("...") + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + "...and you're stark naked!");
else
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText(".");
2013-06-29 15:56:08 +02:00
}
void Acci::swallow() { // Eat something.
switch (_thing) {
2013-09-06 16:23:57 +02:00
case Gyro::kObjectWine:
switch (_vm->_gyro->_dna._wineState) { // 4 is perfect
case 1:
2013-09-06 16:23:57 +02:00
if (_vm->_gyro->_dna._teetotal) {
_vm->_visa->displayScrollChain('D', 6);
return;
}
_vm->_visa->displayScrollChain('U', 1);
_vm->_pingo->wobble();
_vm->_visa->displayScrollChain('U', 2);
2013-09-06 16:23:57 +02:00
_vm->_gyro->_dna._objects[_vm->_gyro->kObjectWine - 1] = false;
_vm->_lucerna->refreshObjectList();
drink();
break;
case 2:
case 3:
_vm->_visa->displayScrollChain('d', 8);
break; // You can't drink it!
}
break;
2013-09-06 16:23:57 +02:00
case Gyro::kObjectPotion:
_vm->_gyro->setBackgroundColor(4);
_vm->_visa->displayScrollChain('U', 3);
_vm->_lucerna->gameOver();
2013-09-06 16:23:57 +02:00
_vm->_gyro->setBackgroundColor(0);
break;
2013-09-06 16:23:57 +02:00
case Gyro::kObjectInk:
_vm->_visa->displayScrollChain('U', 4);
break;
2013-09-06 16:23:57 +02:00
case Gyro::kObjectChastity:
_vm->_visa->displayScrollChain('U', 5);
break;
2013-09-06 16:23:57 +02:00
case Gyro::kObjectMushroom:
_vm->_visa->displayScrollChain('U', 6);
_vm->_lucerna->gameOver();
break;
2013-09-06 16:23:57 +02:00
case Gyro::kObjectOnion:
if (_vm->_gyro->_dna._rottenOnion)
_vm->_visa->displayScrollChain('U', 11);
else {
_vm->_visa->displayScrollChain('U', 8);
2013-09-06 16:23:57 +02:00
_vm->_gyro->_dna._objects[_vm->_gyro->kObjectOnion - 1] = false;
_vm->_lucerna->refreshObjectList();
}
break;
default:
2013-09-06 16:23:57 +02:00
if ((_vm->_gyro->_dna._room == r__argentpub) || (_vm->_gyro->_dna._room == r__nottspub))
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("Try BUYing things before you drink them!");
else
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("The taste of it makes you retch!");
}
2013-06-29 15:56:08 +02:00
}
void Acci::peopleInRoom() {
byte numPeople = 0; // Number of people in the room.
for (byte i = 1; i < 29; i++) { // Start at 1 so we don't list Avvy himself!
2013-09-06 16:23:57 +02:00
if (_vm->_gyro->_whereIs[i] == _vm->_gyro->_dna._room)
numPeople++;
}
if (numPeople == 0) // If nobody's here, we can cut out straight away.
return;
byte actPerson = 0; // Actually listed people.
for (byte i = 1; i < 29; i++) {
2013-09-06 16:23:57 +02:00
if (_vm->_gyro->_whereIs[i] == _vm->_gyro->_dna._room) {
actPerson++;
if (actPerson == 1) // First on the list.
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText(_vm->_gyro->getName(i + 150) + _vm->_scrolls->kControlToBuffer);
else if (actPerson < numPeople) // The middle...
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText(Common::String(", ") + _vm->_gyro->getName(i + 150) + _vm->_scrolls->kControlToBuffer);
else // The end.
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText(Common::String(" and ") + _vm->_gyro->getName(i + 150) + _vm->_scrolls->kControlToBuffer);
}
}
if (numPeople == 1)
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText(Common::String(" is") + _vm->_scrolls->kControlToBuffer);
else
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText(Common::String(" are") + _vm->_scrolls->kControlToBuffer);
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText(" here."); // End and display it.
2013-06-29 15:56:08 +02:00
}
void Acci::lookAround() {
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText(*_vm->_gyro->_also[0][1]);
2013-09-06 16:23:57 +02:00
switch (_vm->_gyro->_dna._room) {
2013-06-29 15:56:08 +02:00
case r__spludwicks:
2013-09-06 16:23:57 +02:00
if (_vm->_gyro->_dna._avariciusTalk > 0)
_vm->_visa->displayScrollChain('q', 23);
else
peopleInRoom();
break;
case r__robins:
2013-09-06 16:23:57 +02:00
if (_vm->_gyro->_dna._tiedUp)
_vm->_visa->displayScrollChain('q', 38);
2013-09-06 16:23:57 +02:00
if (_vm->_gyro->_dna._mushroomGrowing)
_vm->_visa->displayScrollChain('q', 55);
2013-06-29 15:56:08 +02:00
break;
case r__insidecardiffcastle:
2013-09-06 16:23:57 +02:00
if (!_vm->_gyro->_dna._takenPen)
_vm->_visa->displayScrollChain('q', 49);
2013-06-29 15:56:08 +02:00
break;
case r__lustiesroom:
2013-09-06 16:23:57 +02:00
if (_vm->_gyro->_dna._lustieIsAsleep)
_vm->_visa->displayScrollChain('q', 65);
2013-06-29 15:56:08 +02:00
break;
case r__catacombs:
2013-09-06 16:23:57 +02:00
switch (_vm->_gyro->_dna._catacombY * 256 + _vm->_gyro->_dna._catacombX) {
2013-06-29 15:56:08 +02:00
case 258 :
_vm->_visa->displayScrollChain('q', 80); // Inside art gallery.
break;
2013-06-29 15:56:08 +02:00
case 514 :
_vm->_visa->displayScrollChain('q', 81); // Outside ditto.
break;
2013-06-29 15:56:08 +02:00
case 260 :
_vm->_visa->displayScrollChain('q', 82); // Outside Geida's room.
break;
2013-06-29 15:56:08 +02:00
}
break;
default:
peopleInRoom();
2013-06-29 15:56:08 +02:00
}
}
void Acci::openDoor() {
// Special cases.
switch (_vm->_gyro->_dna._room) {
2013-06-29 15:56:08 +02:00
case r__yours:
if (_vm->_animation->inField(2)) {
// Opening the box.
_thing = 54; // The box.
_person = kPardon;
2013-06-29 15:56:08 +02:00
examine();
return;
}
break;
case r__spludwicks:
if (_thing == 61) {
_vm->_visa->displayScrollChain('q', 85);
2013-06-29 15:56:08 +02:00
return;
}
break;
}
2013-09-06 16:23:57 +02:00
if ((!_vm->_gyro->_dna._userMovesAvvy) && (_vm->_gyro->_dna._room != r__lusties))
return; // No doors can open if you can't move Avvy.
for (byte fv = 8; fv < 15; fv++) {
if (_vm->_animation->inField(fv + 1)) {
fv -= 8;
2013-09-06 16:23:57 +02:00
switch (_vm->_gyro->_portals[fv]._operation) {
2013-09-05 23:57:58 +02:00
case Gyro::kMagicExclaim:
_vm->_animation->_sprites[0].bounce();
_vm->_visa->displayScrollChain('x', _vm->_gyro->_portals[fv]._data);
break;
2013-09-05 23:57:58 +02:00
case Gyro::kMagicTransport:
_vm->_animation->flipRoom((_vm->_gyro->_portals[fv]._data) >> 8, // High byte
2013-09-06 16:23:57 +02:00
(_vm->_gyro->_portals[fv]._data) & 0x0F // Low byte
);
break;
2013-09-05 23:57:58 +02:00
case Gyro::kMagicUnfinished:
_vm->_animation->_sprites[0].bounce();
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("Sorry. This place is not available yet!");
break;
2013-09-05 23:57:58 +02:00
case Gyro::kMagicSpecial:
_vm->_animation->callSpecial(_vm->_gyro->_portals[fv]._data);
break;
2013-09-05 23:57:58 +02:00
case Gyro::kMagicOpenDoor:
2013-09-07 23:42:34 +02:00
_vm->_animation->openDoor((_vm->_gyro->_portals[fv]._data) >> 8, (_vm->_gyro->_portals[fv]._data) & 0x0F, fv + 9);
break;
2013-06-29 15:56:08 +02:00
}
2013-06-29 15:56:08 +02:00
return;
}
}
2013-09-06 16:23:57 +02:00
if (_vm->_gyro->_dna._room == r__map)
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText(Common::String("Avvy, you can complete the whole game without ever going "
2013-09-04 12:38:19 +02:00
"to anywhere other than Argent, Birmingham, Cardiff, Nottingham and Norwich."));
2013-06-29 15:56:08 +02:00
else
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("Door? What door?");
2013-06-29 15:56:08 +02:00
}
void Acci::silly() {
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("Don't be silly!");
2013-06-29 15:56:08 +02:00
}
void Acci::putProc() {
if (!isHolding())
return;
2013-06-29 15:56:08 +02:00
_thing2 -= 49; // Slip the second object.
char temp = _thing;
_thing = _thing2;
if (!isHolding())
return;
_thing = temp;
2013-06-29 15:56:08 +02:00
// Thing is the _thing which you're putting in. _thing2 is where you're putting it.
switch (_thing2) {
2013-09-06 16:23:57 +02:00
case Gyro::kObjectWine:
if (_thing == _vm->_gyro->kObjectOnion) {
if (_vm->_gyro->_dna._rottenOnion)
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("That's a bit like shutting the stable door after the horse has bolted!");
else { // Put onion into wine?
if (_vm->_gyro->_dna._wineState != 3) {
Common::String tmpStr = Common::String::format("%cOignon au vin%c is a bit too strong for your tastes!", Scrolls::kControlItalic, Scrolls::kControlRoman);
_vm->_scrolls->displayText(tmpStr);
} else { // Put onion into vinegar! Yes!
2013-09-06 16:23:57 +02:00
_vm->_gyro->_dna._onionInVinegar = true;
_vm->_lucerna->incScore(7);
_vm->_visa->displayScrollChain('u', 9);
2013-06-29 15:56:08 +02:00
}
}
} else
silly();
2013-06-29 15:56:08 +02:00
break;
case 54:
2013-09-06 16:23:57 +02:00
if (_vm->_gyro->_dna._room == r__yours) { // Put something into the box.
if (_vm->_gyro->_dna._boxContent != kNothing)
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("There's something in the box already, Avvy. Try taking that out first.");
else {
switch (_thing) {
2013-09-06 16:23:57 +02:00
case Gyro::kObjectMoney:
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("You'd better keep some ready cash on you!");
2013-06-29 15:56:08 +02:00
break;
2013-09-06 16:23:57 +02:00
case Gyro::kObjectBell:
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("That's a silly place to keep a bell.");
2013-06-29 15:56:08 +02:00
break;
2013-09-06 16:23:57 +02:00
case Gyro::kObjectBodkin:
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("But you might need it!");
2013-06-29 15:56:08 +02:00
break;
2013-09-06 16:23:57 +02:00
case Gyro::kObjectOnion:
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("Just give it to Spludwick, Avvy!");
2013-06-29 15:56:08 +02:00
break;
default: // Put the object into the box...
2013-09-06 16:23:57 +02:00
if (_vm->_gyro->_dna._wearing == _thing)
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText(Common::String("You'd better take ") + _vm->_gyro->getItem(_thing) + " off first!");
2013-06-29 15:56:08 +02:00
else {
openBox(true); // Open box.
2013-09-06 16:23:57 +02:00
_vm->_gyro->_dna._boxContent = _thing;
_vm->_gyro->_dna._objects[_thing - 1] = false;
_vm->_lucerna->refreshObjectList();
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("OK, it's in the box.");
openBox(false); // Shut box.
2013-06-29 15:56:08 +02:00
}
}
}
} else
silly();
2013-06-29 15:56:08 +02:00
break;
default:
silly();
}
}
/**
* Display text when ingredients are not in the right order
* @remarks Originally called 'not_in_order'
*/
void Acci::notInOrder() {
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText(Common::String("Sorry, I need the ingredients in the right order for this potion. What I need next is ")
2013-09-06 16:23:57 +02:00
+ _vm->_gyro->getItem(_vm->_gyro->kSpludwicksOrder[_vm->_gyro->_dna._givenToSpludwick])
+ _vm->_scrolls->kControlRegister + 2 + _vm->_scrolls->kControlSpeechBubble);
2013-06-29 15:56:08 +02:00
}
/**
* Move Spludwick to cauldron
* @remarks Originally called 'go_to_cauldron'
*/
void Acci::goToCauldron() {
_vm->_animation->_sprites[1]._callEachStepFl = false; // Stops Geida_Procs.
_vm->_timer->addTimer(1, _vm->_timer->kProcSpludwickGoesToCauldron, _vm->_timer->kReasonSpludwickWalk);
_vm->_animation->_sprites[1].walkTo(2);
2013-06-29 15:56:08 +02:00
}
/**
* Check is it's possible to give something to Spludwick
* @remarks Originally called 'give2spludwick'
*/
bool Acci::giveToSpludwick() {
2013-09-06 16:23:57 +02:00
if (_vm->_gyro->kSpludwicksOrder[_vm->_gyro->_dna._givenToSpludwick] != _thing) {
notInOrder();
return false;
}
2013-06-29 15:56:08 +02:00
switch (_thing) {
2013-09-06 16:23:57 +02:00
case Gyro::kObjectOnion:
_vm->_gyro->_dna._objects[_vm->_gyro->kObjectOnion - 1] = false;
if (_vm->_gyro->_dna._rottenOnion)
_vm->_visa->displayScrollChain('q', 22);
else {
2013-09-06 16:23:57 +02:00
_vm->_gyro->_dna._givenToSpludwick++;
_vm->_visa->displayScrollChain('q', 20);
goToCauldron();
_vm->_lucerna->incScore(3);
2013-06-29 15:56:08 +02:00
}
_vm->_lucerna->refreshObjectList();
2013-06-29 15:56:08 +02:00
break;
2013-09-06 16:23:57 +02:00
case Gyro::kObjectInk:
_vm->_gyro->_dna._objects[_vm->_gyro->kObjectInk - 1] = false;
_vm->_lucerna->refreshObjectList();
2013-09-06 16:23:57 +02:00
_vm->_gyro->_dna._givenToSpludwick++;
_vm->_visa->displayScrollChain('q', 24);
goToCauldron();
_vm->_lucerna->incScore(3);
2013-06-29 15:56:08 +02:00
break;
2013-09-06 16:23:57 +02:00
case Gyro::kObjectMushroom:
_vm->_gyro->_dna._objects[_vm->_gyro->kObjectMushroom - 1] = false;
_vm->_visa->displayScrollChain('q', 25);
_vm->_lucerna->incScore(5);
2013-09-06 16:23:57 +02:00
_vm->_gyro->_dna._givenToSpludwick++;
goToCauldron();
2013-09-06 16:23:57 +02:00
_vm->_gyro->_dna._objects[_vm->_gyro->kObjectPotion - 1] = true;
_vm->_lucerna->refreshObjectList();
break;
default:
return true;
2013-06-29 15:56:08 +02:00
}
return false;
2013-06-29 15:56:08 +02:00
}
void Acci::drink() {
2013-09-06 16:23:57 +02:00
_vm->_gyro->_dna._alcoholLevel += 1;
if (_vm->_gyro->_dna._alcoholLevel == 5) {
_vm->_gyro->_dna._objects[_vm->_gyro->kObjectKey - 1] = true; // Get the key.
_vm->_gyro->_dna._teetotal = true;
_vm->_gyro->_dna._avvyIsAwake = false;
_vm->_gyro->_dna._avvyInBed = true;
_vm->_lucerna->refreshObjectList();
_vm->_lucerna->dusk();
2013-09-06 16:23:57 +02:00
_vm->_gyro->hangAroundForAWhile();
_vm->_animation->flipRoom(1, 1);
2013-09-06 16:23:57 +02:00
_vm->_gyro->setBackgroundColor(14);
_vm->_animation->_sprites[0]._visible = false;
2013-06-29 15:56:08 +02:00
}
}
void Acci::cardiffClimbing() {
2013-09-06 16:23:57 +02:00
if (_vm->_gyro->_dna._standingOnDais) { // Clamber up.
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("You climb down, back onto the floor.");
2013-09-06 16:23:57 +02:00
_vm->_gyro->_dna._standingOnDais = false;
_vm->_animation->appearPed(1, 3);
} else { // Clamber down.
if (_vm->_animation->inField(1)) {
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("You clamber up onto the dais.");
2013-09-06 16:23:57 +02:00
_vm->_gyro->_dna._standingOnDais = true;
_vm->_animation->appearPed(1, 2);
2013-06-29 15:56:08 +02:00
} else
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("Get a bit closer, Avvy.");
2013-06-29 15:56:08 +02:00
}
}
void Acci::already() {
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("You're already standing!");
2013-06-29 15:56:08 +02:00
}
void Acci::standUp() {
2013-09-06 16:23:57 +02:00
switch (_vm->_gyro->_dna._room) {
case r__yours: // Avvy isn't asleep.
2013-09-06 16:23:57 +02:00
if (_vm->_gyro->_dna._avvyIsAwake && _vm->_gyro->_dna._avvyInBed) { // But he's in bed.
if (_vm->_gyro->_dna._teetotal) {
_vm->_visa->displayScrollChain('d', 12);
2013-09-06 16:23:57 +02:00
_vm->_gyro->setBackgroundColor(0);
_vm->_visa->displayScrollChain('d', 14);
2013-06-29 15:56:08 +02:00
}
_vm->_animation->_sprites[0]._visible = true;
2013-09-06 16:23:57 +02:00
_vm->_gyro->_dna._userMovesAvvy = true;
_vm->_animation->appearPed(1, 2);
2013-09-06 16:23:57 +02:00
_vm->_gyro->_dna._direction = _vm->_gyro->kDirectionLeft;
2013-09-03 22:22:42 +02:00
_vm->_celer->drawBackgroundSprite(-1, -1, 4); // Picture of empty pillow.
_vm->_lucerna->incScore(1);
2013-09-06 16:23:57 +02:00
_vm->_gyro->_dna._avvyInBed = false;
2013-09-08 11:30:23 +02:00
_vm->_timer->loseTimer(_vm->_timer->kReasonArkataShouts);
} else
already();
2013-06-29 15:56:08 +02:00
break;
case r__insidecardiffcastle:
cardiffClimbing();
2013-06-29 15:56:08 +02:00
break;
case r__nottspub:
2013-09-06 16:23:57 +02:00
if (_vm->_gyro->_dna._sittingInPub) {
2013-09-03 22:22:42 +02:00
_vm->_celer->drawBackgroundSprite(-1, -1, 4); // Not sitting down.
_vm->_animation->_sprites[0]._visible = true; // But standing up.
_vm->_animation->appearPed(1, 4); // And walking away.
2013-09-06 16:23:57 +02:00
_vm->_gyro->_dna._sittingInPub = false; // Really not sitting down.
_vm->_gyro->_dna._userMovesAvvy = true; // And ambulant.
} else
already();
2013-06-29 15:56:08 +02:00
break;
default:
already();
}
}
void Acci::getProc(char thing) {
2013-09-06 16:23:57 +02:00
switch (_vm->_gyro->_dna._room) {
2013-06-29 15:56:08 +02:00
case r__yours:
if (_vm->_animation->inField(2)) {
2013-09-06 16:23:57 +02:00
if (_vm->_gyro->_dna._boxContent == thing) {
2013-09-03 22:22:42 +02:00
_vm->_celer->drawBackgroundSprite(-1, -1, 5);
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("OK, I've got it.");
2013-09-06 16:23:57 +02:00
_vm->_gyro->_dna._objects[thing - 1] = true;
_vm->_lucerna->refreshObjectList();
2013-09-06 16:23:57 +02:00
_vm->_gyro->_dna._boxContent = kNothing;
2013-09-03 22:22:42 +02:00
_vm->_celer->drawBackgroundSprite(-1, -1, 6);
2013-06-29 15:56:08 +02:00
} else
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText(Common::String("I can't see ") + _vm->_gyro->getItem(thing) + " in the box.");
} else
_vm->_visa->displayScrollChain('q', 57);
2013-06-29 15:56:08 +02:00
break;
case r__insidecardiffcastle:
switch (thing) {
2013-09-06 16:23:57 +02:00
case Gyro::kObjectPen:
if (_vm->_animation->inField(2)) { // Standing on the dais.
2013-09-06 16:23:57 +02:00
if (_vm->_gyro->_dna._takenPen)
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("It's not there, Avvy.");
2013-06-29 15:56:08 +02:00
else {
// OK: we're taking the pen, and it's there.
2013-09-03 22:22:42 +02:00
_vm->_celer->drawBackgroundSprite(-1, -1, 4); // No pen there now.
_vm->_animation->callSpecial(3); // Zap!
2013-09-06 16:23:57 +02:00
_vm->_gyro->_dna._takenPen = true;
_vm->_gyro->_dna._objects[_vm->_gyro->kObjectPen - 1] = true;
_vm->_lucerna->refreshObjectList();
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("Taken.");
2013-06-29 15:56:08 +02:00
}
2013-09-06 16:23:57 +02:00
} else if (_vm->_gyro->_dna._standingOnDais)
_vm->_visa->displayScrollChain('q', 53);
else
_vm->_visa->displayScrollChain('q', 51);
break;
2013-09-06 16:23:57 +02:00
case Gyro::kObjectBolt:
_vm->_visa->displayScrollChain('q', 52);
2013-06-29 15:56:08 +02:00
break;
default:
_vm->_visa->displayScrollChain('q', 57);
2013-06-29 15:56:08 +02:00
}
break;
case r__robins:
if ((thing == _vm->_gyro->kObjectMushroom) & (_vm->_animation->inField(1)) & (_vm->_gyro->_dna._mushroomGrowing)) {
2013-09-03 22:22:42 +02:00
_vm->_celer->drawBackgroundSprite(-1, -1, 3);
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("Got it!");
2013-09-06 16:23:57 +02:00
_vm->_gyro->_dna._mushroomGrowing = false;
_vm->_gyro->_dna._takenMushroom = true;
_vm->_gyro->_dna._objects[_vm->_gyro->kObjectMushroom - 1] = true;
_vm->_lucerna->refreshObjectList();
_vm->_lucerna->incScore(3);
} else
_vm->_visa->displayScrollChain('q', 57);
2013-06-29 15:56:08 +02:00
break;
default:
_vm->_visa->displayScrollChain('q', 57);
2013-06-29 15:56:08 +02:00
}
}
/**
* Give the lute to Geida
* @remarks Originally called 'give_Geida_the_lute'
*/
void Acci::giveGeidaTheLute() {
2013-09-06 16:23:57 +02:00
if (_vm->_gyro->_dna._room != r__lustiesroom) {
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText(Common::String("Not yet. Try later!") + _vm->_scrolls->kControlRegister + '2' + _vm->_scrolls->kControlSpeechBubble);
return;
}
2013-09-06 16:23:57 +02:00
_vm->_gyro->_dna._objects[_vm->_gyro->kObjectLute - 1] = false;
_vm->_lucerna->refreshObjectList();
_vm->_visa->displayScrollChain('q', 64); // She plays it.
2013-06-29 15:56:08 +02:00
2013-09-08 11:30:23 +02:00
_vm->_timer->addTimer(1, _vm->_timer->kProcGiveLuteToGeida, _vm->_timer->kReasonGeidaSings);
_vm->_enid->backToBootstrap(4);
2013-06-29 15:56:08 +02:00
}
void Acci::playHarp() {
if (_vm->_animation->inField(7))
2013-09-07 20:37:42 +02:00
_vm->_scrolls->musicalScroll();
else
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("Get a bit closer to it, Avvy!");
2013-06-29 15:56:08 +02:00
}
void Acci::winSequence() {
_vm->_visa->displayScrollChain('q', 78);
2013-09-08 00:02:20 +02:00
_vm->_sequence->firstShow(7);
_vm->_sequence->thenShow(8);
_vm->_sequence->thenShow(9);
_vm->_sequence->startToClose();
2013-09-08 11:30:23 +02:00
_vm->_timer->addTimer(30, _vm->_timer->kProcWinning, _vm->_timer->kReasonWinning);
2013-06-29 15:56:08 +02:00
}
void Acci::personSpeaks() {
if ((_person == kPardon) || (_person == 0)) {
2013-09-06 16:23:57 +02:00
if ((_vm->_gyro->_him == kPardon) || (_vm->_gyro->_whereIs[_vm->_gyro->_him - 150] != _vm->_gyro->_dna._room))
_person = _vm->_gyro->_her;
else
2013-09-06 16:23:57 +02:00
_person = _vm->_gyro->_him;
}
2013-06-29 15:56:08 +02:00
2013-09-06 16:23:57 +02:00
if (_vm->_gyro->_whereIs[_person - 150] != _vm->_gyro->_dna._room) {
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText(Common::String(_vm->_scrolls->kControlRegister) + '1' + _vm->_scrolls->kControlToBuffer); // Avvy himself!
2013-06-29 15:56:08 +02:00
return;
}
bool found = false; // The _person we're looking for's code is in _person.
2013-06-29 15:56:08 +02:00
for (byte i = 0; i < _vm->_animation->kSpriteNumbMax; i++) {
if (_vm->_animation->_sprites[i]._quick && ((_vm->_animation->_sprites[i]._stat._acciNum + 149) == _person)) {
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText(Common::String(_vm->_scrolls->kControlRegister) + byte(i + 49) + _vm->_scrolls->kControlToBuffer);
2013-06-29 15:56:08 +02:00
found = true;
}
}
2013-06-29 15:56:08 +02:00
if (!found) {
for (byte i = 0; i < 16; i++) {
2013-09-06 16:23:57 +02:00
if ((_vm->_gyro->kQuasipeds[i]._who == _person) && (_vm->_gyro->kQuasipeds[i]._room == _vm->_gyro->_dna._room))
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText(Common::String(_vm->_scrolls->kControlRegister) + byte(i + 65) + _vm->_scrolls->kControlToBuffer);
}
}
2013-06-29 15:56:08 +02:00
}
void Acci::heyThanks() {
personSpeaks();
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText(Common::String("Hey, thanks!") + _vm->_scrolls->kControlSpeechBubble + "(But now, you've lost it!)");
2013-09-06 16:23:57 +02:00
_vm->_gyro->_dna._objects[_thing - 1] = false;
2013-06-29 15:56:08 +02:00
}
/**
* @remarks Originally called 'do_that'
*/
void Acci::doThat() {
2013-09-07 00:41:39 +02:00
static const Common::String booze[] = {"Bitter", "GIED", "Whisky", "Cider", "", "", "", "Mead"};
static const char kWhat[] = "That's not possible!";
2013-06-29 15:56:08 +02:00
if (_thats == Common::String(kNothing)) {
if (!_thats.empty())
_thats.clear();
2013-06-29 15:56:08 +02:00
return;
}
2013-09-06 16:23:57 +02:00
if (_vm->_gyro->_weirdWord)
return;
if (_thing < 200)
_thing -= 49; // "Slip"
2013-06-29 15:56:08 +02:00
if ((_verb != kVerbCodeLoad) && (_verb != kVerbCodeSave) && (_verb != kVerbCodeQuit) && (_verb != kVerbCodeInfo) && (_verb != kVerbCodeHelp)
2013-09-05 15:48:30 +02:00
&& (_verb != kVerbCodeLarrypass) && (_verb != kVerbCodePhaon) && (_verb != kVerbCodeBoss) && (_verb != kVerbCodeCheat) && (_verb != kVerbCodeRestart)
&& (_verb != kVerbCodeDir) && (_verb != kVerbCodeScore) && (_verb != kVerbCodeHiscores) && (_verb != kVerbCodeSmartAlec)) {
2013-09-06 16:23:57 +02:00
if (!_vm->_gyro->_alive) {
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText(Common::String("You're dead, so don't talk. What are you, a ghost or something? Try restarting, or restoring a saved game!"));
return;
}
2013-09-06 16:23:57 +02:00
if (!_vm->_gyro->_dna._avvyIsAwake && (_verb != kVerbCodeDie) && (_verb != kVerbCodeExpletive) && (_verb != kVerbCodeWake)) {
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("Talking in your sleep? Try waking up!");
return;
}
}
2013-06-29 15:56:08 +02:00
switch (_verb) {
case kVerbCodeExam:
2013-06-29 15:56:08 +02:00
examine();
break;
case kVerbCodeOpen:
openDoor();
2013-06-29 15:56:08 +02:00
break;
case kVerbCodePause: // Note that the original game doesn't care about the "O.K." box neither, it accepts clicks from everywhere on the screen to continue. Just like my code.
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText(Common::String("Game paused.") + _vm->_scrolls->kControlCenter + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine
+ "Press Enter, Esc, or click the mouse on the \"O.K.\" box to continue.");
2013-06-29 15:56:08 +02:00
break;
case kVerbCodeGet:
if (_thing != kPardon) { // Legitimate try to pick something up.
2013-09-06 16:23:57 +02:00
if (_vm->_gyro->_dna._carryNum >= kCarryLimit)
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("You can't carry any more!");
else
getProc(_thing);
} else { // Not... ditto.
if (_person != kPardon)
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("You can't sweep folk off their feet!");
2013-06-29 15:56:08 +02:00
else
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("I assure you, you don't need it.");
2013-06-29 15:56:08 +02:00
}
break;
case kVerbCodeDrop:
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText(Common::String("Two years ago you dropped a florin in the street. Three days ") +
2013-06-29 15:56:08 +02:00
"later it was gone! So now you never leave ANYTHING lying around. OK?");
break;
case kVerbCodeInv:
inventory();
2013-06-29 15:56:08 +02:00
break;
case kVerbCodeTalk:
if (_person == kPardon) {
2013-09-06 16:23:57 +02:00
if (_vm->_gyro->_subjectNum == 99) // They typed "say password".
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText(Common::String("Yes, but what ") + _vm->_scrolls->kControlItalic + "is" + _vm->_scrolls->kControlRoman + " the password?");
2013-09-06 16:23:57 +02:00
else if (((1 <= _vm->_gyro->_subjectNum) && (_vm->_gyro->_subjectNum <= 49)) || (_vm->_gyro->_subjectNum == 253) || (_vm->_gyro->_subjectNum == 249)) {
_thats.deleteChar(0);
for (byte i = 0; i < 10; i++)
_realWords[i] = _realWords[i + 1];
2013-09-06 16:23:57 +02:00
_verb = _vm->_gyro->_subjectNum;
doThat();
return;
2013-06-29 15:56:08 +02:00
} else {
2013-09-06 16:23:57 +02:00
_person = _vm->_gyro->_subjectNum;
_vm->_gyro->_subjectNum = 0;
if ((_person == 0) || (_person == kPardon))
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("Talk to whom?");
else if (isPersonHere())
_vm->_visa->talkTo(_person);
2013-06-29 15:56:08 +02:00
}
} else if (isPersonHere())
_vm->_visa->talkTo(_person);
2013-06-29 15:56:08 +02:00
break;
case kVerbCodeGive:
if (isHolding()) {
if (_person == kPardon)
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("Give to whom?");
else if (isPersonHere()) {
switch (_thing) {
2013-09-06 16:23:57 +02:00
case Gyro::kObjectMoney :
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("You can't bring yourself to give away your moneybag.");
2013-06-29 15:56:08 +02:00
break;
2013-09-06 16:23:57 +02:00
case Gyro::kObjectBodkin:
case Gyro::kObjectBell:
case Gyro::kObjectClothes:
case Gyro::kObjectHabit :
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("Don't give it away, it might be useful!");
2013-06-29 15:56:08 +02:00
break;
default:
switch (_person) {
2013-09-06 16:23:57 +02:00
case Gyro::kPeopleCrapulus:
if (_thing == _vm->_gyro->kObjectWine) {
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("Crapulus grabs the wine and gulps it down.");
2013-09-06 16:23:57 +02:00
_vm->_gyro->_dna._objects[_vm->_gyro->kObjectWine - 1] = false;
} else
heyThanks();
2013-06-29 15:56:08 +02:00
break;
2013-09-06 16:23:57 +02:00
case Gyro::kPeopleCwytalot:
if ((_thing == _vm->_gyro->kObjectCrossbow) || (_thing == _vm->_gyro->kObjectBolt))
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText(Common::String("You might be able to influence Cwytalot more if you used it!"));
else
heyThanks();
2013-06-29 15:56:08 +02:00
break;
2013-09-06 16:23:57 +02:00
case Gyro::kPeopleSpludwick:
if (giveToSpludwick())
heyThanks();
2013-06-29 15:56:08 +02:00
break;
2013-09-06 16:23:57 +02:00
case Gyro::kPeopleIbythneth:
if (_thing == _vm->_gyro->kObjectBadge) {
_vm->_visa->displayScrollChain('q', 32); // Thanks! Wow!
_vm->_lucerna->incScore(3);
2013-09-06 16:23:57 +02:00
_vm->_gyro->_dna._objects[_vm->_gyro->kObjectBadge - 1] = false;
_vm->_gyro->_dna._objects[_vm->_gyro->kObjectHabit - 1] = true;
_vm->_gyro->_dna._givenBadgeToIby = true;
2013-09-03 22:22:42 +02:00
_vm->_celer->drawBackgroundSprite(-1, -1, 8);
_vm->_celer->drawBackgroundSprite(-1, -1, 9);
} else
heyThanks();
2013-06-29 15:56:08 +02:00
break;
2013-09-06 16:23:57 +02:00
case Gyro::kPeopleAyles:
if (_vm->_gyro->_dna._aylesIsAwake) {
if (_thing == _vm->_gyro->kObjectPen) {
_vm->_gyro->_dna._objects[_vm->_gyro->kObjectPen - 1] = false;
_vm->_visa->displayScrollChain('q', 54);
2013-09-06 16:23:57 +02:00
_vm->_gyro->_dna._objects[_vm->_gyro->kObjectInk - 1] = true;
_vm->_gyro->_dna._givenPenToAyles = true;
_vm->_lucerna->refreshObjectList();
_vm->_lucerna->incScore(2);
} else
heyThanks();
2013-06-29 15:56:08 +02:00
} else
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("But he's asleep!");
2013-06-29 15:56:08 +02:00
break;
2013-09-06 16:23:57 +02:00
case Gyro::kPeopleGeida:
switch (_thing) {
2013-09-06 16:23:57 +02:00
case Gyro::kObjectPotion:
_vm->_gyro->_dna._objects[_vm->_gyro->kObjectPotion - 1] = false;
_vm->_visa->displayScrollChain('u', 16); // She drinks it.
_vm->_lucerna->incScore(2);
2013-09-06 16:23:57 +02:00
_vm->_gyro->_dna._givenPotionToGeida = true;
_vm->_lucerna->refreshObjectList();
break;
2013-09-06 16:23:57 +02:00
case Gyro::kObjectLute:
giveGeidaTheLute();
2013-06-29 15:56:08 +02:00
break;
default:
heyThanks();
2013-06-29 15:56:08 +02:00
}
break;
2013-09-06 16:23:57 +02:00
case Gyro::kPeopleArkata:
switch (_thing) {
2013-09-06 16:23:57 +02:00
case Gyro::kObjectPotion:
if (_vm->_gyro->_dna._givenPotionToGeida)
winSequence();
else
_vm->_visa->displayScrollChain('q', 77); // That Geida woman!
break;
2013-06-29 15:56:08 +02:00
default:
heyThanks();
2013-06-29 15:56:08 +02:00
}
break;
default:
heyThanks();
2013-06-29 15:56:08 +02:00
}
}
}
_vm->_lucerna->refreshObjectList(); // Just in case...
2013-06-29 15:56:08 +02:00
}
break;
case kVerbCodeEat:
case kVerbCodeDrink:
if (isHolding())
swallow();
2013-06-29 15:56:08 +02:00
break;
case kVerbCodeLoad:
2013-06-29 15:56:08 +02:00
break;
case kVerbCodeSave:
2013-06-29 15:56:08 +02:00
break;
// We don't handle these two because we use ScummVM's save/load system.
case kVerbCodePay:
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("No money need change hands.");
2013-06-29 15:56:08 +02:00
break;
case kVerbCodeLook:
lookAround();
2013-06-29 15:56:08 +02:00
break;
case kVerbCodeBreak:
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("Vandalism is prohibited within this game!");
2013-06-29 15:56:08 +02:00
break;
case kVerbCodeQuit: // quit
2013-09-05 23:57:58 +02:00
if (_vm->_gyro->kDemo) {
warning("STUB: Acci::doThat() - case kVerbCodequit");
2013-09-08 11:30:23 +02:00
// _vm->_visa->displayScrollChain('pos', 31);
2013-06-29 15:56:08 +02:00
// close(demofile);
// exit(0); // Change this later!!!
}
if (!_polite)
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("How about a `please\", Avvy?");
else if (_vm->_scrolls->displayQuestion(Common::String(_vm->_scrolls->kControlRegister) + 'C' + _vm->_scrolls->kControlIcon + "Do you really want to quit?"))
2013-09-06 16:23:57 +02:00
_vm->_gyro->_letMeOut = true;
break;
case kVerbCodeGo:
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("Just use the arrow keys to walk there.");
2013-06-29 15:56:08 +02:00
break;
case kVerbCodeInfo: {
2013-09-07 20:37:42 +02:00
_vm->_scrolls->_aboutScroll = true;
Common::String toDisplay;
for (byte i = 0; i < 7; i++)
toDisplay += _vm->_scrolls->kControlNewLine;
toDisplay = toDisplay + "LORD AVALOT D'ARGENT" + _vm->_scrolls->kControlCenter + _vm->_scrolls->kControlNewLine
+ "The medi\x91val descendant of" + _vm->_scrolls->kControlNewLine
+ "Denarius Avaricius Sextus" + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine
+ "version " + _vm->_gyro->kVersionNum + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + "Copyright \xEF "
2013-09-06 16:23:57 +02:00
+ _vm->_gyro->kCopyright + ", Mark, Mike and Thomas Thurman." + _vm->_scrolls->kControlRegister + 'Y' + _vm->_scrolls->kControlIcon;
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText(toDisplay);
_vm->_scrolls->_aboutScroll = false;
}
break;
case kVerbCodeUndress:
2013-09-06 16:23:57 +02:00
if (_vm->_gyro->_dna._wearing == kNothing)
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("You're already stark naked!");
2013-09-06 16:23:57 +02:00
else if (_vm->_gyro->_dna._avvysInTheCupboard) {
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText(Common::String("You take off ") + _vm->_gyro->getItem(_vm->_gyro->_dna._wearing) + '.');
2013-09-06 16:23:57 +02:00
_vm->_gyro->_dna._wearing = kNothing;
_vm->_lucerna->refreshObjectList();
2013-06-29 15:56:08 +02:00
} else
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("Hadn't you better find somewhere more private, Avvy?");
2013-06-29 15:56:08 +02:00
break;
case kVerbCodeWear:
if (isHolding()) { // Wear something.
switch (_thing) {
2013-09-06 16:23:57 +02:00
case Gyro::kObjectChastity:
2013-09-04 17:15:33 +02:00
// \? are used to avoid that ??! is parsed as a trigraph
_vm->_scrolls->displayText("Hey, what kind of a weirdo are you\?\?!");
2013-06-29 15:56:08 +02:00
break;
2013-09-06 16:23:57 +02:00
case Gyro::kObjectClothes:
case Gyro::kObjectHabit: { // Change this!
if (_vm->_gyro->_dna._wearing != kNothing) {
if (_vm->_gyro->_dna._wearing == _thing)
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("You're already wearing that.");
else
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("You'll be rather warm wearing two sets of clothes!");
return;
} else
2013-09-06 16:23:57 +02:00
_vm->_gyro->_dna._wearing = _thing;
_vm->_lucerna->refreshObjectList();
byte i;
2013-09-06 16:23:57 +02:00
if (_thing == _vm->_gyro->kObjectHabit)
i = 3;
else
i = 0;
if (_vm->_animation->_sprites[0]._id != i) {
int16 x = _vm->_animation->_sprites[0]._x;
int16 y = _vm->_animation->_sprites[0]._y;
_vm->_animation->_sprites[0].remove();
_vm->_animation->_sprites[0].init(i, true, _vm->_animation);
_vm->_animation->_sprites[0].appear(x, y, Animation::kDirLeft);
_vm->_animation->_sprites[0]._visible = false;
}
2013-06-29 15:56:08 +02:00
}
break;
2013-06-29 15:56:08 +02:00
default:
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText(kWhat);
2013-06-29 15:56:08 +02:00
}
}
break;
case kVerbCodePlay:
if (_thing == kPardon) {
2013-09-06 16:23:57 +02:00
switch (_vm->_gyro->_dna._room) { // They just typed "play"...
case r__argentpub: { // ...in the pub, => play Nim.
warning("STUB: Acci::doThat() - case kVerbCodeplay");
// play_nim();
// The following parts are copied from play_nim().
// The player automatically wins the game everytime he wins, until I implement the mini-game.
2013-09-06 16:23:57 +02:00
if (_vm->_gyro->_dna._wonNim) { // Already won the game.
_vm->_visa->displayScrollChain('Q', 6);
return;
}
2013-09-06 16:23:57 +02:00
if (!_vm->_gyro->_dna._askedDogfoodAboutNim) {
_vm->_visa->displayScrollChain('q', 84);
return;
}
_vm->_visa->displayScrollChain('Q', 3);
2013-09-06 16:23:57 +02:00
_vm->_gyro->_dna._playedNim++;
// You won - strange!
_vm->_visa->displayScrollChain('Q', 7); // You won! Give us a lute!
2013-09-06 16:23:57 +02:00
_vm->_gyro->_dna._objects[_vm->_gyro->kObjectLute - 1] = true;
_vm->_lucerna->refreshObjectList();
2013-09-06 16:23:57 +02:00
_vm->_gyro->_dna._wonNim = true;
2013-09-03 22:22:42 +02:00
_vm->_celer->drawBackgroundSprite(-1, -1, 1); // Show the settle with no lute on it.
_vm->_lucerna->incScore(7); // 7 points for winning!
2013-09-06 16:23:57 +02:00
if (_vm->_gyro->_dna._playedNim == 1)
_vm->_lucerna->incScore(3); // 3 points for playing your 1st game.
// A warning to the player that there should have been a mini-game. TODO: Remove it later!!!
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText(Common::String("P.S.: There should have been the mini-game called \"Nim\", but I haven't implemented it yet: you win and get the lute automatically.")
+ _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + "Peter (uruk)");
}
break;
2013-06-29 15:56:08 +02:00
case r__musicroom:
playHarp();
2013-06-29 15:56:08 +02:00
break;
}
} else if (isHolding()) {
switch (_thing) {
2013-09-06 16:23:57 +02:00
case Gyro::kObjectLute :
_vm->_visa->displayScrollChain('U', 7);
2013-09-06 16:23:57 +02:00
if (_vm->_gyro->_whereIs[_vm->_gyro->kPeopleCwytalot - 150] == _vm->_gyro->_dna._room)
_vm->_visa->displayScrollChain('U', 10);
2013-09-06 16:23:57 +02:00
if (_vm->_gyro->_whereIs[_vm->_gyro->kPeopleDuLustie - 150] == _vm->_gyro->_dna._room)
_vm->_visa->displayScrollChain('U', 15);
2013-06-29 15:56:08 +02:00
break;
case 52:
2013-09-06 16:23:57 +02:00
if (_vm->_gyro->_dna._room == r__musicroom)
playHarp();
else
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText(kWhat);
break;
case 55:
2013-09-06 16:23:57 +02:00
if (_vm->_gyro->_dna._room == r__argentpub)
// play_nim();
warning("STUB: Acci::doThat() - case kVerbCodeplay");
else
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText(kWhat);
2013-06-29 15:56:08 +02:00
break;
default:
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText(kWhat);
2013-06-29 15:56:08 +02:00
}
}
break;
case kVerbCodeRing:
if (isHolding()) {
2013-09-06 16:23:57 +02:00
if (_thing == _vm->_gyro->kObjectBell) {
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("Ding, dong, ding, dong, ding, dong, ding, dong...");
2013-09-06 16:23:57 +02:00
if ((_vm->_gyro->_dna._bellsAreRinging) & (_vm->_gyro->setFlag('B')))
2013-09-04 17:15:33 +02:00
// \? are used to avoid that ??! is parsed as a trigraph
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("(Are you trying to join in, Avvy\?\?!)");
} else
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText(kWhat);
2013-06-29 15:56:08 +02:00
}
break;
case kVerbCodeHelp:
2013-06-29 15:56:08 +02:00
// boot_help();
warning("STUB: Acci::doThat() - case kVerbCodehelp");
2013-06-29 15:56:08 +02:00
break;
case kVerbCodeLarrypass:
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("Wrong game!");
2013-06-29 15:56:08 +02:00
break;
case kVerbCodePhaon:
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("Hello, Phaon!");
2013-06-29 15:56:08 +02:00
break;
case kVerbCodeBoss:
2013-06-29 15:56:08 +02:00
// bosskey();
warning("STUB: Acci::doThat() - case kVerbCodeboss");
2013-06-29 15:56:08 +02:00
break;
case kVerbCodePee:
2013-09-06 16:23:57 +02:00
if (_vm->_gyro->setFlag('P')) {
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("Hmm, I don't think anyone will notice...");
2013-09-08 11:30:23 +02:00
_vm->_timer->addTimer(4, _vm->_timer->kProcUrinate, _vm->_timer->kReasonGoToToilet);
} else
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText(Common::String("It would be ") + _vm->_scrolls->kControlItalic + "VERY"
+ _vm->_scrolls->kControlRoman + " unwise to do that here, Avvy!");
2013-06-29 15:56:08 +02:00
break;
case kVerbCodeCheat:
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText(Common::String(_vm->_scrolls->kControlItalic) + "Cheat mode now enabled.");
2013-09-06 16:23:57 +02:00
_vm->_gyro->_cheat = true;
break;
case kVerbCodeMagic:
2013-09-06 16:23:57 +02:00
if (_vm->_gyro->_dna._avariciusTalk > 0)
_vm->_visa->displayScrollChain('q', 19);
2013-06-29 15:56:08 +02:00
else {
if ((_vm->_gyro->_dna._room == 12) & (_vm->_animation->inField(2))) { // Avaricius appears!
_vm->_visa->displayScrollChain('q', 17);
2013-09-05 23:57:58 +02:00
if (_vm->_gyro->_whereIs[1] == 12)
_vm->_visa->displayScrollChain('q', 18);
2013-06-29 15:56:08 +02:00
else {
_vm->_animation->_sprites[1].init(1, false, _vm->_animation); // Avaricius
_vm->_animation->appearPed(2, 4);
_vm->_animation->_sprites[1].walkTo(5);
_vm->_animation->_sprites[1]._callEachStepFl = true;
_vm->_animation->_sprites[1]._eachStepProc = _vm->_animation->kProcBackAndForth;
2013-09-06 16:23:57 +02:00
_vm->_gyro->_dna._avariciusTalk = 14;
2013-09-08 11:30:23 +02:00
_vm->_timer->addTimer(177, _vm->_timer->kProcAvariciusTalks, _vm->_timer->kReasonAvariciusTalks);
2013-06-29 15:56:08 +02:00
}
} else
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("Nothing appears to happen...");
2013-06-29 15:56:08 +02:00
}
break;
case kVerbCodeSmartAlec:
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("Listen, smart alec, that was just rhetoric.");
2013-06-29 15:56:08 +02:00
break;
case kVerbCodeExpletive:
2013-09-06 16:23:57 +02:00
switch (_vm->_gyro->_dna._sworeNum) {
2013-06-29 15:56:08 +02:00
case 0:
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText(Common::String("Avvy! Do you mind? There might be kids playing!")
+ _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + "(I shouldn't say it again, if I were you!)");
2013-06-29 15:56:08 +02:00
break;
case 1:
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText(Common::String("You hear a distant rumble of thunder. Must you always do things I tell you not to?")
+ _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + "Don't do it again!");
2013-06-29 15:56:08 +02:00
break;
default:
_vm->_pingo->zonk();
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText(Common::String("A crack of lightning shoots from the sky, and fries you.")
+ _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + "(`Such is the anger of the gods, Avvy!\")");
_vm->_lucerna->gameOver();
2013-06-29 15:56:08 +02:00
}
2013-09-06 16:23:57 +02:00
_vm->_gyro->_dna._sworeNum++;
break;
case kVerbCodeListen:
2013-09-06 16:23:57 +02:00
if ((_vm->_gyro->_dna._bellsAreRinging) & (_vm->_gyro->setFlag('B')))
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("All other noise is drowned out by the ringing of the bells.");
2013-09-06 16:23:57 +02:00
else if (_vm->_gyro->_listen.empty())
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("You can't hear anything much at the moment, Avvy.");
else
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText(_vm->_gyro->_listen);
2013-06-29 15:56:08 +02:00
break;
case kVerbCodeBuy: // What are they trying to buy?
2013-09-06 16:23:57 +02:00
switch (_vm->_gyro->_dna._room) {
2013-06-29 15:56:08 +02:00
case r__argentpub:
if (_vm->_animation->inField(6)) { // We're in a pub, and near the bar.
switch (_thing) {
case 51:
case 53:
case 54:
case 58: // Beer, whisky, cider or mead.
2013-09-06 16:23:57 +02:00
if (_vm->_gyro->_dna._malagauche == 177) { // Already getting us one.
_vm->_visa->displayScrollChain('D', 15);
2013-06-29 15:56:08 +02:00
return;
}
2013-09-06 16:23:57 +02:00
if (_vm->_gyro->_dna._teetotal) {
_vm->_visa->displayScrollChain('D', 6);
2013-06-29 15:56:08 +02:00
return;
}
2013-09-06 16:23:57 +02:00
if (_vm->_gyro->_dna._alcoholLevel == 0)
_vm->_lucerna->incScore(3);
2013-09-03 22:22:42 +02:00
_vm->_celer->drawBackgroundSprite(-1, -1, 12);
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText(booze[_thing - 51] + ", please." + _vm->_scrolls->kControlRegister + '1' + _vm->_scrolls->kControlSpeechBubble);
2013-09-06 16:23:57 +02:00
_vm->_gyro->_dna._drinking = _thing;
2013-06-29 15:56:08 +02:00
2013-09-03 22:22:42 +02:00
_vm->_celer->drawBackgroundSprite(-1, -1, 10);
2013-09-06 16:23:57 +02:00
_vm->_gyro->_dna._malagauche = 177;
2013-09-08 11:30:23 +02:00
_vm->_timer->addTimer(27, _vm->_timer->kProcBuyDrinks, _vm->_timer->kReasonDrinks);
break;
case 52:
2013-06-29 15:56:08 +02:00
examine();
break; // We have a right one here - buy Pepsi??!
2013-09-06 16:23:57 +02:00
case Gyro::kObjectWine:
if (_vm->_gyro->_dna._objects[_vm->_gyro->kObjectWine - 1]) // We've already got the wine!
_vm->_visa->displayScrollChain('D', 2); // 1 bottle's shufishent!
2013-06-29 15:56:08 +02:00
else {
2013-09-06 16:23:57 +02:00
if (_vm->_gyro->_dna._malagauche == 177) { // Already getting us one.
_vm->_visa->displayScrollChain('D', 15);
2013-06-29 15:56:08 +02:00
return;
}
2013-09-06 16:23:57 +02:00
if (_vm->_gyro->_dna._carryNum >= kCarryLimit) {
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("Your hands are full.");
2013-06-29 15:56:08 +02:00
return;
}
2013-09-03 22:22:42 +02:00
_vm->_celer->drawBackgroundSprite(-1, -1, 12);
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText(Common::String("Wine, please.") + _vm->_scrolls->kControlRegister + '1' + _vm->_scrolls->kControlSpeechBubble);
2013-09-06 16:23:57 +02:00
if (_vm->_gyro->_dna._alcoholLevel == 0)
_vm->_lucerna->incScore(3);
2013-09-03 22:22:42 +02:00
_vm->_celer->drawBackgroundSprite(-1, -1, 10);
2013-09-06 16:23:57 +02:00
_vm->_gyro->_dna._malagauche = 177;
2013-06-29 15:56:08 +02:00
2013-09-08 11:30:23 +02:00
_vm->_timer->addTimer(27, _vm->_timer->kProcBuyWine, _vm->_timer->kReasonDrinks);
2013-06-29 15:56:08 +02:00
}
break;
}
} else
_vm->_visa->displayScrollChain('D', 5); // Go to the bar!
break;
2013-06-29 15:56:08 +02:00
case r__outsideducks:
if (_vm->_animation->inField(6)) {
2013-09-06 16:23:57 +02:00
if (_thing == _vm->_gyro->kObjectOnion) {
if (_vm->_gyro->_dna._objects[_vm->_gyro->kObjectOnion - 1])
_vm->_visa->displayScrollChain('D', 10); // Not planning to juggle with the things!
2013-09-06 16:23:57 +02:00
else if (_vm->_gyro->_dna._carryNum >= kCarryLimit)
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("Before you ask, you remember that your hands are full.");
2013-06-29 15:56:08 +02:00
else {
2013-09-06 16:23:57 +02:00
if (_vm->_gyro->_dna._boughtOnion)
_vm->_visa->displayScrollChain('D', 11);
2013-06-29 15:56:08 +02:00
else {
_vm->_visa->displayScrollChain('D', 9);
_vm->_lucerna->incScore(3);
2013-06-29 15:56:08 +02:00
}
_vm->_gyro->decreaseMoney(3); // It costs thruppence.
2013-09-06 16:23:57 +02:00
_vm->_gyro->_dna._objects[_vm->_gyro->kObjectOnion - 1] = true;
_vm->_lucerna->refreshObjectList();
2013-09-06 16:23:57 +02:00
_vm->_gyro->_dna._boughtOnion = true;
_vm->_gyro->_dna._rottenOnion = false; // It's OK when it leaves the stall!
_vm->_gyro->_dna._onionInVinegar = false;
2013-06-29 15:56:08 +02:00
}
} else
_vm->_visa->displayScrollChain('D', 0);
} else
_vm->_visa->displayScrollChain('D', 0);
2013-06-29 15:56:08 +02:00
break;
case r__nottspub:
_vm->_visa->displayScrollChain('n', 15); // Can't sell to southerners.
break;
2013-06-29 15:56:08 +02:00
default:
_vm->_visa->displayScrollChain('D', 0); // Can't buy that.
2013-06-29 15:56:08 +02:00
}
break;
case kVerbCodeAttack:
2013-09-06 16:23:57 +02:00
if ((_vm->_gyro->_dna._room == r__brummieroad) &&
((_person == 157) || (_thing == _vm->_gyro->kObjectCrossbow) || (_thing == _vm->_gyro->kObjectBolt))
&& (_vm->_gyro->_whereIs[7] == _vm->_gyro->_dna._room)) {
switch (_vm->_gyro->_dna._objects[_vm->_gyro->kObjectBolt - 1] + _vm->_gyro->_dna._objects[_vm->_gyro->kObjectCrossbow - 1] * 2) {
// 0 = neither, 1 = only bolt, 2 = only crossbow, 3 = both.
case 0:
_vm->_visa->displayScrollChain('Q', 10);
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("(At the very least, don't use your bare hands!)");
break;
2013-06-29 15:56:08 +02:00
case 1:
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("Attack _vm->_gyro->him with only a crossbow bolt? Are you planning on playing darts?!");
2013-06-29 15:56:08 +02:00
break;
case 2:
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("Come on, Avvy! You're not going to get very far with only a crossbow!");
2013-06-29 15:56:08 +02:00
break;
case 3:
_vm->_visa->displayScrollChain('Q', 11);
2013-09-06 16:23:57 +02:00
_vm->_gyro->_dna._cwytalotGone = true;
_vm->_gyro->_dna._objects[_vm->_gyro->kObjectBolt - 1] = false;
_vm->_gyro->_dna._objects[_vm->_gyro->kObjectCrossbow - 1] = false;
_vm->_lucerna->refreshObjectList();
2013-09-06 16:23:57 +02:00
_vm->_gyro->_magics[11]._operation = _vm->_gyro->kMagicNothing;
_vm->_lucerna->incScore(7);
_vm->_animation->_sprites[1].walkTo(2);
_vm->_animation->_sprites[1]._vanishIfStill = true;
_vm->_animation->_sprites[1]._callEachStepFl = false;
2013-09-05 23:57:58 +02:00
_vm->_gyro->_whereIs[7] = 177;
break;
2013-06-29 15:56:08 +02:00
default:
_vm->_visa->displayScrollChain('Q', 10); // Please try not to be so violent!
2013-06-29 15:56:08 +02:00
}
} else
_vm->_visa->displayScrollChain('Q', 10);
break;
2013-09-04 14:56:05 +02:00
case kVerbCodePasswd:
2013-09-06 16:23:57 +02:00
if (_vm->_gyro->_dna._room != r__bridge)
_vm->_visa->displayScrollChain('Q', 12);
2013-06-29 15:56:08 +02:00
else {
bool ok = true;
for (byte i = 0; i < _thats.size(); i++) {
Common::String temp = _realWords[i];
temp.toUppercase();
2013-09-06 16:23:57 +02:00
for (byte j = 0; j < kVocabulary[_vm->_gyro->_dna._passwordNum + kFirstPassword]._word.size(); j++) {
if (kVocabulary[_vm->_gyro->_dna._passwordNum + kFirstPassword]._word[j] != temp[j])
2013-06-29 15:56:08 +02:00
ok = false;
2013-09-04 18:34:58 +02:00
}
}
2013-06-29 15:56:08 +02:00
if (ok) {
2013-09-06 16:23:57 +02:00
if (_vm->_gyro->_dna._drawbridgeOpen != 0)
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("Contrary to your expectations, the drawbridge fails to close again.");
2013-06-29 15:56:08 +02:00
else {
_vm->_lucerna->incScore(4);
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("The drawbridge opens!");
2013-09-08 11:30:23 +02:00
_vm->_timer->addTimer(7, _vm->_timer->kProcOpenDrawbridge, _vm->_timer->kReasonDrawbridgeFalls);
2013-09-06 16:23:57 +02:00
_vm->_gyro->_dna._drawbridgeOpen = 1;
2013-06-29 15:56:08 +02:00
}
} else
_vm->_visa->displayScrollChain('Q', 12);
2013-06-29 15:56:08 +02:00
}
break;
case kVerbCodeDir:
_vm->_enid->dir(_realWords[1]);
2013-06-29 15:56:08 +02:00
break;
case kVerbCodeDie:
_vm->_lucerna->gameOver();
2013-06-29 15:56:08 +02:00
break;
case kVerbCodeScore: {
Common::String tmpStr = Common::String::format("Your score is %d,%c%cout of a possible 128.%c%cThis gives you a rank of %s.%c%c%s", _vm->_gyro->_dna._score, Scrolls::kControlCenter, Scrolls::kControlNewLine, Scrolls::kControlNewLine, Scrolls::kControlNewLine, rank().c_str(), Scrolls::kControlNewLine, Scrolls::kControlNewLine, totalTime().c_str());
_vm->_scrolls->displayText(tmpStr);
}
2013-06-29 15:56:08 +02:00
break;
case kVerbCodePut:
putProc();
2013-06-29 15:56:08 +02:00
break;
case kVerbCodeStand:
standUp();
2013-06-29 15:56:08 +02:00
break;
case kVerbCodeKiss:
if (_person == kPardon)
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("Kiss whom?");
else if (isPersonHere()) {
switch (_person) {
2013-09-06 16:23:57 +02:00
case Gyro::kPeopleArkata:
_vm->_visa->displayScrollChain('U', 12);
2013-06-29 15:56:08 +02:00
break;
2013-09-06 16:23:57 +02:00
case Gyro::kPeopleGeida:
_vm->_visa->displayScrollChain('U', 13);
2013-06-29 15:56:08 +02:00
break;
2013-09-06 16:23:57 +02:00
case Gyro::kPeopleWisewoman:
_vm->_visa->displayScrollChain('U', 14);
2013-06-29 15:56:08 +02:00
break;
default:
_vm->_visa->displayScrollChain('U', 5); // You WHAT?
2013-06-29 15:56:08 +02:00
}
} else if ((150 <= _person) && (_person <= 174))
_vm->_scrolls->displayText("Hey, what kind of a weirdo are you??");
2013-06-29 15:56:08 +02:00
break;
case kVerbCodeClimb:
2013-09-06 16:23:57 +02:00
if (_vm->_gyro->_dna._room == r__insidecardiffcastle)
cardiffClimbing();
else // In the wrong room!
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("Not with your head for heights, Avvy!");
2013-06-29 15:56:08 +02:00
break;
case kVerbCodeJump:
2013-09-08 11:30:23 +02:00
_vm->_timer->addTimer(1, _vm->_timer->kProcJump, _vm->_timer->kReasonJumping);
2013-09-06 16:23:57 +02:00
_vm->_gyro->_dna._userMovesAvvy = false;
break;
2013-09-04 14:56:05 +02:00
case kVerbCodeHiscores:
2013-06-29 15:56:08 +02:00
// show_highs();
warning("STUB: Acci::doThat() - case kVerbCodehighscores");
2013-06-29 15:56:08 +02:00
break;
case kVerbCodeWake:
if (isPersonHere())
switch (_person) {
case kPardon:
2013-09-06 16:23:57 +02:00
case Gyro::kPeopleAvalot:
case 0:
2013-09-06 16:23:57 +02:00
if (!_vm->_gyro->_dna._avvyIsAwake) {
_vm->_gyro->_dna._avvyIsAwake = true;
_vm->_lucerna->incScore(1);
2013-09-06 16:23:57 +02:00
_vm->_gyro->_dna._avvyInBed = true;
_vm->_celer->drawBackgroundSprite(-1, -1, 3); // Picture of Avvy, awake in bed.
2013-09-06 16:23:57 +02:00
if (_vm->_gyro->_dna._teetotal)
_vm->_visa->displayScrollChain('d', 13);
} else
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("You're already awake, Avvy!");
2013-06-29 15:56:08 +02:00
break;
2013-09-06 16:23:57 +02:00
case Gyro::kPeopleAyles:
if (!_vm->_gyro->_dna._aylesIsAwake)
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("You can't seem to wake him by yourself.");
2013-06-29 15:56:08 +02:00
break;
2013-09-06 16:23:57 +02:00
case Gyro::kPeopleJacques:
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText(Common::String("Brother Jacques, Brother Jacques, are you asleep?") + _vm->_scrolls->kControlRegister + '1' +
_vm->_scrolls->kControlSpeechBubble + "Hmmm... that doesn't seem to do any good...");
2013-06-29 15:56:08 +02:00
break;
default:
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("It's difficult to awaken people who aren't asleep...!");
2013-06-29 15:56:08 +02:00
}
break;
case kVerbCodeSit:
2013-09-06 16:23:57 +02:00
if (_vm->_gyro->_dna._room == r__nottspub) {
if (_vm->_gyro->_dna._sittingInPub)
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText("You're already sitting!");
2013-06-29 15:56:08 +02:00
else {
_vm->_animation->_sprites[0].walkTo(4); // Move Avvy to the place, and sit him down.
2013-09-08 11:30:23 +02:00
_vm->_timer->addTimer(1, _vm->_timer->kProcAvvySitDown, _vm->_timer->kReasonSittingDown);
2013-06-29 15:56:08 +02:00
}
} else { // Default doodah.
_vm->_lucerna->dusk();
2013-09-06 16:23:57 +02:00
_vm->_gyro->hangAroundForAWhile();
_vm->_lucerna->dawn();
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText(Common::String("A few hours later...") + _vm->_scrolls->kControlParagraph + "nothing much has happened...");
2013-06-29 15:56:08 +02:00
}
break;
case kVerbCodeRestart:
2013-09-07 20:37:42 +02:00
if (_vm->_scrolls->displayQuestion("Restart game and lose changes?")) {
_vm->_lucerna->dusk();
2013-09-06 16:23:57 +02:00
_vm->_gyro->newGame();
_vm->_lucerna->dawn();
2013-06-29 15:56:08 +02:00
}
break;
case kPardon:
_vm->_scrolls->displayText("Hey, a verb would be helpful!");
2013-06-29 15:56:08 +02:00
break;
case kVerbCodeHello:
personSpeaks();
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText(Common::String("Hello.") + _vm->_scrolls->kControlSpeechBubble);
break;
case kVerbCodeThanks:
personSpeaks();
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText(Common::String("That's OK.") + _vm->_scrolls->kControlSpeechBubble);
break;
2013-06-29 15:56:08 +02:00
default:
2013-09-07 20:37:42 +02:00
_vm->_scrolls->displayText(Common::String(_vm->_scrolls->kControlBell) + "Parser bug!");
2013-06-29 15:56:08 +02:00
}
}
void Acci::verbOpt(byte verb, Common::String &answer, char &ansKey) {
switch (verb) {
case kVerbCodeExam:
2013-06-29 15:56:08 +02:00
answer = "Examine";
2013-09-04 12:35:26 +02:00
ansKey = 'x';
break; // The ubiquitous one.
// kVerbCodegive isn't dealt with by this procedure, but by ddm__with.
case kVerbCodeDrink:
2013-06-29 15:56:08 +02:00
answer = "Drink";
ansKey = 'D';
break;
case kVerbCodeWear:
2013-06-29 15:56:08 +02:00
answer = "Wear";
ansKey = 'W';
break;
case kVerbCodeRing:
2013-06-29 15:56:08 +02:00
answer = "Ring";
ansKey = 'R';
break; // Only the bell!
case kVerbCodePlay:
2013-06-29 15:56:08 +02:00
answer = "Play";
ansKey = 'P';
break;
case kVerbCodeEat:
2013-06-29 15:56:08 +02:00
answer = "Eat";
ansKey = 'E';
break;
default:
answer = "? Unknown!"; // Bug!
ansKey = '?';
2013-06-29 15:56:08 +02:00
}
}
} // End of namespace Avalanche.