ScummVM API documentation
text.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 MADS_CORE_TEXT_H
23#define MADS_CORE_TEXT_H
24
25#include "mads/core/general.h"
26
27namespace MADS {
28
29
30#define TEXT_FILENAME "*MESSAGES"
31#define TEXT_SOURCE ".TXT"
32#define TEXT_COMPILED ".DAT"
33#define TEXT_HEADER ".H"
34
35#define TEXT_MARKER "text_"
36#define TEXT_COMMENT ';'
37#define TEXT_COMMAND '['
38#define TEXT_CLOSE_COMMAND ']'
39
40/* Allowable commands in file */
41#define TEXT_COMMAND_TITLE "TITLE"
42#define TEXT_COMMAND_CENTER "CENTER"
43#define TEXT_COMMAND_CR "CR"
44#define TEXT_COMMAND_ASK "ASK"
45#define TEXT_COMMAND_WIDTH "WIDTH"
46#define TEXT_COMMAND_VERB "VERB"
47#define TEXT_COMMAND_NOUN1 "NOUN1"
48#define TEXT_COMMAND_NOUN2 "NOUN2"
49#define TEXT_COMMAND_PREP "PREP"
50#define TEXT_COMMAND_SENTENCE "SENTENCE"
51#define TEXT_COMMAND_BAR "BAR"
52#define TEXT_COMMAND_UNDER "UNDER"
53#define TEXT_COMMAND_DOWN "DOWN"
54#define TEXT_COMMAND_TAB "TAB"
55#define TEXT_COMMAND_INDEX "INDEX"
56#define TEXT_COMMAND_NUMBER "NUMBER"
57#define TEXT_COMMAND_NUMBERX "NUMBERX"
58#define TEXT_COMMAND_CHOICE "CHOICE"
59#define TEXT_COMMAND_XC "XC"
60#define TEXT_COMMAND_X "X"
61#define TEXT_COMMAND_YC "YC"
62#define TEXT_COMMAND_Y "Y"
63#define TEXT_COMMAND_ICON "ICON"
64#define TEXT_COMMAND_ICONC "ICONC"
65
66#define TEXT_COMMAND_OBJECT "OBJECT"
67#define TEXT_COMMAND_SUBJECT "SUBJECT"
68#define TEXT_COMMAND_DEMONSTRATIVE "DEMONSTRATIVE"
69#define TEXT_COMMAND_CUSTOM "CUSTOM"
70
71#define TEXT_MAX_INDEX 10
72
73#define TEXT_UPPER_ONLY 0
74#define TEXT_LOWER_ONLY 1
75#define TEXT_UPPER_AND_LOWER 2
76#define TEXT_AS_IS 3
77
78struct Text {
79 word length;
80 char text[1];
81};
82
83
85 int32 id;
86 uint32 file_offset;
87 word length;
88
89 static constexpr size_t SIZE = 4 + 4 + 2;
90 void load(Common::SeekableReadStream *src) {
91 src->readMultipleLE(id, file_offset, length);
92 }
93};
94
95typedef Text *TextPtr;
96
97
98extern int text_force_width; /* Force width externally */
99extern int text_default_width; /* Default width */
100extern int text_width; /* Last width used */
101
102extern int text_default_x; /* Force position externally */
103extern int text_default_y;
104extern int text_force_location; /* Forcing or optional? */
105
106extern int text_saves_screen; /* Text preserves screen */
107
108extern int text_index[TEXT_MAX_INDEX]; /* Indexed vocab words. */
109
110extern char text_filename[80]; /* Filename for text_load */
111extern char text_build_filename[80]; /* Filename for text_build */
112
113extern long text_last_id; /* Last text id loaded */
114extern int text_last_number; /* Last text number used */
115extern int text_last_num_entries; /* Number of entries */
116
117
118extern TextPtr text_load(long id);
119
120extern int text_build(int build_header);
121extern void text_copy_vocab(char **mark, int vocab_id);
122extern int text_show(long id);
123
124} // namespace MADS
125
126#endif
bool readMultipleLE(T &...values)
Definition: stream.h:696
Definition: stream.h:745
Definition: text.h:84
Definition: text.h:78