From 500877dac5c41f7171a8c35eb2e0740375e71d30 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 20 Jul 2015 07:47:48 -0400 Subject: SHERLOCK: RT: Beginnings of lab table widget class --- engines/sherlock/module.mk | 1 + engines/sherlock/tattoo/tattoo_scene.cpp | 3 ++ engines/sherlock/tattoo/tattoo_user_interface.cpp | 12 ++---- engines/sherlock/tattoo/tattoo_user_interface.h | 19 ++++----- engines/sherlock/tattoo/widget_lab.cpp | 43 +++++++++++++++++++ engines/sherlock/tattoo/widget_lab.h | 52 +++++++++++++++++++++++ 6 files changed, 110 insertions(+), 20 deletions(-) create mode 100644 engines/sherlock/tattoo/widget_lab.cpp create mode 100644 engines/sherlock/tattoo/widget_lab.h diff --git a/engines/sherlock/module.mk b/engines/sherlock/module.mk index 73067fdc14..32c5d3acc3 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_inventory.o \ + tattoo/widget_lab.o \ tattoo/widget_talk.o \ tattoo/widget_text.o \ tattoo/widget_tooltip.o \ diff --git a/engines/sherlock/tattoo/tattoo_scene.cpp b/engines/sherlock/tattoo/tattoo_scene.cpp index 0f61109c9d..a171da10cc 100644 --- a/engines/sherlock/tattoo/tattoo_scene.cpp +++ b/engines/sherlock/tattoo/tattoo_scene.cpp @@ -101,6 +101,9 @@ bool TattooScene::loadScene(const Common::String &filename) { // Set the menu/ui mode and whether we're in a lab table close-up scene _labTableScene = _currentScene > 91 && _currentScene < 100; ui._menuMode = _labTableScene ? LAB_MODE : STD_MODE; + + if (_labTableScene) + ui._labWidget.summonWindow(); } return result; diff --git a/engines/sherlock/tattoo/tattoo_user_interface.cpp b/engines/sherlock/tattoo/tattoo_user_interface.cpp index 779c9ab5fb..e846db2701 100644 --- a/engines/sherlock/tattoo/tattoo_user_interface.cpp +++ b/engines/sherlock/tattoo/tattoo_user_interface.cpp @@ -30,7 +30,8 @@ namespace Sherlock { namespace Tattoo { TattooUserInterface::TattooUserInterface(SherlockEngine *vm): UserInterface(vm), - _inventoryWidget(vm), _messageWidget(vm), _textWidget(vm), _tooltipWidget(vm), _verbsWidget(vm) { + _inventoryWidget(vm), _messageWidget(vm), _textWidget(vm), _tooltipWidget(vm), _verbsWidget(vm), + _labWidget(vm) { Common::fill(&_lookupTable[0], &_lookupTable[PALETTE_COUNT], 0); Common::fill(&_lookupTable1[0], &_lookupTable1[PALETTE_COUNT], 0); _scrollSize = 0; @@ -223,6 +224,7 @@ void TattooUserInterface::reset() { UserInterface::reset(); _lookPos = Common::Point(SHERLOCK_SCREEN_WIDTH / 2, SHERLOCK_SCREEN_HEIGHT / 2); _tooltipWidget.setText(""); + _widgets.clear(); } void TattooUserInterface::handleInput() { @@ -281,9 +283,6 @@ void TattooUserInterface::handleInput() { case FILES_MODE: doFileControl(); break; - case LAB_MODE: - doLabControl(); - break; default: break; } @@ -357,7 +356,6 @@ void TattooUserInterface::doStandardControl() { Events &events = *_vm->_events; People &people = *_vm->_people; TattooScene &scene = *(TattooScene *)_vm->_scene; - Screen &screen = *_vm->_screen; Talk &talk = *_vm->_talk; Common::Point mousePos = events.mousePos(); bool noDesc = false; @@ -528,10 +526,6 @@ void TattooUserInterface::doFileControl() { warning("TODO: ui control (file)"); } -void TattooUserInterface::doLabControl() { - warning("TODO: ui control (lab)"); -} - void TattooUserInterface::displayObjectNames() { Events &events = *_vm->_events; Scene &scene = *_vm->_scene; diff --git a/engines/sherlock/tattoo/tattoo_user_interface.h b/engines/sherlock/tattoo/tattoo_user_interface.h index 436158092e..7f284531de 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_inventory.h" +#include "sherlock/tattoo/widget_lab.h" #include "sherlock/tattoo/widget_text.h" #include "sherlock/tattoo/widget_tooltip.h" #include "sherlock/tattoo/widget_verbs.h" @@ -77,17 +78,6 @@ private: * Handle input while the verb menu is open */ void doVerbControl(); - - /** - * Handles input when the player is in the Lab Table scene - */ - void doLabControl(); - - /** - * If the mouse cursor is point at the cursor, then display the name of the object on the screen. - * If there is no object being pointed it, clear any previously displayed name - */ - void displayObjectNames(); /** * Set up to display the Files menu @@ -119,6 +109,7 @@ public: int _maskCounter; ImageFile *_interfaceImages; WidgetText _textWidget; + WidgetLab _labWidget; public: TattooUserInterface(SherlockEngine *vm); virtual ~TattooUserInterface(); @@ -196,6 +187,12 @@ public: * Draws all the dialog rectangles for any items that need them */ void drawDialogRect(Surface &s, const Common::Rect &r, bool raised); + + /** + * If the mouse cursor is point at the cursor, then display the name of the object on the screen. + * If there is no object being pointed it, clear any previously displayed name + */ + void displayObjectNames(); public: /** * Resets the user interface diff --git a/engines/sherlock/tattoo/widget_lab.cpp b/engines/sherlock/tattoo/widget_lab.cpp new file mode 100644 index 0000000000..47955a0d26 --- /dev/null +++ b/engines/sherlock/tattoo/widget_lab.cpp @@ -0,0 +1,43 @@ +/* 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_lab.h" +#include "sherlock/tattoo/tattoo_user_interface.h" +#include "sherlock/tattoo/tattoo.h" + +namespace Sherlock { + +namespace Tattoo { + +WidgetLab::WidgetLab(SherlockEngine *vm) : WidgetBase(vm) { +} + +void WidgetLab::handleEvents() { + Events &events = *_vm->_events; + TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui; + WidgetBase::handleEvents(); + +} + +} // End of namespace Tattoo + +} // End of namespace Sherlock diff --git a/engines/sherlock/tattoo/widget_lab.h b/engines/sherlock/tattoo/widget_lab.h new file mode 100644 index 0000000000..344dae7934 --- /dev/null +++ b/engines/sherlock/tattoo/widget_lab.h @@ -0,0 +1,52 @@ +/* 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_LAB_H +#define SHERLOCK_TATTOO_WIDGET_LAB_H + +#include "common/scummsys.h" +#include "sherlock/tattoo/widget_base.h" + +namespace Sherlock { + +class SherlockEngine; + +namespace Tattoo { + +class WidgetLab: public WidgetBase { +public: + Common::String _remainingText; +public: + WidgetLab(SherlockEngine *vm); + virtual ~WidgetLab() {} + + /** + * Handle event processing + */ + virtual void handleEvents(); +}; + +} // End of namespace Tattoo + +} // End of namespace Sherlock + +#endif -- cgit v1.2.3