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 CHEWY_TEXT_H
23#define CHEWY_TEXT_H
24
25#include "common/list.h"
26#include "common/serializer.h"
27#include "chewy/atds.h"
28#include "chewy/chewy.h"
29#include "chewy/defines.h"
30#include "chewy/resource.h"
31
32namespace Chewy {
33
42enum MaxTextTypes {
43 kADSTextMax = 500, // 0 - 499
44 kATSTextMax = 100, // 500 - 599
45 kAADTextMax = 100, // 600 - 699
46 kINVTextMax = 140, // 700 - 849
47 kUSETextMax = 60 // 850 - 899
48};
49
53enum TextEntryMarkers {
54 kEndRow = 0x00,
55 kEndBlock = 0x0b,
56 kEndEntry = 0x0c,
57 kEndText = 0x0d,
58 kEndChunk = 0x0e
59 // There's also 0x0f, block end, which we don't use
60};
61
62#define VOICE_OFFSET 20
63
64struct TextEntry {
65 int16 _speechId;
66 Common::String _text;
67};
68
70
71#define ROOM_ATS_MAX 1000
72
73class Text : public Resource {
74public:
75 Text();
76 ~Text();
77
81 TextEntryList *getDialog(uint dialogNum, uint entryNum);
82
94 TextEntry *getText(uint chunk, uint entry, int type, int subEntry = -1);
95 Common::StringArray getTextArray(uint chunk, uint entry, int type, int subEntry = -1);
96 Common::String getTextEntry(uint chunk, uint entry, int type, int subEntry = -1);
97 int16 getLastSpeechId() { return _lastSpeechId; }
98
99 const char *strPos(const char *txtAdr, int16 pos);
100
101 void syncHotspotStrings(Common::Serializer &s);
102 void syncInventoryStrings(Common::Serializer &s);
103 void syncInventoryUseStrings(Common::Serializer &s);
104
105 bool getControlBit(int16 txtNr, int16 bitIdx);
106 void setControlBit(int16 txtNr, int16 bitIdx);
107 void delControlBit(int16 txtNr, int16 bitIdx);
108
109 void setSubtextNum(uint16 entry, int8 txtMode, uint8 strNr, uint8 bufferType);
110
111private:
112 int16 _lastSpeechId = -1;
113 uint8 _hotspotStrings[ROOM_ATS_MAX * 3] = { 0 };
114 uint8 _inventoryStrings[MAX_MOV_OBJ * 3] = { 0 };
115 uint8 _inventoryUseStrings[INV_USE_ATS_MAX * 3] = { 0 };
116
117 uint8 *getBuffer(uint8 type);
118 uint8 getSubtextNum(uint16 entry, int8 txtMode, uint8 bufferType);
119};
120
121} // namespace Chewy
122
123#endif
Definition: resource.h:131
Definition: text.h:73
TextEntry * getText(uint chunk, uint entry, int type, int subEntry=-1)
TextEntryList * getDialog(uint dialogNum, uint entryNum)
Definition: list.h:44
Definition: serializer.h:80
Definition: str.h:59
Definition: text.h:64