0x47 stub
[scummvm-innocent.git] / engines / sword2 / mouse.h
bloba45d786088baa2bf5c363d771a72e5b61e7835c3
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 * Additional copyright for this file:
8 * Copyright (C) 1994-1998 Revolution Software Ltd.
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 * $URL$
25 * $Id$
28 #ifndef SWORD2_MOUSE_H
29 #define SWORD2_MOUSE_H
31 #include "common/rect.h"
33 #define MENU_MASTER_OBJECT 44
35 #define MAX_SUBJECT_LIST 30 // is that enough?
37 #define TOTAL_subjects (375 - 256 + 1) // the speech subject bar
38 #define TOTAL_engine_pockets (15 + 10) // +10 for overflow
39 #define TOTAL_mouse_list 50
41 namespace Sword2 {
43 struct MenuObject;
44 struct BuildUnit;
46 // Menubar defines.
48 #define RDMENU_TOP 0
49 #define RDMENU_BOTTOM 1
51 enum {
52 MOUSE_normal = 0, // normal in game
53 MOUSE_menu = 1, // menu chooser
54 MOUSE_drag = 2, // dragging luggage
55 MOUSE_system_menu = 3, // system menu chooser
56 MOUSE_holding = 4 // special
59 enum {
60 RDMOUSE_NOFLASH,
61 RDMOUSE_FLASH
64 enum {
65 RDMENU_HIDDEN,
66 RDMENU_SHOWN,
67 RDMENU_OPENING,
68 RDMENU_CLOSING,
69 RDMENU_ALMOST_HIDDEN
72 #define RDMENU_ICONWIDE 35
73 #define RDMENU_PSXICONWIDE 36
74 #define RDMENU_ICONDEEP 30
75 #define RDMENU_ICONSTART 24
76 #define RDMENU_ICONSPACING 5
77 #define RDMENU_MAXPOCKETS 15
79 #define MOUSE_ANIM_HEADER_SIZE 6
81 struct MouseAnim {
82 uint8 runTimeComp; // type of runtime compression used for the
83 // frame data
84 uint8 noAnimFrames; // number of frames in the anim
85 int8 xHotSpot;
86 int8 yHotSpot;
87 uint8 mousew;
88 uint8 mouseh;
90 byte *data;
93 // The MOUSE_holding mode is entered when the conversation menu is closed, and
94 // exited when the mouse cursor moves off that menu area. I don't know why yet.
96 // mouse unit - like ObjectMouse, but with anim resource & pc (needed if
97 // sprite is to act as mouse detection mask)
99 struct MouseUnit {
100 // Basically the same information as in ObjectMouse, except the
101 // coordinates are adjusted to conform to standard ScummVM usage.
103 Common::Rect rect;
104 int32 priority;
105 int32 pointer;
107 // In addition, we need an id when checking the mouse list, and a
108 // text id for mouse-overs.
110 int32 id;
111 int32 pointer_text;
114 // Array of these for subject menu build up
116 struct SubjectUnit {
117 uint32 res;
118 uint32 ref;
121 // define these in a script and then register them with the system
123 struct MenuObject {
124 int32 icon_resource; // icon graphic graphic
125 int32 luggage_resource; // luggage icon resource (for attaching to
126 // mouse pointer)
129 class Mouse {
130 private:
131 Sword2Engine *_vm;
133 MouseUnit _mouseList[TOTAL_mouse_list];
134 uint32 _curMouse;
136 MenuObject _tempList[TOTAL_engine_pockets];
137 uint32 _totalTemp;
139 MenuObject _masterMenuList[TOTAL_engine_pockets];
140 uint32 _totalMasters;
142 SubjectUnit _subjectList[MAX_SUBJECT_LIST];
144 // ref number for default response when luggage icon is used on a
145 // person & it doesn't match any of the icons which would have been in
146 // the chooser
148 uint32 _defaultResponseId;
150 // could alternately use logic->looping of course
151 bool _choosing;
153 uint8 _menuStatus[2];
154 byte *_icons[2][RDMENU_MAXPOCKETS];
155 uint8 _pocketStatus[2][RDMENU_MAXPOCKETS];
157 uint8 _iconCount;
159 // If it's NORMAL_MOUSE_ID (ie. normal pointer) then it's over a floor
160 // area (or hidden hot-zone)
162 uint32 _mousePointerRes;
164 MouseAnim _mouseAnim;
165 MouseAnim _luggageAnim;
167 uint8 _mouseFrame;
169 uint32 _mouseMode;
171 bool _mouseStatus; // Human 0 on/1 off
172 bool _mouseModeLocked; // 0 not !0 mode cannot be changed from
173 // normal mouse to top menu (i.e. when
174 // carrying big objects)
175 uint32 _realLuggageItem; // Last minute for pause mode
176 uint32 _currentLuggageResource;
177 uint32 _oldButton; // For the re-click stuff - must be
178 // the same button you see
179 uint32 _buttonClick;
180 uint32 _pointerTextBlocNo;
181 uint32 _playerActivityDelay; // Player activity delay counter
183 bool _examiningMenuIcon;
185 // Set by checkMouseList()
186 uint32 _mouseTouching;
187 uint32 _oldMouseTouching;
189 bool _objectLabels;
191 uint32 _menuSelectedPos;
193 void decompressMouse(byte *decomp, byte *comp, uint8 frame, int width, int height, int pitch, int xOff = 0, int yOff = 0);
195 int32 setMouseAnim(byte *ma, int32 size, int32 mouseFlash);
196 int32 setLuggageAnim(byte *la, int32 size);
198 void clearIconArea(int menu, int pocket, Common::Rect *r);
200 public:
201 Mouse(Sword2Engine *vm);
202 ~Mouse();
204 void getPos(int &x, int &y);
205 int getX();
206 int getY();
208 bool getObjectLabels() { return _objectLabels; }
209 void setObjectLabels(bool b) { _objectLabels = b; }
211 bool getMouseStatus() { return _mouseStatus; }
212 uint32 getMouseTouching() { return _mouseTouching; }
213 void setMouseTouching(uint32 touching) { _mouseTouching = touching; }
215 void pauseEngine(bool pause);
217 void setMouse(uint32 res);
218 void setLuggage(uint32 res);
220 void setObjectHeld(uint32 res);
222 void resetMouseList();
224 void registerMouse(byte *ob_mouse, BuildUnit *build_unit);
225 void registerPointerText(int32 text_id);
227 void createPointerText(uint32 text_id, uint32 pointer_res);
228 void clearPointerText();
230 void drawMouse();
231 int32 animateMouse();
233 void processMenu();
235 void addMenuObject(byte *ptr);
236 void addSubject(int32 id, int32 ref);
238 void buildMenu();
239 void buildSystemMenu();
241 int32 showMenu(uint8 menu);
242 int32 hideMenu(uint8 menu);
243 int32 setMenuIcon(uint8 menu, uint8 pocket, byte *icon);
245 void closeMenuImmediately();
247 void refreshInventory();
249 void startConversation();
250 void endConversation();
252 void hideMouse();
253 void noHuman();
254 void addHuman();
256 void resetPlayerActivityDelay() { _playerActivityDelay = 0; }
257 void monitorPlayerActivity();
258 void checkPlayerActivity(uint32 seconds);
260 void mouseOnOff();
261 uint32 checkMouseList();
262 void mouseEngine();
264 void normalMouse();
265 void menuMouse();
266 void dragMouse();
267 void systemMenuMouse();
269 bool isChoosing() { return _choosing; }
270 uint32 chooseMouse();
272 int menuClick(int menu_items);
274 int getMouseMode();
276 void setMouseMode(int mouseMode); // Used to force mouse mode
279 } // End of namespace Sword2
281 #endif