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