Skip to content

Commit

Permalink
SHERLOCK: RT: Implemented WidgetVerbs execute
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Jun 17, 2015
1 parent 3e5e63f commit 09bd10c
Show file tree
Hide file tree
Showing 14 changed files with 319 additions and 66 deletions.
4 changes: 4 additions & 0 deletions engines/sherlock/events.cpp
Expand Up @@ -41,6 +41,7 @@ Events::Events(SherlockEngine *vm): _vm(vm) {
_pressed = _released = false;
_rightPressed = _rightReleased = false;
_oldButtons = _oldRightButton = false;
_firstPress = false;

if (_vm->_interactiveFl)
loadCursors("rmouse.vgs");
Expand Down Expand Up @@ -205,6 +206,7 @@ void Events::clearEvents() {
_pressed = _released = false;
_rightPressed = _rightReleased = false;
_oldButtons = _oldRightButton = false;
_firstPress = false;
}

void Events::clearKeyboard() {
Expand Down Expand Up @@ -246,6 +248,8 @@ bool Events::delay(uint32 time, bool interruptable) {
}

void Events::setButtonState() {
_firstPress = ((_mouseButtons & 1) && !_pressed) || ((_mouseButtons & 2) && !_rightPressed);

_released = _rightReleased = false;
if (_mouseButtons & LEFT_BUTTON)
_pressed = _oldButtons = true;
Expand Down
1 change: 1 addition & 0 deletions engines/sherlock/events.h
Expand Up @@ -57,6 +57,7 @@ class Events {
bool _rightReleased;
bool _oldButtons;
bool _oldRightButton;
bool _firstPress;
Common::Stack<Common::KeyState> _pendingKeys;
public:
Events(SherlockEngine *vm);
Expand Down
21 changes: 18 additions & 3 deletions engines/sherlock/fixed_text.cpp
Expand Up @@ -65,7 +65,12 @@ static const char *const fixedTextEN[] = {
"A letter folded many times",
"Tarot Cards",
"An ornate key",
"A pawn ticket"
"A pawn ticket",
// Verbs
"Open",
"Look",
"Talk",
"Journal"
};

// sharp-s : 0xE1 / octal 341
Expand Down Expand Up @@ -112,7 +117,12 @@ static const char *const fixedTextDE[] = {
"Ein mehrfach gefalteter Briefbogen",
"Ein Tarock-Kartenspiel", // [sic]
"Ein verzierter Schl\201ssel",
"Ein Pfandschein"
"Ein Pfandschein",
// Verbs
"Open",
"Look",
"Talk",
"Journal"
};

// up-side down exclamation mark - 0xAD / octal 255
Expand Down Expand Up @@ -158,7 +168,12 @@ static const char *const fixedTextES[] = {
"Un carta muy plegada",
"Unas cartas de Tarot",
"Una llave muy vistosa",
"Una papeleta de empe\244o"
"Una papeleta de empe\244o",
// Verbs
"Open",
"Look",
"Talk",
"Journal"
};

// =========================================
Expand Down
7 changes: 6 additions & 1 deletion engines/sherlock/fixed_text.h
Expand Up @@ -68,7 +68,12 @@ enum FixedTextId {
kFixedText_InitInventory_Letter,
kFixedText_InitInventory_Tarot,
kFixedText_InitInventory_OrnateKey,
kFixedText_InitInventory_PawnTicket
kFixedText_InitInventory_PawnTicket,
// Verbs
kFixedText_Verb_Open,
kFixedText_Verb_Look,
kFixedText_Verb_Talk,
kFixedText_Verb_Journal
};

enum FixedTextActionId {
Expand Down
1 change: 1 addition & 0 deletions engines/sherlock/module.mk
Expand Up @@ -21,6 +21,7 @@ MODULE_OBJS = \
tattoo/tattoo_scene.o \
tattoo/tattoo_talk.o \
tattoo/tattoo_user_interface.o \
tattoo/widget_base.o \
tattoo/widget_tooltip.o \
tattoo/widget_verbs.o \
animation.o \
Expand Down
24 changes: 12 additions & 12 deletions engines/sherlock/tattoo/tattoo_user_interface.cpp
Expand Up @@ -52,6 +52,14 @@ void TattooUserInterface::initScrollVars() {
_targetScroll.x = _targetScroll.y = 0;
}

void TattooUserInterface::lookAtObject() {
// TODO
}

void TattooUserInterface::doJournal() {
// TODO
}

void TattooUserInterface::handleInput() {
TattooEngine &vm = *(TattooEngine *)_vm;
Events &events = *_vm->_events;
Expand Down Expand Up @@ -365,7 +373,7 @@ if (!flag && events._released) {

if (events._rightReleased) {
// Show the verbs menu for the highlighted object
activateVerbMenu(!noDesc);
_verbsWidget.activateVerbMenu(!noDesc);
} else if (_personFound || (_bgFound != -1 && _bgFound < 1000 && _bgShape->_aType == PERSON)) {
// The object found is a person (the default for people is TALK)
talk.talk(_bgFound);
Expand Down Expand Up @@ -455,10 +463,6 @@ void TattooUserInterface::turnTextOff() {
// TODO
}

void TattooUserInterface::doJournal() {
// TODO
}

void TattooUserInterface::doInventory(int mode) {
// TODO
}
Expand All @@ -467,15 +471,11 @@ void TattooUserInterface::doControls() {
// TODO
}

void TattooUserInterface::doQuitMenu() {
// TODO
void TattooUserInterface::pickUpObject(int objNum) {
// TOOD
}

void TattooUserInterface::activateVerbMenu(bool objectsOn) {
// TODO
}

void TattooUserInterface::lookAtObject() {
void TattooUserInterface::doQuitMenu() {
// TODO
}

Expand Down
60 changes: 30 additions & 30 deletions engines/sherlock/tattoo/tattoo_user_interface.h
Expand Up @@ -45,14 +45,10 @@ class TattooUserInterface : public UserInterface {
Surface *_invMenuBuffer;
Surface *_invGraphic;
Common::Array<Common::Rect> _grayAreas;
Object *_bgShape;
bool _personFound;
int _lockoutTimer;
Common::KeyState _keyState;
SaveMode _fileMode;
int _exitZone;
int _scriptZone;
int _activeObj;
WidgetTooltip _tooltipWidget;
WidgetVerbs _verbsWidget;
private:
Expand Down Expand Up @@ -118,42 +114,20 @@ class TattooUserInterface : public UserInterface {
*/
void turnTextOff();

/**
* Handles displaying the journal
*/
void doJournal();

/**
* Put the game in inventory mode by opening the inventory dialog
*/
void doInventory(int mode);

/**
* Handle the display of the options/setup menu
*/
void doControls();

/**
* Handle displaying the quit menu
*/
void doQuitMenu();

/**
* Turn on the command menu showing available actions that can be done on a given item
*/
void activateVerbMenu(bool objectsOn);

/**
* Display the long description for an object stored in it's _examine field, in a window that
* will be shown at the bottom of the screen
*/
void lookAtObject();
public:
Common::Point _currentScroll, _targetScroll;
int _scrollSize, _scrollSpeed;
bool _drawMenu;
int _bgFound, _oldBgFound;
int _arrowZone, _oldArrowZone;
Object *_bgShape;
bool _personFound;
int _activeObj;
Common::KeyState _keyState;
public:
TattooUserInterface(SherlockEngine *vm);

Expand All @@ -171,6 +145,32 @@ class TattooUserInterface : public UserInterface {
* Initializes scroll variables
*/
void initScrollVars();

/**
* Display the long description for an object stored in it's _examine field, in a window that
* will be shown at the bottom of the screen
*/
void lookAtObject();

/**
* Handles displaying the journal
*/
void doJournal();

/**
* Put the game in inventory mode by opening the inventory dialog
*/
void doInventory(int mode);

/**
* Handle the display of the options/setup menu
*/
void doControls();

/**
* Pick up the selected object
*/
void pickUpObject(int objNum);
public:
virtual ~TattooUserInterface() {}

Expand Down
39 changes: 39 additions & 0 deletions engines/sherlock/tattoo/widget_base.cpp
@@ -0,0 +1,39 @@
/* 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_base.h"
#include "sherlock/tattoo/tattoo.h"

namespace Sherlock {

namespace Tattoo {

WidgetBase::WidgetBase(SherlockEngine *vm) : _vm(vm) {
}

void WidgetBase::banishWindow() {
// TODO
}

} // End of namespace Tattoo

} // End of namespace Sherlock
55 changes: 55 additions & 0 deletions engines/sherlock/tattoo/widget_base.h
@@ -0,0 +1,55 @@
/* 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_BASE_H
#define SHERLOCK_TATTOO_WIDGET_BASE_H

#include "common/scummsys.h"
#include "common/rect.h"
#include "common/str-array.h"
#include "sherlock/surface.h"

namespace Sherlock {

class SherlockEngine;

namespace Tattoo {

class WidgetBase {
protected:
SherlockEngine *_vm;
Common::Rect _bounds, _oldBounds;
Surface _surface;
public:
WidgetBase(SherlockEngine *vm);

/**
* Close a currently active menu
*/
void banishWindow();
};

} // End of namespace Tattoo

} // End of namespace Sherlock

#endif
2 changes: 1 addition & 1 deletion engines/sherlock/tattoo/widget_tooltip.cpp
Expand Up @@ -28,7 +28,7 @@ namespace Sherlock {

namespace Tattoo {

WidgetTooltip::WidgetTooltip(SherlockEngine *vm) : _vm(vm) {
WidgetTooltip::WidgetTooltip(SherlockEngine *vm) : WidgetBase(vm) {
}

void WidgetTooltip::execute() {
Expand Down
8 changes: 2 additions & 6 deletions engines/sherlock/tattoo/widget_tooltip.h
Expand Up @@ -25,19 +25,15 @@

#include "common/scummsys.h"
#include "common/rect.h"
#include "sherlock/surface.h"
#include "sherlock/tattoo/widget_base.h"

namespace Sherlock {

class SherlockEngine;

namespace Tattoo {

class WidgetTooltip {
private:
SherlockEngine *_vm;
Common::Rect _bounds, _oldBounds;
Surface _surface;
class WidgetTooltip: public WidgetBase {
public:
WidgetTooltip(SherlockEngine *vm);

Expand Down

0 comments on commit 09bd10c

Please sign in to comment.