aboutsummaryrefslogtreecommitdiff
path: root/engines/avalanche/acci2.h
blob: 2a97b9852998f0646bea17b249273ae7912135be (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
214
215
216
217
/* 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:
		/* verb codes */
	static const byte vb_exam = 1;
	static const byte vb_open = 2;
	static const byte vb_pause = 3;
	static const byte vb_get = 4;
	static const byte vb_drop = 5;
	static const byte vb_inv = 6;
	static const byte vb_talk = 7;
	static const byte vb_give = 8;
	static const byte vb_drink = 9;
	static const byte vb_load = 10;
	static const byte vb_save = 11;
	static const byte vb_pay = 12;
	static const byte vb_look = 13;
	static const byte vb_break = 14;
	static const byte vb_quit = 15;
	static const byte vb_sit = 16;
	static const byte vb_stand = 17;
	static const byte vb_go = 18;
	static const byte vb_info = 19;
	static const byte vb_undress = 20;
	static const byte vb_wear = 21;
	static const byte vb_play = 22;
	static const byte vb_ring = 23;
	static const byte vb_help = 24;
	static const byte vb_larrypass = 25;
	static const byte vb_phaon = 26;
	static const byte vb_boss = 27;
	static const byte vb_pee = 28;
	static const byte vb_cheat = 29;
	static const byte vb_magic = 30;
	static const byte vb_restart = 31;
	static const byte vb_eat = 32;
	static const byte vb_listen = 33;
	static const byte vb_buy = 34;
	static const byte vb_attack = 35;
	static const byte vb_password = 36;
	static const byte vb_dir = 37;
	static const byte vb_die = 38;
	static const byte vb_score = 39;
	static const byte vb_put = 40;
	static const byte vb_kiss = 41;
	static const byte vb_climb = 42;
	static const byte vb_jump = 43;
	static const byte vb_highscores = 44;
	static const byte vb_wake = 45;
	static const byte vb_hello = 46;
	static const byte vb_thanks = 47;

	static const byte vb_smartalec = 249;
	static const byte vb_expletive = 253;

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

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

	static const int16 first_password = 89; // Words[first_password] should equal "TIROS".



	struct vocab {
		byte n;
		Common::String w;
	};

	static const vocab words[nowords];

	static const char what[];



	struct ranktype {
		uint16 score;
		Common::String title;
	};

	static const ranktype ranks[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();
	void opendoor();
	void do_that();
	void verbopt(char n, Common::String &answer, char &anskey);
	void have_a_drink();

private:
	AvalancheEngine *_vm;

	byte fv;

	byte wordnum(Common::String x);

	void replace(Common::String old1, byte new1);

	Common::String rank();

	Common::String totaltime();

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

	void punctustrip(Common::String &x);

	void displaywhat(byte ch, bool animate, bool &ambigous);
	bool do_pronouns();

	void lowercase();
	void propernouns();
	void sayit();
	void store_interrogation(byte interrogation);

	void clearuint16s();

	void examobj();

	bool personshere();

	void exampers();

	bool holding();

	void special(bool before);
	void examine();

	void inv();

	void swallow();

	void others();

	void silly();
	void putproc();

	void not_in_order();
	void go_to_cauldron();
	bool give2spludwick();

	void cardiff_climbing();

	void already();
	void stand_up();

	void getproc(char thing);

	void give_geida_the_lute();

	void play_harp();

	void winsequence();

	void person_speaks();

	void heythanks();

};

} // End of namespace Avalanche.

#endif // ACCI2_H