ScummVM API documentation
words_dictionary.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 AGS_SHARED_AC_WORDS_DICTIONARY_H
23#define AGS_SHARED_AC_WORDS_DICTIONARY_H
24
25#include "common/std/vector.h"
26#include "ags/shared/core/types.h"
27#include "ags/shared/util/string.h"
28
29namespace AGS3 {
30
31namespace AGS {
32namespace Shared {
33class Stream;
34} // namespace Shared
35} // namespace AGS
36
37using namespace AGS; // FIXME later
38
39#define MAX_PARSER_WORD_LENGTH 30
40#define ANYWORD 29999
41#define RESTOFLINE 30000
42
44 int num_words;
45 char **word;
46 short *wordnum;
47
50 void allocate_memory(int wordCount);
51 void free_memory();
52 void sort();
53 int find_index(const char *);
54};
55
56// Decrypts text found in the given buffer, writes back to the same buffer
57extern void decrypt_text(char *buf, size_t buf_sz);
58// Reads an encrypted string from the stream and decrypts into the provided buffer
59extern void read_string_decrypt(Shared::Stream *in, char *buf, size_t buf_sz);
60// Reads an encrypted string from the stream and returns as a string;
61// uses provided vector as a temporary decryption buffer (avoid extra allocs)
62extern Shared::String read_string_decrypt(Shared::Stream *in, std::vector<char> &dec_buf);
63extern void read_dictionary(WordsDictionary *dict, Shared::Stream *in);
64
65#if defined (OBSOLETE)
66// TODO: not a part of wordsdictionary, move to obsoletes
67extern void freadmissout(short *pptr, Shared::Stream *in);
68#endif
69
70extern void encrypt_text(char *toenc);
71extern void write_string_encrypt(Shared::Stream *out, const char *s);
72extern void write_dictionary(WordsDictionary *dict, Shared::Stream *out);
73
74} // namespace AGS3
75
76#endif
Definition: stream.h:52
Definition: string.h:60
Definition: words_dictionary.h:43