mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-15 16:58:01 +00:00
SHERLOCK: RT: Rendering fixes for Options & Quit dialogs
This commit is contained in:
parent
8be83948b1
commit
c6e1884403
@ -157,10 +157,6 @@ bool Events::isCursorVisible() const {
|
||||
return CursorMan.isVisible();
|
||||
}
|
||||
|
||||
void Events::moveMouse(const Common::Point &pt) {
|
||||
g_system->warpMouse(pt.x, pt.y);
|
||||
}
|
||||
|
||||
void Events::pollEvents() {
|
||||
checkForNextFrameCounter();
|
||||
|
||||
@ -208,7 +204,14 @@ void Events::pollEventsAndWait() {
|
||||
}
|
||||
|
||||
void Events::warpMouse(const Common::Point &pt) {
|
||||
g_system->warpMouse(pt.x, pt.y);
|
||||
Common::Point p = pt - _vm->_screen->_currentScroll;
|
||||
g_system->warpMouse(p.x, p.y);
|
||||
}
|
||||
|
||||
void Events::warpMouse() {
|
||||
Screen &screen = *_vm->_screen;
|
||||
warpMouse(Common::Point(screen._currentScroll.x + SHERLOCK_SCREEN_WIDTH / 2,
|
||||
screen._currentScroll.y + SHERLOCK_SCREEN_HEIGHT / 2));
|
||||
}
|
||||
|
||||
bool Events::checkForNextFrameCounter() {
|
||||
|
@ -109,11 +109,6 @@ public:
|
||||
*/
|
||||
bool isCursorVisible() const;
|
||||
|
||||
/**
|
||||
* Move the mouse
|
||||
*/
|
||||
void moveMouse(const Common::Point &pt);
|
||||
|
||||
/**
|
||||
* Check for any pending events
|
||||
*/
|
||||
@ -130,6 +125,11 @@ public:
|
||||
*/
|
||||
void warpMouse(const Common::Point &pt);
|
||||
|
||||
/**
|
||||
* Move the mouse cursor to the center of the screen
|
||||
*/
|
||||
void warpMouse();
|
||||
|
||||
/**
|
||||
* Get the current mouse position
|
||||
*/
|
||||
|
@ -432,7 +432,7 @@ OpcodeReturn ScalpelTalk::cmdMoveMouse(const byte *&str) {
|
||||
Events &events = *_vm->_events;
|
||||
|
||||
++str;
|
||||
events.moveMouse(Common::Point((str[0] - 1) * 256 + str[1] - 1, str[2]));
|
||||
events.warpMouse(Common::Point((str[0] - 1) * 256 + str[1] - 1, str[2]));
|
||||
if (_talkToAbort)
|
||||
return RET_EXIT;
|
||||
str += 3;
|
||||
|
@ -92,7 +92,7 @@ int TattooMap::show() {
|
||||
// Load the custom mouse cursors for the map
|
||||
ImageFile cursors("omouse.vgs");
|
||||
events.setCursor(cursors[0]._frame);
|
||||
events.warpMouse(Common::Point(SHERLOCK_SCREEN_WIDTH / 2, SHERLOCK_SCREEN_HEIGHT / 2));
|
||||
events.warpMouse();
|
||||
|
||||
// Load the data for the map
|
||||
_iconImages = new ImageFile("mapicons.vgs");
|
||||
|
@ -31,7 +31,7 @@ namespace Tattoo {
|
||||
|
||||
TattooUserInterface::TattooUserInterface(SherlockEngine *vm): UserInterface(vm),
|
||||
_inventoryWidget(vm), _messageWidget(vm), _textWidget(vm), _tooltipWidget(vm), _verbsWidget(vm),
|
||||
_labWidget(vm), _creditsWidget(vm), _optionsWidget(vm) {
|
||||
_labWidget(vm), _creditsWidget(vm), _optionsWidget(vm), _quitWidget(vm) {
|
||||
Common::fill(&_lookupTable[0], &_lookupTable[PALETTE_COUNT], 0);
|
||||
Common::fill(&_lookupTable1[0], &_lookupTable1[PALETTE_COUNT], 0);
|
||||
_scrollSize = 0;
|
||||
@ -404,12 +404,14 @@ void TattooUserInterface::doStandardControl() {
|
||||
|
||||
case Common::KEYCODE_F4:
|
||||
// Display options
|
||||
_optionsWidget.summonWindow();
|
||||
events.warpMouse();
|
||||
_optionsWidget.load();
|
||||
return;
|
||||
|
||||
case Common::KEYCODE_F10:
|
||||
// Quit menu
|
||||
freeMenu();
|
||||
events.warpMouse();
|
||||
doQuitMenu();
|
||||
return;
|
||||
|
||||
@ -559,7 +561,6 @@ void TattooUserInterface::doInventory(int mode) {
|
||||
}
|
||||
|
||||
void TattooUserInterface::doControls() {
|
||||
_menuMode = OPTION_MODE;
|
||||
_optionsWidget.load();
|
||||
}
|
||||
|
||||
@ -568,7 +569,7 @@ void TattooUserInterface::pickUpObject(int objNum) {
|
||||
}
|
||||
|
||||
void TattooUserInterface::doQuitMenu() {
|
||||
// TODO
|
||||
_quitWidget.show();
|
||||
}
|
||||
|
||||
void TattooUserInterface::putMessage(const char *formatStr, ...) {
|
||||
@ -818,7 +819,7 @@ void TattooUserInterface::makeBGArea(const Common::Rect &r) {
|
||||
Screen &screen = *_vm->_screen;
|
||||
|
||||
for (int yp = r.top; yp < r.bottom; ++yp) {
|
||||
byte *ptr = screen._backBuffer1.getBasePtr(r.left + screen._currentScroll.x, yp);
|
||||
byte *ptr = screen._backBuffer1.getBasePtr(r.left, yp);
|
||||
|
||||
for (int xp = r.left; xp < r.right; ++xp, ++ptr)
|
||||
*ptr = _lookupTable[*ptr];
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "sherlock/tattoo/widget_inventory.h"
|
||||
#include "sherlock/tattoo/widget_lab.h"
|
||||
#include "sherlock/tattoo/widget_options.h"
|
||||
#include "sherlock/tattoo/widget_quit.h"
|
||||
#include "sherlock/tattoo/widget_text.h"
|
||||
#include "sherlock/tattoo/widget_tooltip.h"
|
||||
#include "sherlock/tattoo/widget_verbs.h"
|
||||
@ -55,6 +56,7 @@ private:
|
||||
int _cAnimFramePause;
|
||||
WidgetInventory _inventoryWidget;
|
||||
WidgetMessage _messageWidget;
|
||||
WidgetQuit _quitWidget;
|
||||
Common::List<WidgetBase *> _widgets;
|
||||
byte _lookupTable[PALETTE_COUNT];
|
||||
byte _lookupTable1[PALETTE_COUNT];
|
||||
@ -84,11 +86,6 @@ private:
|
||||
*/
|
||||
void initFileMenu();
|
||||
|
||||
/**
|
||||
* Handle displaying the quit menu
|
||||
*/
|
||||
void doQuitMenu();
|
||||
|
||||
/**
|
||||
* Free any active menu
|
||||
*/
|
||||
@ -160,6 +157,11 @@ public:
|
||||
*/
|
||||
void doControls();
|
||||
|
||||
/**
|
||||
* Handle the display of the quit menu
|
||||
*/
|
||||
void doQuitMenu();
|
||||
|
||||
/**
|
||||
* Pick up the selected object
|
||||
*/
|
||||
|
@ -30,7 +30,7 @@ namespace Sherlock {
|
||||
|
||||
namespace Tattoo {
|
||||
|
||||
WidgetOptions::WidgetOptions(SherlockEngine *vm) : WidgetBase(vm), _quitWidget(vm) {
|
||||
WidgetOptions::WidgetOptions(SherlockEngine *vm) : WidgetBase(vm) {
|
||||
_midiSliderX = _digiSliderX = 0;
|
||||
_selector = _oldSelector = -1;
|
||||
}
|
||||
@ -39,6 +39,7 @@ void WidgetOptions::load() {
|
||||
Events &events = *_vm->_events;
|
||||
Music &music = *_vm->_music;
|
||||
Sound &sound = *_vm->_sound;
|
||||
TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui;
|
||||
Common::Point mousePos = events.mousePos();
|
||||
|
||||
// Set bounds for the dialog
|
||||
@ -54,6 +55,9 @@ void WidgetOptions::load() {
|
||||
// Setup the dialog
|
||||
_surface.create(_bounds.width(), _bounds.height());
|
||||
render();
|
||||
|
||||
summonWindow();
|
||||
ui._menuMode = OPTION_MODE;
|
||||
}
|
||||
|
||||
void WidgetOptions::handleEvents() {
|
||||
@ -234,7 +238,7 @@ void WidgetOptions::handleEvents() {
|
||||
case 10:
|
||||
// Quit
|
||||
banishWindow();
|
||||
_quitWidget.show();
|
||||
ui.doQuitMenu();
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -303,11 +307,12 @@ void WidgetOptions::render(OptionRenderMode mode) {
|
||||
sliderY - (num - 6) / 2 + num - 1), TRANSPARENCY);
|
||||
_surface.fillRect(Common::Rect(_surface.widestChar(), sliderY + 2,
|
||||
_surface.w() - _surface.widestChar() - 1, sliderY + 3), INFO_MIDDLE);
|
||||
drawDialogRect(Common::Rect(_surface.widestChar(), sliderY, _surface.w() - _surface.widestChar() * 2, 6));
|
||||
drawDialogRect(Common::Rect(_surface.widestChar(), sliderY, _surface.w() - _surface.widestChar(), sliderY + 6));
|
||||
|
||||
_surface.fillRect(Common::Rect(_midiSliderX - 1, sliderY - (num - 6) / 2 + 2,
|
||||
_midiSliderX + 1, sliderY - (num - 6) / 2 + num - 3), INFO_MIDDLE);
|
||||
drawDialogRect(Common::Rect(_midiSliderX - 3, sliderY - (num - 6) / 2, 7, num));
|
||||
drawDialogRect(Common::Rect(_midiSliderX - 3, sliderY - (num - 6) / 2,
|
||||
_midiSliderX + 4, sliderY - (num - 6) / 2 + num));
|
||||
|
||||
if (_midiSliderX - 4 > _surface.widestChar())
|
||||
_surface.fillRect(Common::Rect(_midiSliderX - 4, sliderY, _midiSliderX - 4, sliderY + 4), INFO_BOTTOM);
|
||||
@ -332,10 +337,11 @@ void WidgetOptions::render(OptionRenderMode mode) {
|
||||
sliderY - (num - 6) / 2 + num - 1), TRANSPARENCY);
|
||||
_surface.fillRect(Common::Rect(_surface.widestChar(), sliderY + 2, _surface.w() - _surface.widestChar() - 1,
|
||||
sliderY + 3), INFO_MIDDLE);
|
||||
drawDialogRect(Common::Rect(_surface.widestChar(), sliderY, _surface.w() - _surface.widestChar() * 2, 6));
|
||||
drawDialogRect(Common::Rect(_surface.widestChar(), sliderY, _surface.w() - _surface.widestChar(), sliderY + 6));
|
||||
_surface.fillRect(Common::Rect(_digiSliderX - 1, sliderY - (num - 6) / 2 + 2, _digiSliderX + 1,
|
||||
sliderY - (num - 6) / 2 + num - 3), INFO_MIDDLE);
|
||||
drawDialogRect(Common::Rect(_digiSliderX - 3, sliderY - (num - 6) / 2, 7, num));
|
||||
drawDialogRect(Common::Rect(_digiSliderX - 3, sliderY - (num - 6) / 2, _digiSliderX + 4,
|
||||
sliderY - (num - 6) / 2 + num));
|
||||
if (_digiSliderX - 4 > _surface.widestChar())
|
||||
_surface.fillRect(Common::Rect(_digiSliderX - 4, sliderY, _digiSliderX - 4, sliderY + 4), INFO_BOTTOM);
|
||||
if (_digiSliderX + 4 < _surface.w() - _surface.widestChar())
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
#include "common/scummsys.h"
|
||||
#include "sherlock/tattoo/widget_base.h"
|
||||
#include "sherlock/tattoo/widget_quit.h"
|
||||
|
||||
namespace Sherlock {
|
||||
|
||||
@ -42,7 +41,6 @@ class WidgetOptions : public WidgetBase {
|
||||
private:
|
||||
int _midiSliderX, _digiSliderX;
|
||||
int _selector, _oldSelector;
|
||||
WidgetQuit _quitWidget;
|
||||
|
||||
/**
|
||||
* Render the contents of the dialog onto the widget's surface
|
||||
|
@ -35,18 +35,18 @@ WidgetQuit::WidgetQuit(SherlockEngine *vm) : WidgetBase(vm) {
|
||||
}
|
||||
|
||||
void WidgetQuit::show() {
|
||||
Screen &screen = *_vm->_screen;
|
||||
Events &events = *_vm->_events;
|
||||
TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui;
|
||||
ImageFile &images = *ui._interfaceImages;
|
||||
Common::Point mousePos = events.mousePos();
|
||||
const char *YES = FIXED(Yes);
|
||||
const char *NO = FIXED(No);
|
||||
|
||||
// Set up the display area
|
||||
_bounds = Common::Rect(_surface.stringWidth(FIXED(AreYouSureYou)) + _surface.widestChar() * 2,
|
||||
(_surface.fontHeight() + 7) * 4);
|
||||
_bounds.moveTo((SHERLOCK_SCREEN_WIDTH - _bounds.width()) / 2 + screen._currentScroll.x,
|
||||
SHERLOCK_SCREEN_HEIGHT - _bounds.height() - 100);
|
||||
|
||||
_bounds.moveTo(mousePos.x - _bounds.width() / 2, mousePos.y - _bounds.height() / 2);
|
||||
|
||||
// Create the surface
|
||||
_surface.create(_bounds.width(), _bounds.height());
|
||||
_surface.fill(TRANSPARENCY);
|
||||
@ -72,6 +72,7 @@ void WidgetQuit::show() {
|
||||
}
|
||||
|
||||
ui._menuMode = QUIT_MODE;
|
||||
summonWindow();
|
||||
}
|
||||
|
||||
void WidgetQuit::handleEvents() {
|
||||
@ -81,7 +82,7 @@ void WidgetQuit::handleEvents() {
|
||||
Common::Rect btn1Rect(_bounds.left, _bounds.top + (_surface.fontHeight() + 4) * 2 + 3, _bounds.right,
|
||||
_bounds.top + (_surface.fontHeight() + 4) * 2 + 3 + _surface.fontHeight() + 7);
|
||||
Common::Rect btn2Rect(_bounds.left, _bounds.top + (_surface.fontHeight() + 4) * 2 + _surface.fontHeight() + 10,
|
||||
_bounds.right, _bounds.top + (_surface.fontHeight() + 4) * 2 + 3 + _surface.fontHeight() + 7);
|
||||
_bounds.right, _bounds.top + (_surface.fontHeight() + 4) * 2 + 10 + _surface.fontHeight() * 2 + 7);
|
||||
|
||||
if (talk._talkToAbort)
|
||||
return;
|
||||
@ -152,12 +153,9 @@ void WidgetQuit::handleEvents() {
|
||||
_select = -1;
|
||||
_outsideMenu = false;
|
||||
|
||||
if (btn2Rect.contains(mousePos)) {
|
||||
close();
|
||||
} else if (btn1Rect.contains(mousePos)) {
|
||||
close();
|
||||
close();
|
||||
if (btn1Rect.contains(mousePos))
|
||||
_vm->quitGame();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user