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 PARALLACTION_INPUT_H 24 #define PARALLACTION_INPUT_H 25 26 #include "common/keyboard.h" 27 28 #include "parallaction/objects.h" 29 #include "parallaction/inventory.h" 30 31 namespace Parallaction { 32 33 enum { 34 kMouseNone = 0, 35 kMouseLeftUp = 1, 36 kMouseLeftDown = 2, 37 kMouseRightUp = 4, 38 kMouseRightDown = 8 39 }; 40 41 enum MouseTriState { 42 MOUSE_ENABLED_SHOW, 43 MOUSE_ENABLED_HIDE, 44 MOUSE_DISABLED 45 }; 46 47 class Input { 48 int updateGameInput(); 49 50 bool _hasKeyPressEvent; 51 Common::KeyState _keyPressed; 52 53 bool _hasDelayedAction; // actived when the character needs to move before taking an action 54 ZonePtr _delayedActionZone; 55 56 int16 _transCurrentHoverItem; 57 58 void translateInput(); 59 bool translateGameInput(); 60 bool updateInventoryInput(); 61 void takeAction(ZonePtr z); 62 void walkTo(const Common::Point &dest); 63 64 Parallaction *_vm; 65 66 Common::Point _mousePos; 67 uint16 _mouseButtons; 68 69 ZonePtr _hoverZone; 70 71 void enterInventoryMode(); 72 void exitInventoryMode(); 73 74 int _gameType; 75 76 static byte _resMouseArrow_NS[256]; 77 static byte _resMouseArrow_BR_Amiga[512]; 78 Frames *_mouseArrow; 79 Frames *_comboArrow; 80 Frames *_dinoCursor; 81 Frames *_dougCursor; 82 Frames *_donnaCursor; 83 84 void initCursors(); 85 86 public: 87 enum { 88 kInputModeGame = 0, 89 kInputModeComment = 1, 90 kInputModeDialogue = 2, 91 kInputModeInventory = 3, 92 kInputModeMenu = 4 93 }; 94 95 96 Input(Parallaction *vm); 97 virtual ~Input(); 98 99 void getAbsoluteCursorPos(Common::Point& p) const; 100 getCursorPos(Common::Point & p)101 void getCursorPos(Common::Point& p) const { 102 p = _mousePos; 103 } 104 setCursorPos(const Common::Point & p)105 void setCursorPos(const Common::Point& p) { 106 _mousePos = p; 107 } 108 109 int _inputMode; 110 InventoryItem _activeItem; 111 112 void readInput(); 113 int updateInput(); 114 void trackMouse(ZonePtr z); 115 void waitForButtonEvent(uint32 buttonEventMask, int32 timeout = -1); getLastButtonEvent()116 uint32 getLastButtonEvent() { return _mouseButtons; } 117 bool getLastKeyDown(uint16 &ascii); 118 119 void stopHovering(); 120 121 MouseTriState _mouseState; 122 123 void setMouseState(MouseTriState state); 124 MouseTriState getMouseState(); 125 bool isMouseEnabled(); 126 127 void setArrowCursor(); 128 void setInventoryCursor(ItemName name); 129 }; 130 131 } // namespace Parallaction 132 133 #endif 134