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 
28 namespace Harvester {
29 
30 class ResourceManager;
31 
33  int wavId = 0;
34  uint32 textOffset = 0;
35  uint32 textLength = 0;
36 };
37 
39  Common::String path;
40  Common::String name;
41  Common::Array<byte> header;
42  uint32 atlasWidth = 0;
43  uint32 atlasHeight = 0;
44  Common::Array<byte> atlasPixels;
45 };
46 
47 class Text {
48 public:
49  bool load(ResourceManager &resources);
50 
51  const Common::Array<byte> &getDialogueData() const { return _dialogueData; }
52  const Common::Array<DialogueIndexEntry> &getDialogueEntries() const { return _dialogueEntries; }
53  const Common::Array<Common::String> &getDialogueResponseLines() const { return _dialogueResponseLines; }
54  const Common::Array<CftFontResource> &getFonts() const { return _fonts; }
55  bool resolveDialogueSubtitle(int wavId, Common::String &text) const;
56  Common::String getDialogueResponseLine(int zeroBasedIndex) const;
57 
58 private:
59  bool loadDialogueIndex(ResourceManager &resources);
60  bool loadDialogueResponses(ResourceManager &resources);
61  bool loadFont(ResourceManager &resources, const Common::String &path);
62  void decodeXorText(Common::Array<byte> &data) const;
63 
64  Common::Array<byte> _dialogueData;
65  Common::Array<DialogueIndexEntry> _dialogueEntries;
66  Common::Array<Common::String> _dialogueResponseLines;
68 };
69 
70 } // End of namespace Harvester
71 
72 #endif // HARVESTER_TEXT_H
Definition: str.h:59
Definition: art.h:31
Definition: text.h:47
Definition: text.h:38
Definition: resources.h:32
Definition: text.h:32