1
/* ScummVM - Graphic Adventure Engine
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.
7
* This program is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU General Public License
9
* as published by the Free Software Foundation; either version 2
10
* of the License, or (at your option) any later version.
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.
17
* You should have received a copy of the GNU General Public License
18
* along with this program; if not, write to the Free Software
19
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23
#ifndef MADS_DIALOGS_H
24
#define MADS_DIALOGS_H
26
#include "common/scummsys.h"
27
#include "mads/game.h"
28
#include "mads/font.h"
29
#include "mads/msurface.h"
35
void setDialogPalette();
38
MSurface *_savedSurface;
39
Common::Point _position;
42
byte _dialogPalette[8 * 3];
44
int TEXTDIALOG_CONTENT1;
45
int TEXTDIALOG_CONTENT2;
47
int TEXTDIALOG_BACKGROUND;
59
* Calculate bounds for the dialog
61
virtual void calculateBounds();
64
* Save the section of the passed surface the dialog will cover.
69
* Restore saved dialog surface
71
virtual void restore();
74
* Draws the content of a dialog with a gravelly alternating color.
76
void drawContent(const Common::Rect &r, int seed, byte color1, byte color2);
81
Dialog(MADSEngine *vm);
89
* Return the bounds of the dialog.
91
Common::Rect getBounds() const {
92
return Common::Rect(_position.x, _position.y,
93
_position.x + _width, _position.y + _height);
97
#define TEXT_DIALOG_MAX_LINES 20
99
class TextDialog : protected Dialog {
102
* Append text to the currently end line.
104
void appendLine(const Common::String &line);
107
* Clean up after finishing displaying the dialog
109
void restorePalette();
119
Common::String _lines[TEXT_DIALOG_MAX_LINES];
120
int _lineXp[TEXT_DIALOG_MAX_LINES];
123
* Calculate the bounds for the dialog
125
virtual void calculateBounds();
129
* @param vm Engine reference
130
* @param fontName Font to use for display
131
* @param pos Position for window top-left
132
* @param maxChars Horizontal width of window in characters
134
TextDialog(MADSEngine *vm, const Common::String &fontName, const Common::Point &pos,
140
virtual ~TextDialog();
148
* Draw the dialog along with any input box
150
void drawWithInput();
153
* Add a new line to the dialog
155
void addLine(const Common::String &line, bool underline = false);
158
* Adds one or more lines, word wrapping the passed text
160
void wordWrap(const Common::String &line);
163
* Increments the number of text lines the text dialog uses
168
* Adds an input area following previously added text
173
* Adds a bar line to separate sections of text
178
* Flags the previously added line to be underlined
180
void underlineLine();
182
void downPixelLine();
185
* Set the x position for the given line
187
void setLineXp(int xp);
190
* Show the dialog, and wait until a key or mouse press.
195
class MessageDialog : public TextDialog {
197
MessageDialog(MADSEngine *vm, int lines, ...);
199
virtual ~MessageDialog() {}
203
DIALOG_NONE = 0, DIALOG_GAME_MENU = 1, DIALOG_SAVE = 2, DIALOG_RESTORE = 3,
204
DIALOG_OPTIONS = 4, DIALOG_DIFFICULTY = 5, DIALOG_ERROR = 6
211
Dialogs(MADSEngine *vm);
213
static Dialogs *init(MADSEngine *vm);
215
Common::Point _defaultPosition;
216
DialogId _pendingDialog;
219
virtual ~Dialogs() {}
221
virtual void showDialog() = 0;
222
virtual void showItem(int objectId, int messageId, int speech = 0) = 0;
223
virtual Common::String getVocab(int vocabId) = 0;
224
virtual bool show(int messageId, int objectId = -1) = 0;
227
} // End of namespace MADS
229
#endif /* MADS_DIALOGS_H */