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