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 SKY_TEXT_H
23 #define SKY_TEXT_H
24 
25 
26 #include "common/scummsys.h"
27 #include "sky/sky.h"
28 
29 namespace Sky {
30 
31 struct Compact;
32 class Disk;
33 class SkyCompact;
34 
35 struct HuffTree {
36  unsigned char lChild;
37  unsigned char rChild;
38  unsigned char value;
39 };
40 
41 #define NUM_PATCH_MSG 9
42 
43 struct PatchMessage {
44  uint32 textNr;
45  char text[100];
46 };
47 
48 class Text {
49 public:
50  Text(SkyEngine *vm, Disk *skyDisk, SkyCompact *skyCompact);
51  ~Text();
52  struct DisplayedText displayText(uint32 textNum, uint8 *dest, bool center, uint16 pixelWidth, uint8 color);
53  struct DisplayedText displayText(char *textPtr, uint32 bufLen, uint8 *dest, bool center, uint16 pixelWidth, uint8 color);
54  struct DisplayedText lowTextManager(uint32 textNum, uint16 width, uint16 logicNum, uint8 color, bool center);
55  void fnSetFont(uint32 fontNr);
56  void fnTextModule(uint32 textInfoId, uint32 textNo);
57  void fnPointerText(uint32 pointedId, uint16 mouseX, uint16 mouseY);
58  void logicCursor(Compact *textCompact, uint16 mouseX, uint16 mouseY);
59  void changeTextSpriteColor(uint8 *sprData, uint8 newCol);
60  uint32 giveCurrentCharSet();
61 
62  uint32 _numLetters; //no of chars in message
63 
64 private:
65  void initHuffTree();
66  void getText(uint32 textNr);
67  char getTextChar(uint8 **data, uint32 *bitPos);
68  bool getTextBit(uint8 **data, uint32 *bitPos);
69  void makeGameCharacter(uint8 textChar, uint8 *charSetPtr, uint8 *&data, uint8 color, uint16 bufPitch);
70  void makeChineseGameCharacter(uint16 textChar, uint8 *charSetPtr, uint8 *&dest, uint8 color, uint16 bufPitch);
71 
72  bool patchMessage(uint32 textNum);
73 
74  Disk *_skyDisk;
75  SkyCompact *_skyCompact;
76  SkyEngine *_vm;
77 
78  const HuffTree *_huffTree;
79 
80  struct charSet {
81  uint8 *addr;
82  uint32 charHeight;
83  uint32 charSpacing;
84  } _mainCharacterSet, _linkCharacterSet, _controlCharacterSet;
85 
86  uint32 _curCharSet;
87  uint8 *_characterSet;
88  uint8 _charHeight;
89 
90  char _textBuffer[1024];
91 
92  uint32 _dtCharSpacing; //character separation adjustment
93  uint32 _mouseOfsX, _mouseOfsY;
94  static const PatchMessage _patchedMessages[NUM_PATCH_MSG];
95  static const uint16 _patchLangIdx[8];
96  static const uint16 _patchLangNum[8];
97 
98  static const HuffTree _huffTree_00109[]; // trees moved to hufftext.cpp
99  static const HuffTree _huffTree_00267[];
100  static const HuffTree _huffTree_00288[];
101  static const HuffTree _huffTree_00303[];
102  static const HuffTree _huffTree_00331[];
103  static const HuffTree _huffTree_00348[];
104  static const HuffTree _huffTree_00365[];
105  static const HuffTree _huffTree_00368[];
106  static const HuffTree _huffTree_00372[];
107 };
108 
109 } // End of namespace Sky
110 
111 #endif
Definition: struc.h:78
Definition: struc.h:27
Definition: sky.h:76
Definition: text.h:43
Definition: disk.h:37
Definition: text.h:35
Definition: text.h:48
Definition: compact.h:58
Definition: autoroute.h:28