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 SHERLOCK_UI_H 24 #define SHERLOCK_UI_H 25 26 #include "common/scummsys.h" 27 #include "common/events.h" 28 #include "sherlock/surface.h" 29 #include "sherlock/objects.h" 30 #include "sherlock/resources.h" 31 #include "sherlock/fixed_text.h" 32 33 namespace Sherlock { 34 35 #define CONTROLS_Y 138 36 #define CONTROLS_Y1 151 37 38 enum MenuMode { 39 STD_MODE = 0, 40 LOOK_MODE = 1, 41 MOVE_MODE = 2, 42 TALK_MODE = 3, 43 PICKUP_MODE = 4, 44 OPEN_MODE = 5, 45 CLOSE_MODE = 6, 46 INV_MODE = 7, 47 USE_MODE = 8, 48 GIVE_MODE = 9, 49 JOURNAL_MODE = 10, 50 FILES_MODE = 11, 51 SETUP_MODE = 12, 52 53 // Rose Tattoo specific 54 LAB_MODE = 20, 55 MESSAGE_MODE = 21, 56 VERB_MODE = 22, 57 OPTION_MODE = 23, 58 QUIT_MODE = 24, 59 FOOLSCAP_MODE = 25, 60 PASSWORD_MODE = 26 61 }; 62 63 class UserInterface { 64 protected: 65 SherlockEngine *_vm; 66 67 UserInterface(SherlockEngine *vm); 68 public: 69 MenuMode _menuMode; 70 int _menuCounter; 71 bool _infoFlag; 72 bool _windowOpen; 73 bool _endKeyActive; 74 int _invLookFlag; 75 bool _slideWindows; 76 bool _helpStyle; 77 Common::Rect _windowBounds; 78 bool _lookScriptFlag; 79 int _bgFound, _oldBgFound; 80 int _exitZone; 81 82 // TODO: Not so sure these should be in the base class. May want to refactor them to SherlockEngine, or refactor 83 // various Scalpel dialogs to keep their own private state of key/selections 84 signed char _key, _oldKey; 85 int _selector, _oldSelector; 86 int _temp, _oldTemp; 87 int _temp1; 88 int _lookHelp; 89 public: 90 static UserInterface *init(SherlockEngine *vm); ~UserInterface()91 virtual ~UserInterface() {} 92 93 /** 94 * Called for OPEN, CLOSE, and MOVE actions are being done 95 */ 96 void checkAction(ActionType &action, int objNum, FixedTextActionId fixedTextActionId = kFixedTextAction_Invalid); 97 public: 98 /** 99 * Resets the user interface 100 */ 101 virtual void reset(); 102 103 /** 104 * Draw the user interface onto the screen's back buffers 105 */ 106 virtual void drawInterface(int bufferNum = 3) {} 107 108 /** 109 * Main input handler for the user interface 110 */ handleInput()111 virtual void handleInput() {} 112 113 /** 114 * Displays a passed window by gradually scrolling it vertically on-screen 115 */ 116 virtual void summonWindow(const Surface &bgSurface, bool slideUp = true) {} 117 118 /** 119 * Slide the window stored in the back buffer onto the screen 120 */ 121 virtual void summonWindow(bool slideUp = true, int height = CONTROLS_Y) {} 122 123 /** 124 * Close a currently open window 125 * @param flag 0 = slide old window down, 1 = slide prior UI back up 126 */ 127 virtual void banishWindow(bool slideUp = true) {} 128 129 /** 130 * Clears the info line of the screen 131 */ clearInfo()132 virtual void clearInfo() {} 133 134 /** 135 * Clear any active text window 136 */ clearWindow()137 virtual void clearWindow() {} 138 }; 139 140 } // End of namespace Sherlock 141 142 #endif 143