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
struct
WordEntry
{
31
uint16 id;
32
Common::String
word;
33
};
34
35
class
Words
{
36
public
:
37
Words
(
AgiEngine
*vm);
38
~
Words
();
39
40
private
:
41
AgiEngine
*_vm;
42
43
// Dictionary
44
// 158 = 255 - 'a' ; that's allows us to support extended character set, and does no harm for regular English games
45
Common::Array<WordEntry *>
_dictionaryWords[158];
46
47
WordEntry
_egoWords[MAX_WORDS];
48
uint16 _egoWordCount;
49
50
public
:
51
uint16 getEgoWordCount()
const
;
52
const
char
*getEgoWord(int16 wordNr)
const
;
53
uint16 getEgoWordId(int16 wordNr)
const
;
54
55
int
loadDictionary_v1(
Common::SeekableReadStream
&stream);
56
int
loadDictionary(
const
char
*fname);
57
int
loadDictionary(
Common::SeekableReadStream
&stream);
58
// used for fan made translations requiring extended char set
59
int
loadExtendedDictionary(
const
char
*fname);
60
void
unloadDictionary();
61
62
void
clearEgoWords();
63
void
parseUsingDictionary(
const
char
*rawUserInput);
64
65
private
:
66
void
cleanUpInput(
const
char
*userInput,
Common::String
&cleanInput);
67
int16 findWordInDictionary(
const
Common::String
&userInputLowercase, uint16 userInputLen, uint16 userInputPos, uint16 &foundWordLen);
68
69
bool
handleSpeedCommands(
const
Common::String
&userInputLowercase);
70
static
void
convertRussianUserInput(
Common::String
&userInputLowercase);
71
};
72
73
}
// End of namespace Agi
74
75
#endif
/* AGI_WORDS_H */
Common::String
Definition:
str.h:59
Common::Array
Definition:
array.h:52
Common::SeekableReadStream
Definition:
stream.h:745
Agi::AgiEngine
Definition:
agi.h:839
Agi::WordEntry
Definition:
words.h:30
Agi::Words
Definition:
words.h:35
Agi
Definition:
agi.h:63
engines
agi
words.h
Generated on Thu Nov 14 2024 09:09:54 for ScummVM API documentation by
1.8.13