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 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. 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, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 */ 22 23 #ifndef SWORD1_MOUSE_H 24 #define SWORD1_MOUSE_H 25 26 #include "common/scummsys.h" 27 #include "common/rect.h" 28 #include "sword1/sworddefs.h" 29 #include "sword1/object.h" 30 31 class OSystem; 32 33 namespace Sword1 { 34 35 #define MAX_MOUSE 30 36 37 #define BS1L_BUTTON_DOWN 2 38 #define BS1L_BUTTON_UP 4 39 #define BS1R_BUTTON_DOWN 8 40 #define BS1R_BUTTON_UP 16 41 #define BS1_WHEEL_UP 32 42 #define BS1_WHEEL_DOWN 64 43 #define MOUSE_BOTH_BUTTONS (BS1L_BUTTON_DOWN | BS1R_BUTTON_DOWN) 44 #define MOUSE_DOWN_MASK (BS1L_BUTTON_DOWN | BS1R_BUTTON_DOWN) 45 #define MOUSE_UP_MASK (BS1L_BUTTON_UP | BS1R_BUTTON_UP) 46 47 struct MouseObj { 48 int id; 49 Object *compact; 50 }; 51 52 #include "common/pack-start.h" // START STRUCT PACKING 53 54 struct MousePtr { 55 uint16 numFrames; 56 uint16 sizeX; 57 uint16 sizeY; 58 uint16 hotSpotX; 59 uint16 hotSpotY; 60 uint8 dummyData[0x30]; 61 } PACKED_STRUCT; 62 63 #include "common/pack-end.h" // END STRUCT PACKING 64 65 class Logic; 66 class Menu; 67 class ResMan; 68 class ObjectMan; 69 70 class Mouse { 71 public: 72 Mouse(OSystem *system, ResMan *pResMan, ObjectMan *pObjMan); 73 ~Mouse(); 74 void initialize(); 75 void addToList(int id, Object *compact); 76 void useLogicAndMenu(Logic *pLogic, Menu *pMenu); 77 void setLuggage(uint32 resID, uint32 rate); 78 void setPointer(uint32 resID, uint32 rate); 79 void animate(); 80 void engine(uint16 x, uint16 y, uint16 eventFlags); 81 uint16 testEvent(); 82 void giveCoords(uint16 *x, uint16 *y); 83 void fnNoHuman(); 84 void fnAddHuman(); 85 void fnBlankMouse(); 86 void fnNormalMouse(); 87 void fnLockMouse(); 88 void fnUnlockMouse(); 89 void controlPanel(bool on); 90 private: 91 void createPointer(uint32 ptrId, uint32 luggageId); 92 OSystem *_system; 93 Logic *_logic; 94 Menu *_menu; 95 MouseObj _objList[MAX_MOUSE]; 96 ResMan *_resMan; 97 ObjectMan *_objMan; 98 Common::Point _mouse; 99 100 uint32 _currentPtrId, _currentLuggageId; 101 MousePtr *_currentPtr; 102 int _frame, _activeFrame; 103 uint16 _numObjs; 104 uint16 _lastState, _state; 105 uint32 _getOff; 106 bool _inTopMenu, _mouseOverride; 107 }; 108 109 } // End of namespace Sword1 110 111 #endif //BSMOUSE_H 112