aboutsummaryrefslogtreecommitdiff
path: root/engines/avalanche/acci2.h
blob: e09c72ec221237f0382944ed655370803bd1ead8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
/* 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.
 */

/* ACCIDENCE II		The parser. */

#ifndef ACCI2_H
#define ACCI2_H

#include "common/scummsys.h"
#include "common/str.h"



namespace Avalanche {
class AvalancheEngine;

class Acci {
public:
	enum VerbCode {
		kVerbCodeExam = 1,
		kVerbCodeOpen = 2,
		kVerbCodePause = 3,
		kVerbCodeGet = 4,
		kVerbCodeDrop = 5,
		kVerbCodeInv = 6,
		kVerbCodeTalk = 7,
		kVerbCodeGive = 8,
		kVerbCodeDrink = 9,
		kVerbCodeLoad = 10,
		kVerbCodeSave = 11,
		kVerbCodePay = 12,
		kVerbCodeLook = 13,
		kVerbCodeBreak = 14,
		kVerbCodeQuit = 15,
		kVerbCodeSit = 16,
		kVerbCodeStand = 17,
		kVerbCodeGo = 18,
		kVerbCodeInfo = 19,
		kVerbCodeUndress = 20,
		kVerbCodeWear = 21,
		kVerbCodePlay = 22,
		kVerbCodeRing = 23,
		kVerbCodeHelp = 24,
		kVerbCodeLarrypass = 25,
		kVerbCodePhaon = 26,
		kVerbCodeBoss = 27,
		kVerbCodePee = 28,
		kVerbCodeCheat = 29,
		kVerbCodeMagic = 30,
		kVerbCodeRestart = 31,
		kVerbCodeEat = 32,
		kVerbCodeListen = 33,
		kVerbCodeBuy = 34,
		kVerbCodeAttack = 35,
		kVerbCodePassword = 36,
		kVerbCodeDir = 37,
		kVerbCodeDie = 38,
		kVerbCodeScore = 39,
		kVerbCodePut = 40,
		kVerbCodeKiss = 41,
		kVerbCodeClimb = 42,
		kVerbCodeJump = 43,
		kVerbCodeHighscores = 44,
		kVerbCodeWake = 45,
		kVerbCodeHello = 46,
		kVerbCodeThanks = 47,
		kVerbCodeSmartAlec = 249,
		kVerbCodeExpletive = 253,
	};

	static const byte kPardon = 254; // Didn't understand / wasn't given.

	static const int16 kParserWordsNum = 277; // How many words does the parser know?
	static const byte kNothing = 250;
	static const byte kMoved = 0; // This word was moved. (Usually because it was the subject of conversation.)

	static const int16 kFirstPassword = 88; // words[kFirstPassword] should equal "TIROS".



	struct VocabEntry {
		byte _number;
		Common::String _word;
	};

	static const VocabEntry kVocabulary[kParserWordsNum];

	static const char kWhat[];



	struct RankType {
		uint16 _score;
		Common::String _title;
	};

	static const RankType kRanks[9];



	Common::String _thats;
	Common::String _unknown;
	Common::String _realWords[11];
	byte _verb, _person, _thing, _thing2;
	bool _polite;




	Acci(AvalancheEngine *vm);

	void init();

	void clearWords();
	void parse();
	void lookAround(); // This is called when you say "look".
	void openDoor();
	void doThat();
	void verbOpt(byte verb, Common::String &answer, char &ansKey);
	void drink();

private:
	AvalancheEngine *_vm;

	byte fv;

	byte wordNum(Common::String word);
	void replace(Common::String oldChars, byte newChar);

	Common::String rank();
	Common::String totalTime();

	void number(Common::String &codes);
	void cheatParse(Common::String codes);

	void stripPunctuation(Common::String &word); // Strips punctuation from word.

	void displayWhat(byte target, bool animate, bool &ambiguous); // << It's an adjective!
	bool doPronouns();

	void properNouns();
	void sayIt();  // This makes Avalot say the response.
	void storeInterrogation(byte interrogation);

	void examineObject(); // Examine a standard object-thing

	bool isPersonHere();

	void exampers();

	bool holding();

	void openBox(bool isOpening);
	void examine();

	void inventory();

	void swallow();

	void peopleInRoom(); // This lists the other people in the room.

	void silly();
	void putProc();  // Called when you call kVerbCodeput.

	void notInOrder();
	void goToCauldron();
	bool giveToSpludwick(); // The result of this fn is whether or not he says "Hey, thanks!".

	void cardiffClimbing();

	void already();
	void standUp(); // Called when you ask Avvy to stand.

	void getProc(char thing);

	void giveGeidaTheLute();

	void playHarp();

	void winSequence();

	void personSpeaks();

	void heyThanks();
};

} // End of namespace Avalanche.

#endif // ACCI2_H