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.
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
49 #define RDMENU_BOTTOM 1
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
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
82 uint8 runTimeComp
; // type of runtime compression used for the
84 uint8 noAnimFrames
; // number of frames in the anim
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)
100 // Basically the same information as in ObjectMouse, except the
101 // coordinates are adjusted to conform to standard ScummVM usage.
107 // In addition, we need an id when checking the mouse list, and a
108 // text id for mouse-overs.
114 // Array of these for subject menu build up
121 // define these in a script and then register them with the system
124 int32 icon_resource
; // icon graphic graphic
125 int32 luggage_resource
; // luggage icon resource (for attaching to
133 MouseUnit _mouseList
[TOTAL_mouse_list
];
136 MenuObject _tempList
[TOTAL_engine_pockets
];
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
148 uint32 _defaultResponseId
;
150 // could alternately use logic->looping of course
153 uint8 _menuStatus
[2];
154 byte
*_icons
[2][RDMENU_MAXPOCKETS
];
155 uint8 _pocketStatus
[2][RDMENU_MAXPOCKETS
];
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
;
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
180 uint32 _pointerTextBlocNo
;
181 uint32 _playerActivityDelay
; // Player activity delay counter
183 bool _examiningMenuIcon
;
185 // Set by checkMouseList()
186 uint32 _mouseTouching
;
187 uint32 _oldMouseTouching
;
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
);
201 Mouse(Sword2Engine
*vm
);
204 void getPos(int &x
, int &y
);
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();
231 int32
animateMouse();
235 void addMenuObject(byte
*ptr
);
236 void addSubject(int32 id
, int32 ref
);
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();
256 void resetPlayerActivityDelay() { _playerActivityDelay
= 0; }
257 void monitorPlayerActivity();
258 void checkPlayerActivity(uint32 seconds
);
261 uint32
checkMouseList();
267 void systemMenuMouse();
269 bool isChoosing() { return _choosing
; }
270 uint32
chooseMouse();
272 int menuClick(int menu_items
);
276 void setMouseMode(int mouseMode
); // Used to force mouse mode
279 } // End of namespace Sword2