2015-12-04 13:32:08 +01:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This code is based on Labyrinth of Time code with assistance of
|
|
|
|
*
|
|
|
|
* Copyright (c) 1993 Terra Nova Development
|
|
|
|
* Copyright (c) 2004 The Wyrmkeep Entertainment Co.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2015-12-08 20:10:26 +01:00
|
|
|
#ifndef LAB_DISPMAN_H
|
|
|
|
#define LAB_DISPMAN_H
|
2015-12-04 13:32:08 +01:00
|
|
|
|
|
|
|
namespace Lab {
|
|
|
|
|
2015-12-08 21:33:03 +01:00
|
|
|
struct BitMap;
|
2015-12-04 13:32:08 +01:00
|
|
|
class LabEngine;
|
2015-12-08 20:46:13 +01:00
|
|
|
class Image;
|
2015-12-04 13:32:08 +01:00
|
|
|
|
2015-12-07 07:48:54 +01:00
|
|
|
struct TextFont {
|
|
|
|
uint32 _dataLength;
|
|
|
|
uint16 _height;
|
|
|
|
byte _widths[256];
|
|
|
|
uint16 _offsets[256];
|
|
|
|
byte *_data;
|
|
|
|
};
|
|
|
|
|
2015-12-07 09:58:46 +02:00
|
|
|
enum TransitionType {
|
|
|
|
kTransitionNone,
|
|
|
|
kTransitionWipe,
|
|
|
|
kTransitionScrollWipe,
|
|
|
|
kTransitionScrollBlack,
|
|
|
|
kTransitionScrollBounce,
|
|
|
|
kTransitionTransporter,
|
|
|
|
kTransitionReadFirstFrame,
|
|
|
|
kTransitionReadNextFrame
|
|
|
|
};
|
|
|
|
|
2015-12-04 13:32:08 +01:00
|
|
|
class DisplayMan {
|
|
|
|
private:
|
|
|
|
LabEngine *_vm;
|
|
|
|
|
2015-12-06 18:16:26 +01:00
|
|
|
uint16 fadeNumIn(uint16 num, uint16 res, uint16 counter);
|
|
|
|
uint16 fadeNumOut(uint16 num, uint16 res, uint16 counter);
|
2015-12-09 19:52:34 +01:00
|
|
|
void getWord(char *wordBuffer, const char *mainBuffer, uint16 *wordWidth);
|
2015-12-06 18:16:26 +01:00
|
|
|
|
2015-12-14 12:40:19 +01:00
|
|
|
byte _curPen;
|
2015-12-18 01:52:41 +02:00
|
|
|
Common::File *_curBitmap;
|
2015-12-06 14:36:49 +01:00
|
|
|
byte _curvgapal[256 * 3];
|
2015-12-04 13:32:08 +01:00
|
|
|
|
|
|
|
public:
|
|
|
|
DisplayMan(LabEngine *lab);
|
2015-12-04 21:18:41 +02:00
|
|
|
virtual ~DisplayMan();
|
2015-12-04 13:32:08 +01:00
|
|
|
|
2015-12-04 21:18:41 +02:00
|
|
|
void loadPict(const char *filename);
|
2015-12-13 11:55:49 +01:00
|
|
|
void loadBackPict(const char *fileName, uint16 *highPal);
|
2015-12-19 02:12:42 +02:00
|
|
|
void readPict(Common::String filename, bool playOnce, bool onlyDiffData = false, byte *memoryBuffer = nullptr, uint16 maxHeight = 0);
|
2015-12-04 21:18:41 +02:00
|
|
|
void freePict();
|
2015-12-04 13:32:08 +01:00
|
|
|
void doScrollBlack();
|
|
|
|
void copyPage(uint16 width, uint16 height, uint16 nheight, uint16 startline, byte *mem);
|
|
|
|
void doScrollWipe(char *filename);
|
|
|
|
void doScrollBounce();
|
2015-12-09 11:22:41 +01:00
|
|
|
void doTransWipe(CloseDataPtr *closePtrList, char *filename);
|
|
|
|
void doTransition(TransitionType transitionType, CloseDataPtr *closePtrList, char *filename);
|
2015-12-04 13:32:08 +01:00
|
|
|
void blackScreen();
|
|
|
|
void whiteScreen();
|
|
|
|
void blackAllScreen();
|
|
|
|
void createBox(uint16 y2);
|
|
|
|
void drawPanel();
|
2015-12-08 17:19:08 +02:00
|
|
|
void setUpScreens();
|
2015-12-04 13:32:08 +01:00
|
|
|
int32 longDrawMessage(const char *str);
|
|
|
|
void drawMessage(const char *str);
|
2015-12-14 22:50:09 +01:00
|
|
|
void setPen(byte pennum);
|
2015-12-04 13:32:08 +01:00
|
|
|
void rectFill(uint16 x1, uint16 y1, uint16 x2, uint16 y2);
|
2015-12-17 18:35:53 +01:00
|
|
|
void rectFill(Common::Rect fillRect);
|
2015-12-05 22:20:26 +02:00
|
|
|
void rectFillScaled(uint16 x1, uint16 y1, uint16 x2, uint16 y2);
|
2015-12-08 11:27:34 +01:00
|
|
|
// Window text stuff
|
2015-12-14 21:44:06 +01:00
|
|
|
int flowText(TextFont *font, // the TextAttr pointer
|
2015-12-14 12:40:19 +01:00
|
|
|
int16 spacing, // How much vertical spacing between the lines
|
2015-12-14 22:50:09 +01:00
|
|
|
byte penColor, // pen number to use for text
|
|
|
|
byte backPen, // the background color
|
|
|
|
bool fillBack, // Whether to fill the background
|
2015-12-14 12:40:19 +01:00
|
|
|
bool centerh, // Whether to center the text horizontally
|
|
|
|
bool centerv, // Whether to center the text vertically
|
|
|
|
bool output, // Whether to output any text
|
2015-12-17 18:35:53 +01:00
|
|
|
Common::Rect textRect, // Cords
|
2015-12-08 11:27:34 +01:00
|
|
|
const char *text); // The text itself
|
2015-12-05 22:20:26 +02:00
|
|
|
|
2015-12-14 21:44:06 +01:00
|
|
|
int flowTextToMem(Image *destIm,
|
2015-12-14 12:40:19 +01:00
|
|
|
TextFont *font, // the TextAttr pointer
|
|
|
|
int16 spacing, // How much vertical spacing between the lines
|
2015-12-14 22:50:09 +01:00
|
|
|
byte penColor, // pen number to use for text
|
|
|
|
byte backPen, // the background color
|
|
|
|
bool fillBack, // Whether to fill the background
|
2015-12-14 12:40:19 +01:00
|
|
|
bool centerh, // Whether to center the text horizontally
|
|
|
|
bool centerv, // Whether to center the text vertically
|
|
|
|
bool output, // Whether to output any text
|
2015-12-17 18:35:53 +01:00
|
|
|
Common::Rect textRect, // Cords
|
2015-12-14 12:40:19 +01:00
|
|
|
const char *str); // The text itself
|
2015-12-04 13:32:08 +01:00
|
|
|
|
|
|
|
void drawHLine(uint16 x, uint16 y1, uint16 y2);
|
|
|
|
void drawVLine(uint16 x1, uint16 y, uint16 x2);
|
|
|
|
void screenUpdate();
|
2015-12-14 12:40:19 +01:00
|
|
|
void createScreen(bool hiRes);
|
2015-12-06 14:36:49 +01:00
|
|
|
void setAmigaPal(uint16 *pal, uint16 numColors);
|
2015-12-14 12:40:19 +01:00
|
|
|
void writeColorRegs(byte *buf, uint16 first, uint16 numReg);
|
2015-12-14 22:50:09 +01:00
|
|
|
void setPalette(void *newPal, uint16 numColors);
|
2015-12-14 12:40:19 +01:00
|
|
|
void overlayRect(uint16 penColor, uint16 x1, uint16 y1, uint16 x2, uint16 y2);
|
2015-12-06 14:36:49 +01:00
|
|
|
byte *getCurrentDrawingBuffer();
|
2015-12-09 01:41:51 +02:00
|
|
|
void scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 y2, byte *buffer);
|
|
|
|
void scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2, byte *buffer);
|
2015-12-06 18:16:26 +01:00
|
|
|
void fade(bool fadein, uint16 res);
|
2015-12-14 12:40:19 +01:00
|
|
|
void closeFont(TextFont *font);
|
|
|
|
uint16 textLength(TextFont *font, const char *text, uint16 numChars);
|
2015-12-07 07:48:54 +01:00
|
|
|
uint16 textHeight(TextFont *tf);
|
2015-12-18 08:57:32 +00:00
|
|
|
void drawText(TextFont *tf, uint16 x, uint16 y, uint16 color, const char *text, uint16 numChars);
|
2015-12-07 07:48:54 +01:00
|
|
|
void getLine(TextFont *tf, char *lineBuffer, const char **mainBuffer, uint16 lineWidth);
|
2015-12-04 21:18:41 +02:00
|
|
|
|
|
|
|
bool _longWinInFront;
|
|
|
|
bool _lastMessageLong;
|
|
|
|
uint32 _screenBytesPerPage;
|
2015-12-06 14:36:49 +01:00
|
|
|
int _screenWidth;
|
|
|
|
int _screenHeight;
|
|
|
|
byte *_displayBuffer;
|
|
|
|
byte *_currentDisplayBuffer;
|
2015-12-06 17:24:25 +01:00
|
|
|
bool _doNotDrawMessage;
|
2015-12-14 08:59:16 +01:00
|
|
|
uint16 *_fadePalette;
|
2015-12-08 21:33:03 +01:00
|
|
|
BitMap *_dispBitMap;
|
2015-12-04 13:32:08 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
} // End of namespace Lab
|
|
|
|
|
2015-12-08 20:10:26 +01:00
|
|
|
#endif // LAB_DISPMAN_H
|