ScummVM API documentation
words.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
#ifndef AGI_WORDS_H
23
#define AGI_WORDS_H
24
25
namespace
Agi
{
26
27
#define DICTIONARY_RESULT_UNKNOWN -1
28
#define DICTIONARY_RESULT_IGNORE 0
29
30
#define EXTENDED_DICTIONARY_FILENAME "words.tok.extended"
31
32
struct
WordEntry
{
33
uint16 id;
34
Common::String
word;
35
};
36
37
class
Words
{
38
public
:
39
Words
(
AgiEngine
*vm);
40
~
Words
();
41
42
private
:
43
AgiEngine
*_vm;
44
45
// Dictionary of words in WORDS.TOK or WORDS.TOK.EXTENDED.
46
// key: first character of the word
47
// value: words in the order they appear
48
Common::HashMap<byte, Common::Array<WordEntry>
> _dictionary;
49
50
WordEntry
_egoWords[MAX_WORDS];
51
uint16 _egoWordCount;
52
53
bool
_hasExtendedCharacters;
// true on WORDS.TOK.EXTENDED
54
public
:
55
uint16 getEgoWordCount()
const
;
56
const
char
*getEgoWord(int16 wordNr)
const
;
57
uint16 getEgoWordId(int16 wordNr)
const
;
58
59
int
loadDictionary_v1(
Common::SeekableReadStream
&stream);
60
int
loadDictionary(
const
char
*fname);
61
int
loadDictionary(
Common::SeekableReadStream
&stream);
62
// used for fan made translations requiring extended char set
63
int
loadExtendedDictionary(
const
char
*fname);
64
void
unloadDictionary();
65
66
void
clearEgoWords();
67
void
parseUsingDictionary(
const
char
*rawUserInput);
68
69
private
:
70
void
cleanUpInput(
const
char
*userInput,
Common::String
&cleanInput);
71
int16 findWordInDictionary(
const
Common::String
&userInputLowercase, uint16 userInputLen, uint16 userInputPos, uint16 &foundWordLen);
72
73
bool
handleSpeedCommands(
const
Common::String
&userInputLowercase);
74
static
void
convertRussianUserInput(
Common::String
&userInputLowercase);
75
};
76
77
}
// End of namespace Agi
78
79
#endif
/* AGI_WORDS_H */
Common::String
Definition:
str.h:59
Common::SeekableReadStream
Definition:
stream.h:745
Common::HashMap
Definition:
hashmap.h:85
Agi::AgiEngine
Definition:
agi.h:699
Agi::WordEntry
Definition:
words.h:32
Agi::Words
Definition:
words.h:37
Agi
Definition:
agi.h:64
engines
agi
words.h
Generated on Mon Mar 9 2026 09:10:29 for ScummVM API documentation by
1.8.13