From fc0cf31fdea7dc2d796b7d2109324d2d613d2e0b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 24 Jul 2015 22:14:40 -0400 Subject: SHERLOCK: RT: Skeleton class for Files dialog --- engines/sherlock/module.mk | 1 + engines/sherlock/saveload.cpp | 1 - engines/sherlock/saveload.h | 1 - engines/sherlock/scalpel/scalpel_saveload.h | 2 + engines/sherlock/tattoo/tattoo_user_interface.cpp | 9 +-- engines/sherlock/tattoo/tattoo_user_interface.h | 3 +- engines/sherlock/tattoo/widget_files.cpp | 73 +++++++++++++++++++++++ engines/sherlock/tattoo/widget_files.h | 63 +++++++++++++++++++ 8 files changed, 144 insertions(+), 9 deletions(-) create mode 100644 engines/sherlock/tattoo/widget_files.cpp create mode 100644 engines/sherlock/tattoo/widget_files.h diff --git a/engines/sherlock/module.mk b/engines/sherlock/module.mk index 3af8986565..c602021b83 100644 --- a/engines/sherlock/module.mk +++ b/engines/sherlock/module.mk @@ -34,6 +34,7 @@ MODULE_OBJS = \ tattoo/tattoo_user_interface.o \ tattoo/widget_base.o \ tattoo/widget_credits.o \ + tattoo/widget_files.o \ tattoo/widget_hangman.o \ tattoo/widget_inventory.o \ tattoo/widget_lab.o \ diff --git a/engines/sherlock/saveload.cpp b/engines/sherlock/saveload.cpp index fae8196dc1..11516557d4 100644 --- a/engines/sherlock/saveload.cpp +++ b/engines/sherlock/saveload.cpp @@ -46,7 +46,6 @@ SaveManager *SaveManager::init(SherlockEngine *vm, const Common::String &target) SaveManager::SaveManager(SherlockEngine *vm, const Common::String &target) : _vm(vm), _target(target) { _saveThumb = nullptr; - _envMode = SAVEMODE_NONE; _justLoaded = false; _savegameIndex = 0; } diff --git a/engines/sherlock/saveload.h b/engines/sherlock/saveload.h index 0aaa9cf801..b4e9b3e3f3 100644 --- a/engines/sherlock/saveload.h +++ b/engines/sherlock/saveload.h @@ -87,7 +87,6 @@ protected: public: Common::StringArray _savegames; int _savegameIndex; - SaveMode _envMode; bool _justLoaded; public: static SaveManager *init(SherlockEngine *vm, const Common::String &target); diff --git a/engines/sherlock/scalpel/scalpel_saveload.h b/engines/sherlock/scalpel/scalpel_saveload.h index db4fa1a2ab..6b035cace3 100644 --- a/engines/sherlock/scalpel/scalpel_saveload.h +++ b/engines/sherlock/scalpel/scalpel_saveload.h @@ -32,6 +32,8 @@ namespace Scalpel { extern const int ENV_POINTS[6][3]; class ScalpelSaveManager: public SaveManager { +public: + SaveMode _envMode; public: ScalpelSaveManager(SherlockEngine *vm, const Common::String &target); virtual ~ScalpelSaveManager() {} diff --git a/engines/sherlock/tattoo/tattoo_user_interface.cpp b/engines/sherlock/tattoo/tattoo_user_interface.cpp index f602259ea8..01f927b8c3 100644 --- a/engines/sherlock/tattoo/tattoo_user_interface.cpp +++ b/engines/sherlock/tattoo/tattoo_user_interface.cpp @@ -31,7 +31,7 @@ namespace Tattoo { TattooUserInterface::TattooUserInterface(SherlockEngine *vm): UserInterface(vm), _inventoryWidget(vm), _messageWidget(vm), _textWidget(vm), _tooltipWidget(vm), _verbsWidget(vm), - _labWidget(vm), _creditsWidget(vm), _optionsWidget(vm), _quitWidget(vm) { + _labWidget(vm), _creditsWidget(vm), _optionsWidget(vm), _quitWidget(vm), _filesWidget(vm) { Common::fill(&_lookupTable[0], &_lookupTable[PALETTE_COUNT], 0); Common::fill(&_lookupTable1[0], &_lookupTable1[PALETTE_COUNT], 0); _scrollSize = 0; @@ -40,7 +40,6 @@ TattooUserInterface::TattooUserInterface(SherlockEngine *vm): UserInterface(vm), _bgShape = nullptr; _personFound = false; _lockoutTimer = 0; - _fileMode = SAVEMODE_NONE; _exitZone = -1; _scriptZone = -1; _arrowZone = _oldArrowZone = -1; @@ -882,13 +881,11 @@ void TattooUserInterface::clearWindow() { } void TattooUserInterface::loadGame() { - _fileMode = SAVEMODE_LOAD; - // TODO + _filesWidget.show(SAVEMODE_LOAD); } void TattooUserInterface::saveGame() { - _fileMode = SAVEMODE_SAVE; - // TODO + _filesWidget.show(SAVEMODE_SAVE); } } // End of namespace Tattoo diff --git a/engines/sherlock/tattoo/tattoo_user_interface.h b/engines/sherlock/tattoo/tattoo_user_interface.h index 016398efd5..652e5b1da2 100644 --- a/engines/sherlock/tattoo/tattoo_user_interface.h +++ b/engines/sherlock/tattoo/tattoo_user_interface.h @@ -29,6 +29,7 @@ #include "sherlock/screen.h" #include "sherlock/user_interface.h" #include "sherlock/tattoo/widget_credits.h" +#include "sherlock/tattoo/widget_files.h" #include "sherlock/tattoo/widget_inventory.h" #include "sherlock/tattoo/widget_lab.h" #include "sherlock/tattoo/widget_options.h" @@ -51,9 +52,9 @@ class TattooUserInterface : public UserInterface { friend class WidgetBase; private: int _lockoutTimer; - SaveMode _fileMode; int _scriptZone; int _cAnimFramePause; + WidgetFiles _filesWidget; WidgetInventory _inventoryWidget; WidgetMessage _messageWidget; WidgetQuit _quitWidget; diff --git a/engines/sherlock/tattoo/widget_files.cpp b/engines/sherlock/tattoo/widget_files.cpp new file mode 100644 index 0000000000..37842bb98f --- /dev/null +++ b/engines/sherlock/tattoo/widget_files.cpp @@ -0,0 +1,73 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "sherlock/tattoo/widget_files.h" +#include "sherlock/tattoo/tattoo.h" +#include "sherlock/tattoo/tattoo_fixed_text.h" +#include "sherlock/tattoo/tattoo_scene.h" +#include "sherlock/tattoo/tattoo_user_interface.h" + +namespace Sherlock { + +namespace Tattoo { + +WidgetFiles::WidgetFiles(SherlockEngine *vm) : WidgetBase(vm) { +} + +void WidgetFiles::show(SaveMode mode) { + Events &events = *_vm->_events; + TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui; + Common::Point mousePos = events.mousePos(); + + _fileMode = mode; + + // Set up the display area + _bounds = Common::Rect(_surface.stringWidth(FIXED(AreYouSureYou)) + _surface.widestChar() * 2, + (_surface.fontHeight() + 7) * 4); + _bounds.moveTo(mousePos.x - _bounds.width() / 2, mousePos.y - _bounds.height() / 2); + + // Create the surface + _surface.create(_bounds.width(), _bounds.height()); + _surface.fill(TRANSPARENCY); + makeInfoArea(); + + + ui._menuMode = FILES_MODE; + summonWindow(); +} + +void WidgetFiles::handleEvents() { + //Events &events = *_vm->_events; + +} + +void WidgetFiles::close() { + TattooScene &scene = *(TattooScene *)_vm->_scene; + TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui; + + banishWindow(); + ui._menuMode = scene._labTableScene ? LAB_MODE : STD_MODE; +} + +} // End of namespace Tattoo + +} // End of namespace Sherlock diff --git a/engines/sherlock/tattoo/widget_files.h b/engines/sherlock/tattoo/widget_files.h new file mode 100644 index 0000000000..6ef5aab836 --- /dev/null +++ b/engines/sherlock/tattoo/widget_files.h @@ -0,0 +1,63 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef SHERLOCK_TATTOO_WIDGET_FILES_H +#define SHERLOCK_TATTOO_WIDGET_FILES_H + +#include "common/scummsys.h" +#include "sherlock/tattoo/widget_base.h" +#include "sherlock/saveload.h" + +namespace Sherlock { + +class SherlockEngine; + +namespace Tattoo { + +class WidgetFiles: public WidgetBase { +private: + SaveMode _fileMode; + + /** + * Close the dialog + */ + void close(); +public: + WidgetFiles(SherlockEngine *vm); + virtual ~WidgetFiles() {} + + /** + * Prompt the user whether to quit + */ + void show(SaveMode mode); + + /** + * Handle event processing + */ + virtual void handleEvents(); +}; + +} // End of namespace Tattoo + +} // End of namespace Sherlock + +#endif -- cgit v1.2.3