aboutsummaryrefslogtreecommitdiff
path: root/engines/sherlock
diff options
context:
space:
mode:
authorPaul Gilbert2015-03-23 22:27:07 -0400
committerPaul Gilbert2015-03-23 22:27:07 -0400
commitd44a9e3f5a390837ce88b95d6afa2e7a5ee9e26e (patch)
tree32e17a7e0cf83b0ecc84302c74d55b11b3453b1a /engines/sherlock
parent73de00b72f002c09c173226e85b0f96f35551d10 (diff)
downloadscummvm-rg350-d44a9e3f5a390837ce88b95d6afa2e7a5ee9e26e.tar.gz
scummvm-rg350-d44a9e3f5a390837ce88b95d6afa2e7a5ee9e26e.tar.bz2
scummvm-rg350-d44a9e3f5a390837ce88b95d6afa2e7a5ee9e26e.zip
SHERLOCK: Fix loading of user interface controls
Diffstat (limited to 'engines/sherlock')
-rw-r--r--engines/sherlock/resources.cpp10
-rw-r--r--engines/sherlock/user_interface.cpp9
2 files changed, 12 insertions, 7 deletions
diff --git a/engines/sherlock/resources.cpp b/engines/sherlock/resources.cpp
index 878747a63c..1bedbe9b7b 100644
--- a/engines/sherlock/resources.cpp
+++ b/engines/sherlock/resources.cpp
@@ -300,7 +300,7 @@ void ImageFile::load(Common::SeekableReadStream &stream, bool skipPalette) {
frame._paletteBase = stream.readByte();
frame._offset.x = stream.readUint16LE();
frame._offset.y = stream.readByte();
-
+
frame._rleEncoded = !skipPalette && (frame._offset.x & 0xff) == 1;
if (frame._paletteBase) {
@@ -332,16 +332,18 @@ void ImageFile::loadPalette(Common::SeekableReadStream &stream) {
// Check for palette
int v1 = stream.readUint16LE() + 1;
int v2 = stream.readUint16LE() + 1;
+ stream.skip(1); // Skip paletteBase byte
+ bool rleEncoded = stream.readByte() == 1;
int size = v1 * v2;
- if ((size - 12) == PALETTE_SIZE) {
+ if ((size - 12) == PALETTE_SIZE && !rleEncoded) {
// Found palette, so read it in
- stream.seek(4 + 12, SEEK_CUR);
+ stream.seek(2 + 12, SEEK_CUR);
for (int idx = 0; idx < PALETTE_SIZE; ++idx)
_palette[idx] = VGA_COLOR_TRANS(stream.readByte());
} else {
// Not a palette, so rewind to start of frame data for normal frame processing
- stream.seek(-4, SEEK_CUR);
+ stream.seek(-6, SEEK_CUR);
}
}
diff --git a/engines/sherlock/user_interface.cpp b/engines/sherlock/user_interface.cpp
index 5ed5494c5e..1cd5b80980 100644
--- a/engines/sherlock/user_interface.cpp
+++ b/engines/sherlock/user_interface.cpp
@@ -75,13 +75,16 @@ UserInterface::UserInterface(SherlockEngine *vm) : _vm(vm) {
_invMode = 0;
_pause = false;
- _controls = nullptr; // new ImageFile("menu.all");
+ _controls = new ImageFile("menu.all");
}
UserInterface::~UserInterface() {
delete _controls;
}
+/**
+ * Main input handler for the user interface
+ */
void UserInterface::handleInput() {
Events &events = *_vm->_events;
People &people = *_vm->_people;
@@ -355,12 +358,12 @@ void UserInterface::depressButton(int num) {
void UserInterface::restoreButton(int num) {
Screen &screen = *_vm->_screen;
Common::Point pt(MENU_POINTS[num][0], MENU_POINTS[num][1]);
+ Graphics::Surface &frame = (*_controls)[num]._frame;
screen._backBuffer.blitFrom(screen._backBuffer2, pt,
Common::Rect(pt.x, pt.y, pt.x + 90, pt.y + 19));
screen._backBuffer.blitFrom(screen._backBuffer, pt,
- Common::Rect(pt.x, pt.y, pt.x + (*_controls)[num]._frame.w,
- (*_controls)[num]._frame.h));
+ Common::Rect(pt.x, pt.y, pt.x + frame.w, pt.y + frame.h));
if (!_menuCounter) {
_infoFlag++;