ScummVM API documentation
strings.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 LURE_STRINGS_H
23 #define LURE_STRINGS_H
24 
25 #include "lure/luredefs.h"
26 #include "lure/memory.h"
27 
28 namespace Lure {
29 
31 public:
32  uint8 _numBits;
33  uint32 _sequence;
34  char _ascii;
35 
36  CharacterEntry(uint8 numBits, uint32 sequence, char ascii): _numBits(numBits),
37  _sequence(sequence), _ascii(ascii) {}
38 };
39 
40 #define MAX_NUM_CHARS 218
41 
42 class StringData {
43 private:
44  MemoryBlock *_strings[3];
45  MemoryBlock *_names;
46  CharacterEntry *_chars[MAX_NUM_CHARS];
47  uint8 _numChars;
48  byte *_srcPos;
49  byte *_stringTable;
50  byte _bitMask;
51 
52  void add(const char *sequence, char ascii);
53  bool initPosition(uint16 stringId);
54  char readCharacter();
55  byte readBit();
56 public:
57  StringData();
58  ~StringData();
59  static StringData &getReference();
60 
61  void getString(uint16 stringId, char *dest, const char *hotspotName, const char *characterName,
62  int hotspotArticle = 0, int characterArticle = 0);
63  void getString(uint16 stringId, char *dest) {
64  getString(stringId, dest, NULL, NULL);
65  }
66  char *getName(uint8 nameIndex);
67 };
68 
69 } // namespace Lure
70 
71 #endif
Definition: strings.h:30
Definition: strings.h:42
Definition: animseq.h:27
Definition: memory.h:31