Skip to content

Commit

Permalink
SHERLOCK: RT: Fix display of inventory in scrolled scenes
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Jul 8, 2015
1 parent 08414cf commit 3d20072
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 16 deletions.
6 changes: 3 additions & 3 deletions engines/sherlock/events.cpp
Expand Up @@ -196,12 +196,12 @@ bool Events::checkForNextFrameCounter() {
return false;
}

Common::Point Events::mousePos() const {
Common::Point Events::screenMousePos() const {
return g_system->getEventManager()->getMousePos();
}

Common::Point Events::sceneMousePos() const {
return mousePos() + _vm->_screen->_currentScroll;
Common::Point Events::mousePos() const {
return screenMousePos() + _vm->_screen->_currentScroll;
}

Common::KeyState Events::getKey() {
Expand Down
4 changes: 2 additions & 2 deletions engines/sherlock/events.h
Expand Up @@ -127,12 +127,12 @@ class Events {
/**
* Get the current mouse position
*/
Common::Point mousePos() const;
Common::Point screenMousePos() const;

/**
* Get the current mouse position within the scene, adjusted by the scroll position
*/
Common::Point sceneMousePos() const;
Common::Point mousePos() const;

/**
* Return the current game frame number
Expand Down
1 change: 1 addition & 0 deletions engines/sherlock/sherlock.h
Expand Up @@ -65,6 +65,7 @@ enum GameType {

#define SHERLOCK_SCREEN_WIDTH _vm->_screen->w()
#define SHERLOCK_SCREEN_HEIGHT _vm->_screen->h()
#define SHERLOCK_SCENE_WIDTH _vm->_screen->_backBuffer1.w()
#define SHERLOCK_SCENE_HEIGHT (IS_SERRATED_SCALPEL ? 138 : 480)
#define SCENES_COUNT (IS_SERRATED_SCALPEL ? 63 : 101)

Expand Down
2 changes: 1 addition & 1 deletion engines/sherlock/tattoo/tattoo_map.cpp
Expand Up @@ -305,7 +305,7 @@ void TattooMap::drawMapIcons() {

void TattooMap::checkMapNames(bool slamIt) {
Events &events = *_vm->_events;
Common::Point mapPos = events.sceneMousePos();
Common::Point mapPos = events.mousePos();

// See if the mouse is pointing at any of the map locations
_bgFound = -1;
Expand Down
4 changes: 2 additions & 2 deletions engines/sherlock/tattoo/tattoo_user_interface.cpp
Expand Up @@ -230,7 +230,7 @@ void TattooUserInterface::handleInput() {
TattooEngine &vm = *(TattooEngine *)_vm;
Events &events = *_vm->_events;
TattooScene &scene = *(TattooScene *)_vm->_scene;
Common::Point mousePos = events.sceneMousePos();
Common::Point mousePos = events.mousePos();

events.pollEventsAndWait();
_keyState.keycode = Common::KEYCODE_INVALID;
Expand Down Expand Up @@ -531,7 +531,7 @@ void TattooUserInterface::doLabControl() {
void TattooUserInterface::displayObjectNames() {
Events &events = *_vm->_events;
Scene &scene = *_vm->_scene;
Common::Point mousePos = events.sceneMousePos();
Common::Point mousePos = events.mousePos();
_arrowZone = -1;

if (_bgFound == -1 || scene._currentScene == 90) {
Expand Down
2 changes: 1 addition & 1 deletion engines/sherlock/tattoo/widget_base.cpp
Expand Up @@ -245,7 +245,7 @@ void WidgetBase::drawScrollBar(int index, int pageSize, int count) {
void WidgetBase::handleScrollbarEvents(int index, int pageSize, int count) {
Events &events = *_vm->_events;
TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui;
Common::Point mousePos = events.sceneMousePos();
Common::Point mousePos = events.mousePos();

// If they have selected the sollbar, return with the Scroll Bar Still selected
if (ui._scrollHighlight == 3)
Expand Down
7 changes: 4 additions & 3 deletions engines/sherlock/tattoo/widget_inventory.cpp
Expand Up @@ -127,7 +127,7 @@ void WidgetInventoryTooltip::handleEvents() {
_oldInvGraphicBounds = _invGraphicBounds;

// Set the New position of the graphic
int xp = CLIP(mousePos.x - _invGraphicBounds.width() / 2, 0, SHERLOCK_SCREEN_WIDTH - _invGraphicBounds.width());
int xp = CLIP(mousePos.x - _invGraphicBounds.width() / 2, 0, SHERLOCK_SCENE_WIDTH - _invGraphicBounds.width());
int yp = CLIP(mousePos.y - _invGraphicBounds.height() / 2, 0, SHERLOCK_SCREEN_HEIGHT - _invGraphicBounds.height());

_invGraphicBounds.moveTo(xp, yp);
Expand Down Expand Up @@ -242,7 +242,7 @@ void WidgetInventoryTooltip::handleEvents() {
}

// Update the position of the tooltip
int xs = CLIP(mousePos.x - _bounds.width() / 2, 0, SHERLOCK_SCREEN_WIDTH - _bounds.width());
int xs = CLIP(mousePos.x - _bounds.width() / 2, 0, SHERLOCK_SCENE_WIDTH - _bounds.width());
int ys = CLIP(mousePos.y - _bounds.height(), 0, SHERLOCK_SCREEN_HEIGHT - _bounds.height());
_bounds.moveTo(xs, ys);
}
Expand All @@ -263,11 +263,12 @@ WidgetInventory::WidgetInventory(SherlockEngine *vm) : WidgetBase(vm), _tooltipW
void WidgetInventory::load(int mode) {
Events &events = *_vm->_events;
Inventory &inv = *_vm->_inventory;
Screen &screen = *_vm->_screen;
Common::Point mousePos = events.mousePos();

if (mode == 3) {
mode = 2;
mousePos = Common::Point(SHERLOCK_SCREEN_WIDTH / 2, SHERLOCK_SCREEN_HEIGHT / 2);
mousePos = Common::Point(screen._currentScroll.x + SHERLOCK_SCREEN_WIDTH / 2, SHERLOCK_SCREEN_HEIGHT / 2);
}

if (mode != 0)
Expand Down
3 changes: 2 additions & 1 deletion engines/sherlock/tattoo/widget_tooltip.cpp
Expand Up @@ -44,7 +44,8 @@ void WidgetTooltipBase::draw() {

// Draw the widget directly onto the screen. Unlike other widgets, we don't draw to the back buffer,
// since nothing should be drawing on top of tooltips, so there's no need to store in the back buffer
screen.transBlitFrom(_surface, Common::Point(_bounds.left, _bounds.top));
screen.transBlitFrom(_surface, Common::Point(_bounds.left - screen._currentScroll.x,
_bounds.top - screen._currentScroll.y));

// Store a copy of the drawn area for later erasing
_oldBounds = _bounds;
Expand Down
6 changes: 3 additions & 3 deletions engines/sherlock/tattoo/widget_verbs.cpp
Expand Up @@ -41,7 +41,7 @@ void WidgetVerbs::load(bool objectsOn) {
TattooPeople &people = *(TattooPeople *)_vm->_people;
Talk &talk = *_vm->_talk;
TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui;
Common::Point mousePos = events.sceneMousePos();
Common::Point mousePos = events.mousePos();
bool isWatson = false;

if (talk._talkToAbort)
Expand Down Expand Up @@ -155,7 +155,7 @@ void WidgetVerbs::handleEvents() {
TattooScene &scene = *(TattooScene *)_vm->_scene;
Talk &talk = *_vm->_talk;
TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui;
Common::Point mousePos = events.sceneMousePos();
Common::Point mousePos = events.mousePos();
bool noDesc = false;

Common::String strLook = fixedText.getText(kFixedText_Look);
Expand Down Expand Up @@ -283,7 +283,7 @@ void WidgetVerbs::handleEvents() {
void WidgetVerbs::highlightVerbControls() {
Events &events = *_vm->_events;
Screen &screen = *_vm->_screen;
Common::Point mousePos = events.sceneMousePos();
Common::Point mousePos = events.mousePos();

// Get highlighted verb
_selector = -1;
Expand Down

0 comments on commit 3d20072

Please sign in to comment.