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 
32 namespace Chewy {
33 
42 enum 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 
53 enum 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 
64 struct TextEntry {
65  int16 _speechId;
66  Common::String _text;
67 };
68 
70 
71 #define ROOM_ATS_MAX 1000
72 
73 class Text : public Resource {
74 public:
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 setTextId(uint16 entry, uint8 subEntry, uint8 strNr, uint8 type);
110 
111 private:
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 getTextId(uint16 entry, uint8 subEntry, uint8 type);
119 };
120 
121 } // namespace Chewy
122 
123 #endif
Definition: str.h:59
Definition: text.h:73
Definition: text.h:64
Definition: list.h:44
Definition: serializer.h:79
Definition: resource.h:131
Definition: ani_dat.h:25