aboutsummaryrefslogtreecommitdiff
path: root/engines/sherlock
diff options
context:
space:
mode:
authorPaul Gilbert2015-03-27 22:12:37 -0400
committerPaul Gilbert2015-03-27 22:12:37 -0400
commite122b752b7faf6a0307e74523771860367f7227e (patch)
treefa8cf475616424bec3e8d7a0eec8e6fdd68a80ab /engines/sherlock
parent56a854e2292f420a6ab03c65174f9fc0310bc2fa (diff)
downloadscummvm-rg350-e122b752b7faf6a0307e74523771860367f7227e.tar.gz
scummvm-rg350-e122b752b7faf6a0307e74523771860367f7227e.tar.bz2
scummvm-rg350-e122b752b7faf6a0307e74523771860367f7227e.zip
SHERLOCK: Fix scrolling examine window on-screen
Diffstat (limited to 'engines/sherlock')
-rw-r--r--engines/sherlock/screen.cpp2
-rw-r--r--engines/sherlock/screen.h2
-rw-r--r--engines/sherlock/user_interface.cpp40
3 files changed, 24 insertions, 20 deletions
diff --git a/engines/sherlock/screen.cpp b/engines/sherlock/screen.cpp
index 646802094f..def20612b7 100644
--- a/engines/sherlock/screen.cpp
+++ b/engines/sherlock/screen.cpp
@@ -403,7 +403,7 @@ void Screen::writeString(const Common::String &str, const Common::Point &pt, int
/**
* Fills an area on the back buffer, and then copies it to the screen
*/
-void Screen::bar(const Common::Rect &r, int color) {
+void Screen::vgaBar(const Common::Rect &r, int color) {
_backBuffer.fillRect(r, color);
slamRect(r);
}
diff --git a/engines/sherlock/screen.h b/engines/sherlock/screen.h
index e8f45f7bba..acd122e0e9 100644
--- a/engines/sherlock/screen.h
+++ b/engines/sherlock/screen.h
@@ -109,7 +109,7 @@ public:
int charWidth(char c);
- void bar(const Common::Rect &r, int color);
+ void vgaBar(const Common::Rect &r, int color);
};
} // End of namespace Sherlock
diff --git a/engines/sherlock/user_interface.cpp b/engines/sherlock/user_interface.cpp
index c15685d82b..6af698baa6 100644
--- a/engines/sherlock/user_interface.cpp
+++ b/engines/sherlock/user_interface.cpp
@@ -82,7 +82,7 @@ UserInterface::UserInterface(SherlockEngine *vm) : _vm(vm) {
_selector = _oldSelector = -1;
_windowBounds = Common::Rect(0, CONTROLS_Y1, SHERLOCK_SCREEN_WIDTH - 1,
SHERLOCK_SCREEN_HEIGHT - 1);
- _windowStyle = 0;
+ _windowStyle = 1; // Sliding windows
}
UserInterface::~UserInterface() {
@@ -457,7 +457,7 @@ void UserInterface::toggleButton(int num) {
*/
void UserInterface::clearInfo() {
if (_infoFlag) {
- _vm->_screen->bar(Common::Rect(16, INFO_LINE, SHERLOCK_SCREEN_WIDTH - 19,
+ _vm->_screen->vgaBar(Common::Rect(16, INFO_LINE, SHERLOCK_SCREEN_WIDTH - 19,
INFO_LINE + 10), INFO_BLACK);
_infoFlag = false;
_oldLook = -1;
@@ -822,23 +822,24 @@ void UserInterface::printObjectDesc(const Common::String &str, bool firstTime) {
return;
}
+ Surface &bb = screen._backBuffer;
if (firstTime) {
// Only draw the border on the first call
_infoFlag = true;
clearInfo();
- screen.bar(Common::Rect(0, CONTROLS_Y, SHERLOCK_SCREEN_WIDTH,
+ bb.fillRect(Common::Rect(0, CONTROLS_Y, SHERLOCK_SCREEN_WIDTH,
CONTROLS_Y1 + 10), BORDER_COLOR);
- screen.bar(Common::Rect(0, CONTROLS_Y + 10, 1, SHERLOCK_SCREEN_HEIGHT - 1),
+ bb.fillRect(Common::Rect(0, CONTROLS_Y + 10, 1, SHERLOCK_SCREEN_HEIGHT - 1),
BORDER_COLOR);
- screen.bar(Common::Rect(SHERLOCK_SCREEN_WIDTH - 2, CONTROLS_Y + 10,
+ bb.fillRect(Common::Rect(SHERLOCK_SCREEN_WIDTH - 2, CONTROLS_Y + 10,
SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT), BORDER_COLOR);
- screen.bar(Common::Rect(0, SHERLOCK_SCREEN_HEIGHT - 1, SHERLOCK_SCREEN_WIDTH,
+ bb.fillRect(Common::Rect(0, SHERLOCK_SCREEN_HEIGHT - 1, SHERLOCK_SCREEN_WIDTH,
SHERLOCK_SCREEN_HEIGHT), BORDER_COLOR);
}
// Clear background
- screen.bar(Common::Rect(2, CONTROLS_Y + 10, SHERLOCK_SCREEN_WIDTH - 2,
+ bb.fillRect(Common::Rect(2, CONTROLS_Y + 10, SHERLOCK_SCREEN_WIDTH - 2,
SHERLOCK_SCREEN_HEIGHT - 2), INV_BACKGROUND);
_windowBounds.top = CONTROLS_Y;
@@ -904,15 +905,17 @@ void UserInterface::printObjectDesc(const Common::String &str, bool firstTime) {
SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT));
}
else {
+ // Extract the window that's been drawn on the back buffer
Surface tempSurface(SHERLOCK_SCREEN_WIDTH,
- (SHERLOCK_SCREEN_HEIGHT - CONTROLS_Y) + 10);
+ (SHERLOCK_SCREEN_HEIGHT - CONTROLS_Y));
Common::Rect r(0, CONTROLS_Y, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT);
+ tempSurface.blitFrom(screen._backBuffer, Common::Point(0, 0), r);
- tempSurface.blitFrom(screen._backBuffer, Common::Point(0, CONTROLS_Y), r);
+ // Remove drawn window with original user interface
screen._backBuffer.blitFrom(screen._backBuffer2,
Common::Point(0, CONTROLS_Y), r);
- // Display the window
+ // Display the window gradually on-screen
summonWindow(tempSurface);
}
@@ -938,11 +941,12 @@ void UserInterface::makeButton(const Common::Rect &bounds, int textX,
const Common::String &str) {
Screen &screen = *_vm->_screen;
- screen.bar(Common::Rect(bounds.left, bounds.top, bounds.right, bounds.top + 1), BUTTON_TOP);
- screen.bar(Common::Rect(bounds.left, bounds.top, bounds.left + 1, bounds.bottom), BUTTON_TOP);
- screen.bar(Common::Rect(bounds.right - 1, bounds.top, bounds.right, bounds.bottom), BUTTON_BOTTOM);
- screen.bar(Common::Rect(bounds.left + 1, bounds.bottom - 1, bounds.right, bounds.bottom), BUTTON_BOTTOM);
- screen.bar(Common::Rect(bounds.left + 1, bounds.top + 1, bounds.right - 1, bounds.bottom - 1), BUTTON_MIDDLE);
+ Surface &bb = screen._backBuffer;
+ bb.fillRect(Common::Rect(bounds.left, bounds.top, bounds.right, bounds.top + 1), BUTTON_TOP);
+ bb.fillRect(Common::Rect(bounds.left, bounds.top, bounds.left + 1, bounds.bottom), BUTTON_TOP);
+ bb.fillRect(Common::Rect(bounds.right - 1, bounds.top, bounds.right, bounds.bottom), BUTTON_BOTTOM);
+ bb.fillRect(Common::Rect(bounds.left + 1, bounds.bottom - 1, bounds.right, bounds.bottom), BUTTON_BOTTOM);
+ bb.fillRect(Common::Rect(bounds.left + 1, bounds.top + 1, bounds.right - 1, bounds.bottom - 1), BUTTON_MIDDLE);
screen.gPrint(Common::Point(textX, bounds.top), COMMAND_HIGHLIGHTED, "%c", str[0]);
screen.gPrint(Common::Point(textX + screen.charWidth(str[0]), bounds.top),
@@ -950,7 +954,7 @@ void UserInterface::makeButton(const Common::Rect &bounds, int textX,
}
/**
- * Displays a passed window by gradually displaying it up vertically
+ * Displays a passed window by gradually scrolling it vertically on-screen
*/
void UserInterface::summonWindow(const Surface &bgSurface) {
Events &events = *_vm->_events;
@@ -961,8 +965,8 @@ void UserInterface::summonWindow(const Surface &bgSurface) {
return;
// Gradually slide up the display of the window
- for (int idx = 1; idx <= (SHERLOCK_SCREEN_HEIGHT - CONTROLS_Y); idx += 2) {
- screen.blitFrom(bgSurface, Common::Point(0, SHERLOCK_SCREEN_HEIGHT - idx),
+ for (int idx = 1; idx <= bgSurface.h; idx += 2) {
+ screen._backBuffer.blitFrom(bgSurface, Common::Point(0, SHERLOCK_SCREEN_HEIGHT - idx),
Common::Rect(0, 0, bgSurface.w, idx));
screen.slamRect(Common::Rect(0, SHERLOCK_SCREEN_HEIGHT - idx,
SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT));