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 HARVESTER_TEXT_H
23#define HARVESTER_TEXT_H
24
25#include "common/array.h"
26#include "common/str.h"
27
28namespace Graphics {
29class Font;
30}
31
32namespace Harvester {
33
34class ResourceManager;
35
36bool appendTextEntryCharacter(Common::String &text, const Graphics::Font &font,
37 uint32 character, uint maxCharacters, int maxWidth);
38bool deleteTextEntryCharacter(Common::String &text);
39
41 int wavId = 0;
42 uint32 textOffset = 0;
43 uint32 textLength = 0;
44};
45
47 Common::String path;
48 Common::String name;
50 uint32 atlasWidth = 0;
51 uint32 atlasHeight = 0;
52 Common::Array<byte> atlasPixels;
53};
54
55class Text {
56public:
57 bool load(ResourceManager &resources);
58
59 const Common::Array<byte> &getDialogueData() const { return _dialogueData; }
60 const Common::Array<DialogueIndexEntry> &getDialogueEntries() const { return _dialogueEntries; }
61 const Common::Array<Common::String> &getDialogueResponseLines() const { return _dialogueResponseLines; }
62 const CftFontResource *findFont(const char *fontName) const;
63 bool resolveDialogueSubtitle(int wavId, Common::String &text) const;
64 Common::String getDialogueResponseLine(int zeroBasedIndex) const;
65
66private:
67 bool loadDialogueIndex(ResourceManager &resources);
68 bool loadDialogueResponses(ResourceManager &resources);
69 bool loadFont(ResourceManager &resources, const Common::String &path);
70 void decodeXorText(Common::Array<byte> &data) const;
71
72 Common::Array<byte> _dialogueData;
73 Common::Array<DialogueIndexEntry> _dialogueEntries;
74 Common::Array<Common::String> _dialogueResponseLines;
75 bool _dialogueResponsesEndWithNewline = true;
77};
78
79} // End of namespace Harvester
80
81#endif // HARVESTER_TEXT_H
Definition: str.h:59
Definition: font.h:83
Definition: resources.h:32
Definition: text.h:55
Definition: formatinfo.h:28
Definition: text.h:46
Definition: text.h:40