22 #ifndef TOLTECS_SCREEN_H 23 #define TOLTECS_SCREEN_H 25 #include "graphics/surface.h" 26 #include "toltecs/toltecs.h" 41 int16 origWidth, origHeight;
42 int16 resIndex, frameNum;
57 y = READ_LE_UINT16(data + 0);
58 x = READ_LE_UINT16(data + 2);
59 h = READ_LE_UINT16(data + 4);
60 w = READ_LE_UINT16(data + 6);
61 offset = READ_LE_UINT32(data + 8);
67 Font(byte *fontData) : _fontData(fontData) {
71 int16 getSpacing()
const {
74 int16 getHeight()
const {
77 int16 getWidth()
const {
80 int16 getCharWidth(byte ch)
const {
81 return _fontData[4 + (ch - 0x21)];
83 byte *getCharData(byte ch)
const {
84 return _fontData + 0x298 + READ_LE_UINT16(&_fontData[0xE0 + (ch - 0x21) * 2]);
86 int16 getTextWidth(
const byte *text) {
88 while (*text && *text < 0xF0) {
93 width += getCharWidth(ch) + getSpacing() - 1;
108 enum SpriteReaderStatus {
119 virtual SpriteReaderStatus readPacket(
PixelPacket &packet) = 0;
137 bool alwaysDisplayed;
145 byte textBuffer[100];
155 void unpackRle(byte *source, byte *dest, uint16 width, uint16 height);
157 void loadMouseCursor(uint resIndex);
159 void drawGuiImage(int16 x, int16 y, uint resIndex);
161 void startShakeScreen(int16 shakeCounter);
162 void stopShakeScreen();
163 bool updateShakeScreen();
166 void addStaticSprite(byte *spriteItem);
167 void addAnimatedSprite(int16 x, int16 y, int16 fragmentId, byte *data, int16 *spriteArray,
bool loop,
int mode);
172 void blastSprite(int16 x, int16 y, int16 fragmentId, int16 resIndex, uint16 flags);
175 void updateVerbLine(int16 slotIndex, int16 slotOffset);
178 void updateTalkText(int16 slotIndex, int16 slotOffset,
bool alwaysDisplayed);
179 void addTalkTextRect(
Font &font, int16 x, int16 &y, int16 length, int16 width,
TalkTextItem *item);
180 void addTalkTextItemsToRenderQueue();
181 int16 getTalkTextDuration();
182 bool isTalkTextActive(int16 slotIndex);
183 void finishTalkTextItem(int16 slotIndex);
184 void finishTalkTextItems();
185 void keepTalkTextItemsAlive();
188 void registerFont(uint fontIndex, uint resIndex);
189 void drawGuiTextMulti(byte *textData);
190 int16 wrapGuiText(uint fontResIndex,
int maxWidth,
GuiTextWrapState &wrapState);
191 void drawGuiText(int16 x, int16 y, byte fontColor1, byte fontColor2, uint fontResIndex,
GuiTextWrapState &wrapState);
193 int16 drawString(int16 x, int16 y, byte color, uint fontResIndex,
const byte *text,
int len = -1, int16 *ywobble = NULL,
bool outline =
false);
194 void drawChar(
const Font &font, byte *dest, int16 x, int16 y, byte ch, byte color,
bool outline);
201 uint getFontResIndex(
int fontNum)
const {
return _fontResIndexArray[fontNum]; }
212 int16 x, y, width, height;
217 byte *_frontScreen, *_backScreen;
219 uint _fontResIndexArray[10];
220 byte _fontColor1, _fontColor2;
225 int16 _shakeCounterInit, _shakeCounter;
231 int16 _verbLineX, _verbLineY, _verbLineWidth;
232 int16 _verbLineCount;
235 int16 _talkTextX, _talkTextY;
236 int16 _talkTextMaxWidth;
237 byte _talkTextFontColor;
238 int16 _talkTextItemNum;
246 void addDrawRequest(
const DrawRequest &drawRequest);
Definition: animation.h:28