ScummVM API documentation
parser.h
1/* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22/*
23 * This code is based on the original source code of Lord Avalot d'Argent version 1.3.
24 * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman.
25 */
26
27#ifndef AVALANCHE_PARSER_H
28#define AVALANCHE_PARSER_H
29
30#include "avalanche/enums.h"
31
32#include "common/events.h"
33#include "common/str.h"
34#include "common/serializer.h"
35
36namespace Avalanche {
37class AvalancheEngine;
38
39class Parser {
40public:
41 static const int16 kParserWordsNum = 277; // How many words does the parser know?
42 static const int16 kFirstPassword = 88; // words[kFirstPassword] should equal "TIROS".
43 static const byte kPardon = 254; // Didn't understand / wasn't given.
44 static const byte kNothing = 250;
45 static const byte kMoved = 0; // This word was moved. (Usually because it was the subject of conversation.)
46
47 struct VocabEntry {
48 byte _number;
49 Common::String _word;
50
51 void init(byte number, Common::String word) {
52 _number = number;
53 _word = word;
54 }
55 };
56
57 VocabEntry _vocabulary[kParserWordsNum];
58
59 Common::String _realWords[11];
60 VerbCode _verb;
61 byte _thing;
62 People _person;
63 bool _polite;
64 Common::String _inputText;
65 Common::String _inputTextBackup;
66 byte _inputTextPos;
67 bool _quote;
68 bool _cursorState;
69 bool _weirdWord;
70
71 byte _wearing; // what you're wearing
72
74 void init();
75 void parse();
76 void doThat();
77 void verbOpt(byte verb, Common::String &answer, char &ansKey);
78 void drink();
79 void handleInputText(const Common::Event &event);
80 void handleBackspace();
81 void handleReturn();
82 void handleFunctionKey(const Common::Event &event);
83 void plotText();
84 void cursorOn();
85 void cursorOff();
86 void tryDropdown();
87 int16 getPos(const Common::String &crit, const Common::String &src);
88 void doVerb(VerbCode id);
89 Common::String rank();
90 void resetVariables();
91 void synchronize(Common::Serializer &sz);
92
93private:
94 AvalancheEngine *_vm;
95
96 struct RankType {
97 uint16 _score;
98 char _title[20];
99 };
100
101 static const char *kCopyright;
102 static const char *kVersionNum;
103
104 Common::String _thats;
105 byte _thing2;
106 byte _sworeNum; // number of times you've sworn
107 byte _alcoholLevel; // Your blood alcohol level.
108 bool _boughtOnion; // Have you bought an onion yet?
109
110 byte wordNum(Common::String word);
111 void replace(Common::String oldChars, byte newChar);
112 Common::String totalTime();
113 void clearWords();
114 void cheatParse(Common::String codes);
115 void stripPunctuation(Common::String &word);
116 void displayWhat(byte target, bool animate, bool &ambiguous);
117 bool doPronouns();
118 void properNouns();
119 void lookAround();
120 void openDoor();
121 void storeInterrogation(byte interrogation);
122 void examineObject();
123 bool isPersonHere();
124 void exampers();
125 bool isHolding();
126 void openBox(bool isOpening);
127 void examine();
128 void inventory();
129 void swallow();
130 void peopleInRoom();
131 void putProc();
132 void notInOrder();
133 void goToCauldron();
134 bool giveToSpludwick();
135 void cardiffClimbing();
136 void already();
137 void standUp();
138 void getProc(char thing);
139 void giveGeidaTheLute();
140 void playHarp();
141 void winSequence();
142 void wipeText();
143 void bossKey();
144};
145
146} // End of namespace Avalanche
147
148#endif // AVALANCHE_PARSER_H
Definition: avalanche.h:78
Definition: parser.h:39
Definition: serializer.h:80
Definition: str.h:59
Definition: parser.h:47
Definition: events.h:218