1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
|
/* 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.
*
* $URL$
* $Id$
*
*/
#ifndef MOHAWK_CSTIME_UI_H
#define MOHAWK_CSTIME_UI_H
#include "mohawk/cstime.h"
#include "graphics/fonts/winfont.h"
namespace Mohawk {
struct CSTimeHelpQaR {
uint16 text, speech;
};
class CSTimeHelp {
public:
CSTimeHelp(MohawkEngine_CSTime *vm);
~CSTimeHelp();
void addQaR(uint16 text, uint16 speech);
void start();
void end(bool runEvents = true);
void cleanupAfterFlapping();
void mouseDown(Common::Point &pos);
void mouseMove(Common::Point &pos);
void mouseUp(Common::Point &pos);
void reset();
uint getState() { return _state; }
protected:
MohawkEngine_CSTime *_vm;
uint _state;
uint16 _currHover, _currEntry, _nextToProcess;
Common::Array<CSTimeHelpQaR> _qars;
Common::Array<uint16> _askedAlready;
void display();
void highlightLine(uint line);
void unhighlightLine(uint line);
void selectStrings();
bool noHelperChanges();
};
class CSTimeOptions {
public:
CSTimeOptions(MohawkEngine_CSTime *vm);
~CSTimeOptions();
uint getState() { return _state; }
protected:
MohawkEngine_CSTime *_vm;
uint _state;
};
#define MAX_DISPLAYED_ITEMS 4
class CSTimeInventoryDisplay {
public:
CSTimeInventoryDisplay(MohawkEngine_CSTime *vm, Common::Rect baseRect);
~CSTimeInventoryDisplay();
void install();
void draw();
void show();
void hide();
void idle();
void clearDisplay();
void insertItemInDisplay(uint16 id);
void removeItem(uint16 id);
void mouseDown(Common::Point &pos);
void mouseMove(Common::Point &pos);
void mouseUp(Common::Point &pos);
void activateCuffs(bool active);
void setCuffsFlashing();
bool getCuffsState() { return _cuffsState; }
uint16 getCuffsShape() { return _cuffsShape; }
bool isItemDisplayed(uint16 id);
uint16 getDisplayedNum(uint id) { return _displayedItems[id]; }
uint16 getLastDisplayedClicked() { return getDisplayedNum(_draggedItem); }
void setState(uint state) { _state = state; }
uint getState() { return _state; }
Common::Rect _invRect;
Common::Rect _itemRect[MAX_DISPLAYED_ITEMS];
protected:
MohawkEngine_CSTime *_vm;
uint _state;
bool _cuffsState;
uint16 _cuffsShape;
uint16 _draggedItem;
uint16 _displayedItems[MAX_DISPLAYED_ITEMS];
};
class CSTimeBook {
public:
CSTimeBook(MohawkEngine_CSTime *vm);
~CSTimeBook();
uint getState() { return _state; }
void setState(uint state) { _state = state; }
void drawSmallBook();
protected:
MohawkEngine_CSTime *_vm;
uint _state;
Feature *_smallBookFeature;
};
#define NUM_NOTE_PIECES 3
class CSTimeCarmenNote {
public:
CSTimeCarmenNote(MohawkEngine_CSTime *vm);
~CSTimeCarmenNote();
uint getState() { return _state; }
void setState(uint state) { _state = state; }
void clearPieces();
bool havePiece(uint16 piece);
void addPiece(uint16 piece, uint16 speech);
void drawSmallNote();
void drawBigNote();
void closeNote();
protected:
MohawkEngine_CSTime *_vm;
uint _state;
uint16 _pieces[NUM_NOTE_PIECES];
Feature *_feature;
};
enum CSTimeInterfaceState {
kCSTimeInterfaceStateNormal = 1,
kCSTimeInterfaceStateDragStart = 2,
kCSTimeInterfaceStateDragging = 3
};
class CSTimeInterface {
public:
CSTimeInterface(MohawkEngine_CSTime *vm);
~CSTimeInterface();
void cursorInstall();
void cursorActivate(bool state);
bool cursorGetState() { return _cursorActive; }
void cursorIdle();
void cursorChangeShape(uint16 id);
uint16 cursorGetShape();
void cursorSetShape(uint16 id, bool reset = true);
void cursorSetWaitCursor();
void openResFile();
void install();
void draw();
void idle();
void mouseDown(Common::Point pos);
void mouseMove(Common::Point pos);
void mouseUp(Common::Point pos);
void cursorOverHotspot();
void setCursorForCurrentPoint();
void clearTextLine();
void displayTextLine(Common::String text);
void clearDialogArea();
void clearDialogLine(uint line);
void displayDialogLine(uint16 id, uint line, byte color = 32);
void drawTextIdToBubble(uint16 id);
void drawTextToBubble(Common::String *text);
void closeBubble();
void startDragging(uint16 id);
void stopDragging();
void setGrabPoint();
uint16 getDraggedNum() { return _draggedItem; }
Common::Point getGrabPoint() { return _grabPoint; }
bool grabbedFromInventory();
void dropItemInInventory(uint16 id);
CSTimeInterfaceState getState() { return _state; }
void setState(CSTimeInterfaceState state) { _state = state; }
CSTimeHelp *getHelp() { return _help; }
CSTimeInventoryDisplay *getInventoryDisplay() { return _inventoryDisplay; }
CSTimeBook *getBook() { return _book; }
CSTimeCarmenNote *getCarmenNote() { return _note; }
CSTimeOptions *getOptions() { return _options; }
const Common::String &getRolloverText() { return _rolloverText; }
const Common::String &getDialogText() { return _dialogText; }
const Common::String &getCurrBubbleText() { return _currentBubbleText; }
const Common::Array<Common::String> &getDialogLines() { return _dialogLines; }
const Common::Array<byte> &getDialogLineColors() { return _dialogLineColors; }
const Graphics::WinFont &getNormalFont() { return _normalFont; }
const Graphics::WinFont &getDialogFont() { return _dialogFont; }
const Graphics::WinFont &getRolloverFont() { return _rolloverFont; }
Common::Rect _sceneRect, _uiRect;
Common::Rect _dialogTextRect, _bookRect, _noteRect;
protected:
MohawkEngine_CSTime *_vm;
Common::String _bubbleText;
bool _mouseWasInScene;
CSTimeInterfaceState _state;
CSTimeHelp *_help;
CSTimeInventoryDisplay *_inventoryDisplay;
CSTimeBook *_book;
CSTimeCarmenNote *_note;
CSTimeOptions *_options;
Feature *_uiFeature;
Feature *_dialogTextFeature;
Feature *_rolloverTextFeature;
Feature *_bubbleTextFeature;
Common::String _rolloverText;
Common::String _dialogText;
Common::String _currentBubbleText;
Common::Array<Common::String> _dialogLines;
Common::Array<byte> _dialogLineColors;
uint16 _draggedItem;
Common::Point _grabPoint;
Graphics::WinFont _normalFont, _dialogFont, _rolloverFont;
bool _cursorActive;
uint16 _cursorShapes[3];
uint32 _cursorNextTime;
};
} // End of namespace Mohawk
#endif
|