SHERLOCK: RT: Implemented WidgetVerbs execute
This commit is contained in:
parent
3e5e63fa4a
commit
09bd10c6cb
14 changed files with 320 additions and 67 deletions
|
@ -41,6 +41,7 @@ Events::Events(SherlockEngine *vm): _vm(vm) {
|
||||||
_pressed = _released = false;
|
_pressed = _released = false;
|
||||||
_rightPressed = _rightReleased = false;
|
_rightPressed = _rightReleased = false;
|
||||||
_oldButtons = _oldRightButton = false;
|
_oldButtons = _oldRightButton = false;
|
||||||
|
_firstPress = false;
|
||||||
|
|
||||||
if (_vm->_interactiveFl)
|
if (_vm->_interactiveFl)
|
||||||
loadCursors("rmouse.vgs");
|
loadCursors("rmouse.vgs");
|
||||||
|
@ -205,6 +206,7 @@ void Events::clearEvents() {
|
||||||
_pressed = _released = false;
|
_pressed = _released = false;
|
||||||
_rightPressed = _rightReleased = false;
|
_rightPressed = _rightReleased = false;
|
||||||
_oldButtons = _oldRightButton = false;
|
_oldButtons = _oldRightButton = false;
|
||||||
|
_firstPress = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Events::clearKeyboard() {
|
void Events::clearKeyboard() {
|
||||||
|
@ -246,6 +248,8 @@ bool Events::delay(uint32 time, bool interruptable) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Events::setButtonState() {
|
void Events::setButtonState() {
|
||||||
|
_firstPress = ((_mouseButtons & 1) && !_pressed) || ((_mouseButtons & 2) && !_rightPressed);
|
||||||
|
|
||||||
_released = _rightReleased = false;
|
_released = _rightReleased = false;
|
||||||
if (_mouseButtons & LEFT_BUTTON)
|
if (_mouseButtons & LEFT_BUTTON)
|
||||||
_pressed = _oldButtons = true;
|
_pressed = _oldButtons = true;
|
||||||
|
|
|
@ -57,6 +57,7 @@ public:
|
||||||
bool _rightReleased;
|
bool _rightReleased;
|
||||||
bool _oldButtons;
|
bool _oldButtons;
|
||||||
bool _oldRightButton;
|
bool _oldRightButton;
|
||||||
|
bool _firstPress;
|
||||||
Common::Stack<Common::KeyState> _pendingKeys;
|
Common::Stack<Common::KeyState> _pendingKeys;
|
||||||
public:
|
public:
|
||||||
Events(SherlockEngine *vm);
|
Events(SherlockEngine *vm);
|
||||||
|
|
|
@ -65,7 +65,12 @@ static const char *const fixedTextEN[] = {
|
||||||
"A letter folded many times",
|
"A letter folded many times",
|
||||||
"Tarot Cards",
|
"Tarot Cards",
|
||||||
"An ornate key",
|
"An ornate key",
|
||||||
"A pawn ticket"
|
"A pawn ticket",
|
||||||
|
// Verbs
|
||||||
|
"Open",
|
||||||
|
"Look",
|
||||||
|
"Talk",
|
||||||
|
"Journal"
|
||||||
};
|
};
|
||||||
|
|
||||||
// sharp-s : 0xE1 / octal 341
|
// sharp-s : 0xE1 / octal 341
|
||||||
|
@ -112,7 +117,12 @@ static const char *const fixedTextDE[] = {
|
||||||
"Ein mehrfach gefalteter Briefbogen",
|
"Ein mehrfach gefalteter Briefbogen",
|
||||||
"Ein Tarock-Kartenspiel", // [sic]
|
"Ein Tarock-Kartenspiel", // [sic]
|
||||||
"Ein verzierter Schl\201ssel",
|
"Ein verzierter Schl\201ssel",
|
||||||
"Ein Pfandschein"
|
"Ein Pfandschein",
|
||||||
|
// Verbs
|
||||||
|
"Open",
|
||||||
|
"Look",
|
||||||
|
"Talk",
|
||||||
|
"Journal"
|
||||||
};
|
};
|
||||||
|
|
||||||
// up-side down exclamation mark - 0xAD / octal 255
|
// up-side down exclamation mark - 0xAD / octal 255
|
||||||
|
@ -158,7 +168,12 @@ static const char *const fixedTextES[] = {
|
||||||
"Un carta muy plegada",
|
"Un carta muy plegada",
|
||||||
"Unas cartas de Tarot",
|
"Unas cartas de Tarot",
|
||||||
"Una llave muy vistosa",
|
"Una llave muy vistosa",
|
||||||
"Una papeleta de empe\244o"
|
"Una papeleta de empe\244o",
|
||||||
|
// Verbs
|
||||||
|
"Open",
|
||||||
|
"Look",
|
||||||
|
"Talk",
|
||||||
|
"Journal"
|
||||||
};
|
};
|
||||||
|
|
||||||
// =========================================
|
// =========================================
|
||||||
|
|
|
@ -68,7 +68,12 @@ enum FixedTextId {
|
||||||
kFixedText_InitInventory_Letter,
|
kFixedText_InitInventory_Letter,
|
||||||
kFixedText_InitInventory_Tarot,
|
kFixedText_InitInventory_Tarot,
|
||||||
kFixedText_InitInventory_OrnateKey,
|
kFixedText_InitInventory_OrnateKey,
|
||||||
kFixedText_InitInventory_PawnTicket
|
kFixedText_InitInventory_PawnTicket,
|
||||||
|
// Verbs
|
||||||
|
kFixedText_Verb_Open,
|
||||||
|
kFixedText_Verb_Look,
|
||||||
|
kFixedText_Verb_Talk,
|
||||||
|
kFixedText_Verb_Journal
|
||||||
};
|
};
|
||||||
|
|
||||||
enum FixedTextActionId {
|
enum FixedTextActionId {
|
||||||
|
|
|
@ -21,6 +21,7 @@ MODULE_OBJS = \
|
||||||
tattoo/tattoo_scene.o \
|
tattoo/tattoo_scene.o \
|
||||||
tattoo/tattoo_talk.o \
|
tattoo/tattoo_talk.o \
|
||||||
tattoo/tattoo_user_interface.o \
|
tattoo/tattoo_user_interface.o \
|
||||||
|
tattoo/widget_base.o \
|
||||||
tattoo/widget_tooltip.o \
|
tattoo/widget_tooltip.o \
|
||||||
tattoo/widget_verbs.o \
|
tattoo/widget_verbs.o \
|
||||||
animation.o \
|
animation.o \
|
||||||
|
|
|
@ -52,6 +52,14 @@ void TattooUserInterface::initScrollVars() {
|
||||||
_targetScroll.x = _targetScroll.y = 0;
|
_targetScroll.x = _targetScroll.y = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TattooUserInterface::lookAtObject() {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
void TattooUserInterface::doJournal() {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
void TattooUserInterface::handleInput() {
|
void TattooUserInterface::handleInput() {
|
||||||
TattooEngine &vm = *(TattooEngine *)_vm;
|
TattooEngine &vm = *(TattooEngine *)_vm;
|
||||||
Events &events = *_vm->_events;
|
Events &events = *_vm->_events;
|
||||||
|
@ -365,7 +373,7 @@ if (!flag && events._released) {
|
||||||
|
|
||||||
if (events._rightReleased) {
|
if (events._rightReleased) {
|
||||||
// Show the verbs menu for the highlighted object
|
// Show the verbs menu for the highlighted object
|
||||||
activateVerbMenu(!noDesc);
|
_verbsWidget.activateVerbMenu(!noDesc);
|
||||||
} else if (_personFound || (_bgFound != -1 && _bgFound < 1000 && _bgShape->_aType == PERSON)) {
|
} else if (_personFound || (_bgFound != -1 && _bgFound < 1000 && _bgShape->_aType == PERSON)) {
|
||||||
// The object found is a person (the default for people is TALK)
|
// The object found is a person (the default for people is TALK)
|
||||||
talk.talk(_bgFound);
|
talk.talk(_bgFound);
|
||||||
|
@ -455,10 +463,6 @@ void TattooUserInterface::turnTextOff() {
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
void TattooUserInterface::doJournal() {
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
void TattooUserInterface::doInventory(int mode) {
|
void TattooUserInterface::doInventory(int mode) {
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
@ -467,18 +471,14 @@ void TattooUserInterface::doControls() {
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TattooUserInterface::pickUpObject(int objNum) {
|
||||||
|
// TOOD
|
||||||
|
}
|
||||||
|
|
||||||
void TattooUserInterface::doQuitMenu() {
|
void TattooUserInterface::doQuitMenu() {
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
void TattooUserInterface::activateVerbMenu(bool objectsOn) {
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
void TattooUserInterface::lookAtObject() {
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
} // End of namespace Tattoo
|
} // End of namespace Tattoo
|
||||||
|
|
||||||
} // End of namespace Sherlock
|
} // End of namespace Sherlock
|
||||||
|
|
|
@ -45,14 +45,10 @@ private:
|
||||||
Surface *_invMenuBuffer;
|
Surface *_invMenuBuffer;
|
||||||
Surface *_invGraphic;
|
Surface *_invGraphic;
|
||||||
Common::Array<Common::Rect> _grayAreas;
|
Common::Array<Common::Rect> _grayAreas;
|
||||||
Object *_bgShape;
|
|
||||||
bool _personFound;
|
|
||||||
int _lockoutTimer;
|
int _lockoutTimer;
|
||||||
Common::KeyState _keyState;
|
|
||||||
SaveMode _fileMode;
|
SaveMode _fileMode;
|
||||||
int _exitZone;
|
int _exitZone;
|
||||||
int _scriptZone;
|
int _scriptZone;
|
||||||
int _activeObj;
|
|
||||||
WidgetTooltip _tooltipWidget;
|
WidgetTooltip _tooltipWidget;
|
||||||
WidgetVerbs _verbsWidget;
|
WidgetVerbs _verbsWidget;
|
||||||
private:
|
private:
|
||||||
|
@ -118,42 +114,20 @@ private:
|
||||||
*/
|
*/
|
||||||
void turnTextOff();
|
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
|
* Handle displaying the quit menu
|
||||||
*/
|
*/
|
||||||
void doQuitMenu();
|
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:
|
public:
|
||||||
Common::Point _currentScroll, _targetScroll;
|
Common::Point _currentScroll, _targetScroll;
|
||||||
int _scrollSize, _scrollSpeed;
|
int _scrollSize, _scrollSpeed;
|
||||||
bool _drawMenu;
|
bool _drawMenu;
|
||||||
int _bgFound, _oldBgFound;
|
int _bgFound, _oldBgFound;
|
||||||
int _arrowZone, _oldArrowZone;
|
int _arrowZone, _oldArrowZone;
|
||||||
|
Object *_bgShape;
|
||||||
|
bool _personFound;
|
||||||
|
int _activeObj;
|
||||||
|
Common::KeyState _keyState;
|
||||||
public:
|
public:
|
||||||
TattooUserInterface(SherlockEngine *vm);
|
TattooUserInterface(SherlockEngine *vm);
|
||||||
|
|
||||||
|
@ -171,6 +145,32 @@ public:
|
||||||
* Initializes scroll variables
|
* Initializes scroll variables
|
||||||
*/
|
*/
|
||||||
void initScrollVars();
|
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:
|
public:
|
||||||
virtual ~TattooUserInterface() {}
|
virtual ~TattooUserInterface() {}
|
||||||
|
|
||||||
|
|
39
engines/sherlock/tattoo/widget_base.cpp
Normal file
39
engines/sherlock/tattoo/widget_base.cpp
Normal file
|
@ -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
engines/sherlock/tattoo/widget_base.h
Normal file
55
engines/sherlock/tattoo/widget_base.h
Normal file
|
@ -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
|
|
@ -28,7 +28,7 @@ namespace Sherlock {
|
||||||
|
|
||||||
namespace Tattoo {
|
namespace Tattoo {
|
||||||
|
|
||||||
WidgetTooltip::WidgetTooltip(SherlockEngine *vm) : _vm(vm) {
|
WidgetTooltip::WidgetTooltip(SherlockEngine *vm) : WidgetBase(vm) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void WidgetTooltip::execute() {
|
void WidgetTooltip::execute() {
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
#include "common/scummsys.h"
|
#include "common/scummsys.h"
|
||||||
#include "common/rect.h"
|
#include "common/rect.h"
|
||||||
#include "sherlock/surface.h"
|
#include "sherlock/tattoo/widget_base.h"
|
||||||
|
|
||||||
namespace Sherlock {
|
namespace Sherlock {
|
||||||
|
|
||||||
|
@ -33,11 +33,7 @@ class SherlockEngine;
|
||||||
|
|
||||||
namespace Tattoo {
|
namespace Tattoo {
|
||||||
|
|
||||||
class WidgetTooltip {
|
class WidgetTooltip: public WidgetBase {
|
||||||
private:
|
|
||||||
SherlockEngine *_vm;
|
|
||||||
Common::Rect _bounds, _oldBounds;
|
|
||||||
Surface _surface;
|
|
||||||
public:
|
public:
|
||||||
WidgetTooltip(SherlockEngine *vm);
|
WidgetTooltip(SherlockEngine *vm);
|
||||||
|
|
||||||
|
|
|
@ -21,27 +21,158 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "sherlock/tattoo/widget_verbs.h"
|
#include "sherlock/tattoo/widget_verbs.h"
|
||||||
|
#include "sherlock/tattoo/tattoo_scene.h"
|
||||||
|
#include "sherlock/tattoo/tattoo_user_interface.h"
|
||||||
#include "sherlock/tattoo/tattoo.h"
|
#include "sherlock/tattoo/tattoo.h"
|
||||||
|
|
||||||
namespace Sherlock {
|
namespace Sherlock {
|
||||||
|
|
||||||
namespace Tattoo {
|
namespace Tattoo {
|
||||||
|
|
||||||
WidgetVerbs::WidgetVerbs(SherlockEngine *vm) : _vm(vm) {
|
WidgetVerbs::WidgetVerbs(SherlockEngine *vm) : WidgetBase(vm) {
|
||||||
_selector = _oldSelector = -1;
|
_selector = _oldSelector = -1;
|
||||||
|
_outsideMenu = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void WidgetVerbs::activateVerbMenu(bool objectsOn) {
|
||||||
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
void WidgetVerbs::execute() {
|
void WidgetVerbs::execute() {
|
||||||
|
Events &events = *_vm->_events;
|
||||||
|
FixedText &fixedText = *_vm->_fixedText;
|
||||||
|
People &people = *_vm->_people;
|
||||||
|
TattooScene &scene = *(TattooScene *)_vm->_scene;
|
||||||
|
Talk &talk = *_vm->_talk;
|
||||||
|
TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui;
|
||||||
|
Common::Point mousePos = events.mousePos();
|
||||||
|
Common::Point scenePos = mousePos + ui._currentScroll;
|
||||||
|
bool noDesc = false;
|
||||||
|
|
||||||
|
Common::String strLook = fixedText.getText(kFixedText_Verb_Look);
|
||||||
|
Common::String strTalk = fixedText.getText(kFixedText_Verb_Talk);
|
||||||
|
Common::String strJournal = fixedText.getText(kFixedText_Verb_Journal);
|
||||||
|
|
||||||
checkTabbingKeys(_verbCommands.size());
|
checkTabbingKeys(_verbCommands.size());
|
||||||
|
|
||||||
// Highlight verb display as necessary
|
// Highlight verb display as necessary
|
||||||
highlightVerbControls();
|
highlightVerbControls();
|
||||||
|
|
||||||
// TODO
|
// Flag if the user has started pressing the button with the cursor outsie the menu
|
||||||
|
if (events._firstPress && !_bounds.contains(mousePos))
|
||||||
|
_outsideMenu = true;
|
||||||
|
|
||||||
|
// See if they released the mouse button
|
||||||
|
if (events._released || events._released) {
|
||||||
|
// See if they want to close the menu (they clicked outside of the menu)
|
||||||
|
if (!_bounds.contains(mousePos)) {
|
||||||
|
if (_outsideMenu) {
|
||||||
|
// Free the current menu graphics & erase the menu
|
||||||
|
banishWindow();
|
||||||
|
|
||||||
|
if (events._rightReleased) {
|
||||||
|
// Reset the selected shape to what was clicked on
|
||||||
|
ui._bgFound = scene.findBgShape(scenePos);
|
||||||
|
ui._personFound = ui._bgFound >= 1000;
|
||||||
|
Object *_bgShape = ui._personFound ? nullptr : &scene._bgShapes[ui._bgFound];
|
||||||
|
|
||||||
|
if (ui._personFound) {
|
||||||
|
if (people[ui._bgFound - 1000]._description.empty() || people[ui._bgFound - 1000]._description.hasPrefix(" "))
|
||||||
|
noDesc = true;
|
||||||
|
} else if (ui._bgFound != -1) {
|
||||||
|
if (_bgShape->_description.empty() || _bgShape->_description.hasPrefix(" "))
|
||||||
|
noDesc = true;
|
||||||
|
} else {
|
||||||
|
noDesc = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Call the Routine to turn on the Commands for this Object
|
||||||
|
activateVerbMenu(!noDesc);
|
||||||
|
} else {
|
||||||
|
// See if we're in a Lab Table Room
|
||||||
|
ui._menuMode = scene._labTableScene ? LAB_MODE : STD_MODE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (_bounds.contains(mousePos)) {
|
||||||
|
// Mouse is within the menu
|
||||||
|
// Erase the menu
|
||||||
|
banishWindow();
|
||||||
|
|
||||||
|
// See if they are activating the Look Command
|
||||||
|
if (!_verbCommands[_selector].compareToIgnoreCase(strLook)) {
|
||||||
|
ui._bgFound = ui._activeObj;
|
||||||
|
if (ui._activeObj >= 1000) {
|
||||||
|
ui._personFound = true;
|
||||||
|
} else {
|
||||||
|
ui._personFound = false;
|
||||||
|
ui._bgShape = &scene._bgShapes[ui._activeObj];
|
||||||
|
}
|
||||||
|
|
||||||
|
ui.lookAtObject();
|
||||||
|
|
||||||
|
} else if (!_verbCommands[_selector].compareToIgnoreCase(strTalk)) {
|
||||||
|
// Talk command is being activated
|
||||||
|
talk.talk(ui._activeObj);
|
||||||
|
ui._activeObj = -1;
|
||||||
|
|
||||||
|
} else if (!_verbCommands[_selector].compareToIgnoreCase(strJournal)) {
|
||||||
|
ui.doJournal();
|
||||||
|
|
||||||
|
// See if we're in a Lab Table scene
|
||||||
|
ui._menuMode = scene._labTableScene ? LAB_MODE : STD_MODE;
|
||||||
|
} else if (_selector >= ((int)_verbCommands.size() - 2)) {
|
||||||
|
switch (_selector - (int)_verbCommands.size() + 2) {
|
||||||
|
case 0:
|
||||||
|
// Inventory
|
||||||
|
ui.doInventory(2);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
// Options
|
||||||
|
ui.doControls();
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
ui._menuMode = scene._labTableScene ? LAB_MODE : STD_MODE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// If they have selected anything else, process it
|
||||||
|
people[HOLMES].gotoStand();
|
||||||
|
|
||||||
|
if (ui._activeObj < 1000) {
|
||||||
|
for (int idx = 0; idx < 6; ++idx) {
|
||||||
|
if (!_verbCommands[_selector].compareToIgnoreCase(scene._bgShapes[ui._activeObj]._use[idx]._verb)) {
|
||||||
|
// See if they are Picking this object up
|
||||||
|
if (!scene._bgShapes[ui._activeObj]._use[idx]._target.compareToIgnoreCase("*PICKUP"))
|
||||||
|
ui.pickUpObject(ui._activeObj);
|
||||||
|
else
|
||||||
|
ui.checkAction(scene._bgShapes[ui._activeObj]._use[idx], ui._activeObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (int idx = 0; idx < 2; ++idx) {
|
||||||
|
if (!_verbCommands[_selector].compareToIgnoreCase(people[ui._activeObj - 1000]._use[idx]._verb))
|
||||||
|
ui.checkAction(people[ui._activeObj - 1000]._use[idx], ui._activeObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ui._activeObj = -1;
|
||||||
|
if (ui._menuMode != MESSAGE_MODE) {
|
||||||
|
// See if we're in a Lab Table Room
|
||||||
|
ui._menuMode = scene._labTableScene ? LAB_MODE : STD_MODE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (ui._keyState.keycode == Common::KEYCODE_ESCAPE) {
|
||||||
|
// User closing the menu with the ESC key
|
||||||
|
banishWindow();
|
||||||
|
ui._menuMode = scene._labTableScene ? LAB_MODE : STD_MODE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WidgetVerbs::checkTabbingKeys(int numOptions) {
|
void WidgetVerbs::checkTabbingKeys(int numOptions) {
|
||||||
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
void WidgetVerbs::highlightVerbControls() {
|
void WidgetVerbs::highlightVerbControls() {
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
#include "common/scummsys.h"
|
#include "common/scummsys.h"
|
||||||
#include "common/rect.h"
|
#include "common/rect.h"
|
||||||
#include "common/str-array.h"
|
#include "common/str-array.h"
|
||||||
#include "sherlock/surface.h"
|
#include "sherlock/tattoo/widget_base.h"
|
||||||
|
|
||||||
namespace Sherlock {
|
namespace Sherlock {
|
||||||
|
|
||||||
|
@ -34,12 +34,10 @@ class SherlockEngine;
|
||||||
|
|
||||||
namespace Tattoo {
|
namespace Tattoo {
|
||||||
|
|
||||||
class WidgetVerbs {
|
class WidgetVerbs: public WidgetBase {
|
||||||
private:
|
private:
|
||||||
SherlockEngine *_vm;
|
|
||||||
Common::Rect _bounds;
|
|
||||||
Surface _surface;
|
|
||||||
int _selector, _oldSelector;
|
int _selector, _oldSelector;
|
||||||
|
bool _outsideMenu;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Highlights the controls for the verb list
|
* Highlights the controls for the verb list
|
||||||
|
@ -50,6 +48,14 @@ public:
|
||||||
public:
|
public:
|
||||||
WidgetVerbs(SherlockEngine *vm);
|
WidgetVerbs(SherlockEngine *vm);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Turns on the menu with all the verbs that are available for the given object
|
||||||
|
*/
|
||||||
|
void activateVerbMenu(bool objectsOn);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Process input for the dialog
|
||||||
|
*/
|
||||||
void execute();
|
void execute();
|
||||||
|
|
||||||
void checkTabbingKeys(int numOptions);
|
void checkTabbingKeys(int numOptions);
|
||||||
|
|
|
@ -61,11 +61,6 @@ protected:
|
||||||
SherlockEngine *_vm;
|
SherlockEngine *_vm;
|
||||||
|
|
||||||
UserInterface(SherlockEngine *vm);
|
UserInterface(SherlockEngine *vm);
|
||||||
|
|
||||||
/**
|
|
||||||
* Called for OPEN, CLOSE, and MOVE actions are being done
|
|
||||||
*/
|
|
||||||
void checkAction(ActionType &action, int objNum, FixedTextActionId fixedTextActionId = kFixedTextAction_Invalid);
|
|
||||||
public:
|
public:
|
||||||
MenuMode _menuMode;
|
MenuMode _menuMode;
|
||||||
int _menuCounter;
|
int _menuCounter;
|
||||||
|
@ -89,6 +84,11 @@ public:
|
||||||
static UserInterface *init(SherlockEngine *vm);
|
static UserInterface *init(SherlockEngine *vm);
|
||||||
virtual ~UserInterface() {}
|
virtual ~UserInterface() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called for OPEN, CLOSE, and MOVE actions are being done
|
||||||
|
*/
|
||||||
|
void checkAction(ActionType &action, int objNum, FixedTextActionId fixedTextActionId = kFixedTextAction_Invalid);
|
||||||
|
public:
|
||||||
/**
|
/**
|
||||||
* Resets the user interface
|
* Resets the user interface
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue