2007-05-30 21:56:52 +00: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.
|
2006-02-11 12:54:56 +00:00
|
|
|
*
|
|
|
|
* 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
|
2008-01-05 12:45:14 +00:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2006-02-11 12:54:56 +00:00
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* $URL$
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2006-07-23 15:32:14 +00:00
|
|
|
#ifndef LURE_SURFACE_H
|
|
|
|
#define LURE_SURFACE_H
|
2006-02-11 12:54:56 +00:00
|
|
|
|
2007-09-19 08:40:12 +00:00
|
|
|
|
2006-02-11 12:54:56 +00:00
|
|
|
#include "common/str.h"
|
2008-04-06 12:00:37 +00:00
|
|
|
#include "common/ptr.h"
|
2006-02-11 12:54:56 +00:00
|
|
|
#include "lure/disk.h"
|
|
|
|
#include "lure/luredefs.h"
|
|
|
|
|
|
|
|
namespace Lure {
|
|
|
|
|
2008-01-05 10:34:34 +00:00
|
|
|
#define DEFAULT_TEXT_COLOUR -1
|
|
|
|
|
2006-02-11 12:54:56 +00:00
|
|
|
class Surface {
|
|
|
|
private:
|
2007-09-19 08:40:12 +00:00
|
|
|
MemoryBlock *_data;
|
2006-02-11 12:54:56 +00:00
|
|
|
uint16 _width, _height;
|
2008-01-05 10:34:34 +00:00
|
|
|
|
|
|
|
void egaCreateDialog(bool blackFlag);
|
|
|
|
void vgaCreateDialog(bool blackFlag);
|
2006-02-11 12:54:56 +00:00
|
|
|
public:
|
|
|
|
Surface(MemoryBlock *src, uint16 width, uint16 height);
|
2007-09-19 08:40:12 +00:00
|
|
|
Surface(uint16 width, uint16 height);
|
2006-02-11 12:54:56 +00:00
|
|
|
~Surface();
|
2008-01-05 10:34:34 +00:00
|
|
|
static uint16 textX();
|
|
|
|
static uint16 textY();
|
|
|
|
static void getDialogBounds(Common::Point &size, int charWidth, int numLines,
|
|
|
|
bool squashedLines = true);
|
2007-09-19 08:40:12 +00:00
|
|
|
|
2006-02-11 12:54:56 +00:00
|
|
|
static void initialise();
|
|
|
|
static void deinitialise();
|
|
|
|
|
|
|
|
uint16 width() { return _width; }
|
|
|
|
uint16 height() { return _height; }
|
|
|
|
MemoryBlock &data() { return *_data; }
|
|
|
|
|
|
|
|
void loadScreen(uint16 resourceId);
|
2008-01-02 03:36:19 +00:00
|
|
|
void loadScreen(MemoryBlock *data);
|
2008-01-05 10:34:34 +00:00
|
|
|
int writeChar(uint16 x, uint16 y, uint8 ascii, bool transparent, int colour);
|
2007-09-19 08:40:12 +00:00
|
|
|
void writeString(uint16 x, uint16 y, Common::String line, bool transparent,
|
2008-01-05 10:34:34 +00:00
|
|
|
int colour = DEFAULT_TEXT_COLOUR, bool varLength = true);
|
2008-01-27 19:47:41 +00:00
|
|
|
void writeSubstring(uint16 x, uint16 y, Common::String line, int len,
|
2008-01-05 10:34:34 +00:00
|
|
|
bool transparent, int colour = DEFAULT_TEXT_COLOUR, bool varLength = true);
|
2006-02-11 12:54:56 +00:00
|
|
|
void transparentCopyTo(Surface *dest);
|
|
|
|
void copyTo(Surface *dest);
|
|
|
|
void copyTo(Surface *dest, uint16 x, uint16 y);
|
2006-05-31 20:05:31 +00:00
|
|
|
void copyTo(Surface *dest, const Common::Rect &srcBounds, uint16 destX, uint16 destY,
|
2006-02-11 12:54:56 +00:00
|
|
|
int transparentColour = -1);
|
|
|
|
void copyFrom(MemoryBlock *src) { _data->copyFrom(src); }
|
|
|
|
void copyFrom(MemoryBlock *src, uint32 destOffset);
|
|
|
|
void empty() { _data->empty(); }
|
2006-05-31 20:05:31 +00:00
|
|
|
void fillRect(const Common::Rect &r, uint8 colour);
|
2006-02-11 12:54:56 +00:00
|
|
|
void createDialog(bool blackFlag = false);
|
|
|
|
void copyToScreen(uint16 x, uint16 y);
|
|
|
|
void centerOnScreen();
|
|
|
|
|
|
|
|
static uint16 textWidth(const char *s, int numChars = 0);
|
2006-02-19 04:08:41 +00:00
|
|
|
static void wordWrap(char *text, uint16 width, char **&lines, uint8 &numLines);
|
2008-01-27 19:47:41 +00:00
|
|
|
static Surface *newDialog(uint16 width, uint8 numLines, const char **lines, bool varLength = true,
|
2008-01-05 10:34:34 +00:00
|
|
|
int colour = DEFAULT_TEXT_COLOUR, bool squashedLines = true);
|
|
|
|
static Surface *newDialog(uint16 width, const char *lines, int colour = DEFAULT_TEXT_COLOUR);
|
2006-02-11 12:54:56 +00:00
|
|
|
static Surface *getScreen(uint16 resourceId);
|
2007-05-20 07:24:05 +00:00
|
|
|
bool getString(Common::String &line, int maxSize, bool isNumeric, bool varLength, int16 x, int16 y);
|
2006-02-11 12:54:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class Dialog {
|
|
|
|
public:
|
|
|
|
static void show(const char *text);
|
2007-02-14 02:37:53 +00:00
|
|
|
static void show(uint16 stringId, const char *hotspotName, const char *characterName);
|
2006-02-11 12:54:56 +00:00
|
|
|
static void show(uint16 stringId);
|
|
|
|
};
|
|
|
|
|
2006-02-19 04:08:41 +00:00
|
|
|
class TalkDialog {
|
|
|
|
private:
|
|
|
|
Surface *_surface;
|
|
|
|
char _desc[MAX_DESC_SIZE];
|
|
|
|
char **_lines;
|
|
|
|
uint8 _numLines;
|
2007-10-24 10:03:11 +00:00
|
|
|
int _endLine, _endIndex;
|
|
|
|
int _wordCountdown;
|
2007-12-02 04:49:33 +00:00
|
|
|
|
|
|
|
uint16 _characterId;
|
|
|
|
uint16 _destCharacterId;
|
|
|
|
uint16 _activeItemId;
|
|
|
|
uint16 _descId;
|
2007-12-12 08:49:09 +00:00
|
|
|
|
|
|
|
int getArticle(uint16 msgId, uint16 objId);
|
2008-01-06 02:09:18 +00:00
|
|
|
void vgaTalkDialog(Surface *s);
|
2006-02-19 04:08:41 +00:00
|
|
|
public:
|
2006-08-07 13:16:07 +00:00
|
|
|
TalkDialog(uint16 characterId, uint16 destCharacterId, uint16 activeItemId, uint16 descId);
|
2006-02-19 04:08:41 +00:00
|
|
|
~TalkDialog();
|
|
|
|
|
|
|
|
char *desc() { return _desc; }
|
|
|
|
Surface &surface() { return *_surface; }
|
2007-10-24 10:03:11 +00:00
|
|
|
void copyTo(Surface *dest, uint16 x, uint16 y);
|
|
|
|
bool isBuilding() { return _endLine < _numLines; }
|
2007-12-02 04:49:33 +00:00
|
|
|
|
|
|
|
void saveToStream(Common::WriteStream *stream);
|
|
|
|
static TalkDialog *loadFromStream(Common::ReadStream *stream);
|
2006-02-19 04:08:41 +00:00
|
|
|
};
|
|
|
|
|
2006-09-07 11:21:20 +00:00
|
|
|
class SaveRestoreDialog {
|
2006-10-02 12:49:57 +00:00
|
|
|
private:
|
|
|
|
static void toggleHightlight(int xs, int xe, int ys, int ye);
|
2006-09-07 11:21:20 +00:00
|
|
|
public:
|
2006-10-02 12:49:57 +00:00
|
|
|
static bool show(bool saveDialog);
|
2006-09-07 11:21:20 +00:00
|
|
|
};
|
|
|
|
|
2007-08-12 11:07:44 +00:00
|
|
|
class RestartRestoreDialog {
|
|
|
|
public:
|
|
|
|
static bool show();
|
|
|
|
};
|
|
|
|
|
2007-09-23 22:11:14 +00:00
|
|
|
class CopyProtectionDialog {
|
|
|
|
private:
|
2008-04-06 12:00:37 +00:00
|
|
|
typedef Common::List<Common::SharedPtr<Hotspot> > HotspotsList;
|
|
|
|
HotspotsList _hotspots;
|
2007-09-23 22:11:14 +00:00
|
|
|
int _charIndex;
|
|
|
|
|
|
|
|
void chooseCharacters();
|
|
|
|
public:
|
|
|
|
CopyProtectionDialog();
|
|
|
|
bool show();
|
|
|
|
};
|
|
|
|
|
2006-02-11 12:54:56 +00:00
|
|
|
} // End of namespace Lure
|
|
|
|
|
|
|
|
#endif
|