mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-12 20:17:49 +00:00
SHERLOCK: RT: Beginnings of inventory menu widget
This commit is contained in:
parent
5446df8e61
commit
4ce4431c61
@ -22,6 +22,7 @@ MODULE_OBJS = \
|
||||
tattoo/tattoo_talk.o \
|
||||
tattoo/tattoo_user_interface.o \
|
||||
tattoo/widget_base.o \
|
||||
tattoo/widget_inventory.o \
|
||||
tattoo/widget_text.o \
|
||||
tattoo/widget_tooltip.o \
|
||||
tattoo/widget_verbs.o \
|
||||
|
@ -29,7 +29,7 @@ namespace Sherlock {
|
||||
namespace Tattoo {
|
||||
|
||||
TattooUserInterface::TattooUserInterface(SherlockEngine *vm): UserInterface(vm),
|
||||
_tooltipWidget(vm), _verbsWidget(vm), _textWidget(vm) {
|
||||
_inventoryWidget(vm), _tooltipWidget(vm), _verbsWidget(vm), _textWidget(vm) {
|
||||
_menuBuffer = nullptr;
|
||||
_invMenuBuffer = nullptr;
|
||||
_invGraphic = nullptr;
|
||||
@ -423,7 +423,7 @@ void TattooUserInterface::doStandardControl() {
|
||||
switch (_keyState.keycode) {
|
||||
case Common::KEYCODE_F5:
|
||||
// Save game
|
||||
turnTextOff();
|
||||
freeMenu();
|
||||
_fileMode = SAVEMODE_SAVE;
|
||||
_menuBounds = Common::Rect(0, 0, 0, 0);
|
||||
initFileMenu();
|
||||
@ -431,7 +431,7 @@ void TattooUserInterface::doStandardControl() {
|
||||
|
||||
case Common::KEYCODE_F7:
|
||||
// Load game
|
||||
turnTextOff();
|
||||
freeMenu();
|
||||
_fileMode = SAVEMODE_LOAD;
|
||||
_menuBounds = Common::Rect(0, 0, 0, 0);
|
||||
initFileMenu();
|
||||
@ -440,7 +440,7 @@ void TattooUserInterface::doStandardControl() {
|
||||
case Common::KEYCODE_F1:
|
||||
// Display journal
|
||||
if (vm.readFlags(76)) {
|
||||
turnTextOff();
|
||||
freeMenu();
|
||||
doJournal();
|
||||
|
||||
// See if we're in a Lab Table Room
|
||||
@ -452,19 +452,19 @@ void TattooUserInterface::doStandardControl() {
|
||||
case Common::KEYCODE_TAB:
|
||||
case Common::KEYCODE_F3:
|
||||
// Display inventory
|
||||
turnTextOff();
|
||||
freeMenu();
|
||||
doInventory(2);
|
||||
return;
|
||||
|
||||
case Common::KEYCODE_F4:
|
||||
// Display options
|
||||
turnTextOff();
|
||||
freeMenu();
|
||||
doControls();
|
||||
return;
|
||||
|
||||
case Common::KEYCODE_F10:
|
||||
// Quit menu
|
||||
turnTextOff();
|
||||
freeMenu();
|
||||
_menuBounds = Common::Rect(-1, -1, -1, -1);
|
||||
doQuitMenu();
|
||||
return;
|
||||
@ -483,7 +483,7 @@ void TattooUserInterface::doStandardControl() {
|
||||
|
||||
// Turn any Text display off
|
||||
if (_arrowZone == -1 || events._rightReleased)
|
||||
turnTextOff();
|
||||
freeMenu();
|
||||
|
||||
if (_personFound) {
|
||||
if (people[_bgFound - 1000]._description.empty() || people[_bgFound - 1000]._description.hasPrefix(" "))
|
||||
@ -560,8 +560,7 @@ void TattooUserInterface::doLookControl() {
|
||||
// We were looking at a Inventory object
|
||||
// Erase the text window, and then redraw the inventory window
|
||||
_textWidget.banishWindow();
|
||||
|
||||
warning("TODO: re-show inventory");
|
||||
doInventory(0);
|
||||
|
||||
_invLookFlag = false;
|
||||
_key = -1;
|
||||
@ -619,12 +618,13 @@ void TattooUserInterface::initFileMenu() {
|
||||
// TODO
|
||||
}
|
||||
|
||||
void TattooUserInterface::turnTextOff() {
|
||||
// TODO
|
||||
}
|
||||
|
||||
void TattooUserInterface::doInventory(int mode) {
|
||||
// TODO
|
||||
People &people = *_vm->_people;
|
||||
people[HOLMES].gotoStand();
|
||||
|
||||
_inventoryWidget.load(mode);
|
||||
|
||||
_menuMode = INV_MODE;
|
||||
}
|
||||
|
||||
void TattooUserInterface::doControls() {
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "common/scummsys.h"
|
||||
#include "sherlock/saveload.h"
|
||||
#include "sherlock/user_interface.h"
|
||||
#include "sherlock/tattoo/widget_inventory.h"
|
||||
#include "sherlock/tattoo/widget_text.h"
|
||||
#include "sherlock/tattoo/widget_tooltip.h"
|
||||
#include "sherlock/tattoo/widget_verbs.h"
|
||||
@ -34,7 +35,10 @@ namespace Sherlock {
|
||||
|
||||
namespace Tattoo {
|
||||
|
||||
class WidgetBase;
|
||||
|
||||
class TattooUserInterface : public UserInterface {
|
||||
friend class WidgetBase;
|
||||
private:
|
||||
Common::Rect _menuBounds;
|
||||
Common::Rect _oldMenuBounds;
|
||||
@ -51,9 +55,10 @@ private:
|
||||
int _exitZone;
|
||||
int _scriptZone;
|
||||
int _cAnimFramePause;
|
||||
WidgetInventory _inventoryWidget;
|
||||
WidgetText _textWidget;
|
||||
WidgetTooltip _tooltipWidget;
|
||||
WidgetVerbs _verbsWidget;
|
||||
WidgetText _textWidget;
|
||||
WidgetBase *_widget;
|
||||
private:
|
||||
/**
|
||||
@ -113,11 +118,6 @@ private:
|
||||
*/
|
||||
void initFileMenu();
|
||||
|
||||
/**
|
||||
* Turn off any active object description text
|
||||
*/
|
||||
void turnTextOff();
|
||||
|
||||
/**
|
||||
* Handle displaying the quit menu
|
||||
*/
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "sherlock/tattoo/widget_base.h"
|
||||
#include "sherlock/tattoo/tattoo.h"
|
||||
#include "sherlock/tattoo/tattoo_talk.h"
|
||||
#include "sherlock/tattoo/tattoo_user_interface.h"
|
||||
|
||||
namespace Sherlock {
|
||||
|
||||
@ -33,7 +34,9 @@ WidgetBase::WidgetBase(SherlockEngine *vm) : _vm(vm) {
|
||||
}
|
||||
|
||||
void WidgetBase::summonWindow() {
|
||||
|
||||
TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui;
|
||||
ui._widget = this;
|
||||
_outsideMenu = false;
|
||||
}
|
||||
|
||||
void WidgetBase::banishWindow() {
|
||||
|
@ -41,6 +41,7 @@ protected:
|
||||
Common::Rect _bounds, _oldBounds;
|
||||
Surface _surface;
|
||||
ImageFile *_images;
|
||||
bool _outsideMenu;
|
||||
|
||||
/**
|
||||
* Used by descendent classes to split up long text for display across multiple lines
|
||||
|
86
engines/sherlock/tattoo/widget_inventory.cpp
Normal file
86
engines/sherlock/tattoo/widget_inventory.cpp
Normal file
@ -0,0 +1,86 @@
|
||||
/* 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_inventory.h"
|
||||
#include "sherlock/tattoo/tattoo_user_interface.h"
|
||||
#include "sherlock/tattoo/tattoo.h"
|
||||
|
||||
namespace Sherlock {
|
||||
|
||||
namespace Tattoo {
|
||||
|
||||
#define INVENTORY_XSIZE 70 // Width of the box that surrounds inventory items
|
||||
#define INVENTORY_YSIZE 70 // Width of the box that surrounds inventory items
|
||||
#define NUM_INVENTORY_SHOWN 8 // Number of Inventory Items Shown
|
||||
#define BUTTON_XSIZE 15 // Button width
|
||||
|
||||
WidgetInventory::WidgetInventory(SherlockEngine *vm) : WidgetBase(vm) {
|
||||
_invMode = 0;
|
||||
_invVerbMode = 0;
|
||||
_invSelect = _oldInvSelect = 0;
|
||||
_selector = _oldSelector = 0;
|
||||
_dialogTimer = -1;
|
||||
}
|
||||
|
||||
void WidgetInventory::load(int mode) {
|
||||
Events &events = *_vm->_events;
|
||||
Inventory &inv = *_vm->_inventory;
|
||||
Common::Point mousePos = events.mousePos();
|
||||
|
||||
if (mode != 0)
|
||||
_invMode = mode;
|
||||
_invVerbMode = 0;
|
||||
_invSelect = _oldInvSelect = -1;
|
||||
_selector = _oldSelector = -1;
|
||||
_dialogTimer = -1;
|
||||
|
||||
if (mode == 0) {
|
||||
banishWindow();
|
||||
} else {
|
||||
_bounds = Common::Rect((INVENTORY_XSIZE + 3) * NUM_INVENTORY_SHOWN / 2 + BUTTON_XSIZE + 6,
|
||||
(INVENTORY_YSIZE + 3) * 2 + 3);
|
||||
_bounds.moveTo(mousePos.x - _bounds.width() / 2, mousePos.y - _bounds.height() / 2);
|
||||
}
|
||||
|
||||
// Ensure menu will be on-screen
|
||||
checkMenuPosition();
|
||||
|
||||
// Load the inventory data
|
||||
inv.loadInv();
|
||||
|
||||
// Redraw the inventory menu on the widget surface
|
||||
_surface.create(_bounds.width(), _bounds.height());
|
||||
_surface.fill(TRANSPARENCY);
|
||||
|
||||
// Draw the window background and then the inventory on top of it
|
||||
makeInfoArea();
|
||||
//putInv(0);
|
||||
}
|
||||
|
||||
void WidgetInventory::loadInv() {
|
||||
// TODO
|
||||
}
|
||||
|
||||
|
||||
} // End of namespace Tattoo
|
||||
|
||||
} // End of namespace Sherlock
|
56
engines/sherlock/tattoo/widget_inventory.h
Normal file
56
engines/sherlock/tattoo/widget_inventory.h
Normal file
@ -0,0 +1,56 @@
|
||||
/* 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_INVENTORY_H
|
||||
#define SHERLOCK_TATTOO_WIDGET_INVENTORY_H
|
||||
|
||||
#include "common/scummsys.h"
|
||||
#include "sherlock/tattoo/widget_base.h"
|
||||
|
||||
namespace Sherlock {
|
||||
|
||||
class SherlockEngine;
|
||||
|
||||
namespace Tattoo {
|
||||
|
||||
class WidgetInventory: public WidgetBase {
|
||||
private:
|
||||
int _invVerbMode;
|
||||
int _invSelect, _oldInvSelect;
|
||||
int _selector, _oldSelector;
|
||||
int _dialogTimer;
|
||||
|
||||
void loadInv();
|
||||
public:
|
||||
int _invMode;
|
||||
public:
|
||||
WidgetInventory(SherlockEngine *vm);
|
||||
virtual ~WidgetInventory() {}
|
||||
|
||||
void load(int mode);
|
||||
};
|
||||
|
||||
} // End of namespace Tattoo
|
||||
|
||||
} // End of namespace Sherlock
|
||||
|
||||
#endif
|
@ -74,9 +74,9 @@ void WidgetText::load(const Common::String &str) {
|
||||
|
||||
// Allocate a surface for the window
|
||||
_surface.create(_bounds.width(), _bounds.height());
|
||||
_surface.fill(TRANSPARENCY);
|
||||
|
||||
// Form the background for the new window
|
||||
_surface.fillRect(Common::Rect(0, 0, _surface.w(), _surface.h()), TRANSPARENCY);
|
||||
makeInfoArea();
|
||||
|
||||
int yp = 5;
|
||||
|
Loading…
Reference in New Issue
Block a user