diff options
Diffstat (limited to 'engines/sherlock/scalpel')
27 files changed, 2076 insertions, 1164 deletions
diff --git a/engines/sherlock/scalpel/3do/movie_decoder.cpp b/engines/sherlock/scalpel/3do/movie_decoder.cpp index da4d08ca47..da0d16c145 100644 --- a/engines/sherlock/scalpel/3do/movie_decoder.cpp +++ b/engines/sherlock/scalpel/3do/movie_decoder.cpp @@ -25,7 +25,6 @@ #include "common/textconsole.h" #include "audio/audiostream.h" -#include "audio/decoders/raw.h" #include "audio/decoders/3do.h" #include "sherlock/scalpel/3do/movie_decoder.h" diff --git a/engines/sherlock/scalpel/3do/scalpel_3do_screen.cpp b/engines/sherlock/scalpel/3do/scalpel_3do_screen.cpp new file mode 100644 index 0000000000..f8112d8add --- /dev/null +++ b/engines/sherlock/scalpel/3do/scalpel_3do_screen.cpp @@ -0,0 +1,286 @@ +/* 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/scalpel/scalpel_screen.h" +#include "sherlock/scalpel/scalpel.h" +#include "sherlock/scalpel/3do/scalpel_3do_screen.h" + +namespace Sherlock { + +namespace Scalpel { + +Scalpel3DOScreen::Scalpel3DOScreen(SherlockEngine *vm): ScalpelScreen(vm) { +} + +void Scalpel3DOScreen::SHblitFrom(const Graphics::Surface &src, const Common::Point &pt, const Common::Rect &srcBounds) { + if (!_vm->_isScreenDoubled) { + ScalpelScreen::SHblitFrom(src, pt, srcBounds); + return; + } + + Common::Rect srcRect = srcBounds; + Common::Rect destRect(pt.x, pt.y, pt.x + srcRect.width(), pt.y + srcRect.height()); + + if (!srcRect.isValidRect() || !clip(srcRect, destRect)) + return; + + // Add dirty area remapped to the 640x200 surface + addDirtyRect(Common::Rect(destRect.left * 2, destRect.top * 2, destRect.right * 2, destRect.bottom * 2)); + + // Transfer the area, doubling each pixel + for (int yp = 0; yp < srcRect.height(); ++yp) { + const uint16 *srcP = (const uint16 *)src.getBasePtr(srcRect.left, srcRect.top + yp); + uint16 *destP = (uint16 *)getBasePtr(destRect.left * 2, (destRect.top + yp) * 2); + + for (int xp = srcRect.left; xp < srcRect.right; ++xp, ++srcP, destP += 2) { + *destP = *srcP; + *(destP + 1) = *srcP; + *(destP + 640) = *srcP; + *(destP + 640 + 1) = *srcP; + } + } +} + +void Scalpel3DOScreen::transBlitFromUnscaled(const Graphics::Surface &src, const Common::Point &pt, + bool flipped, int overrideColor) { + error("TODO: Refactor"); +#if 0 + if (!_vm->_isScreenDoubled) { + ScalpelScreen::transBlitFromUnscaled(src, pt, flipped, overrideColor); + return; + } + + Common::Rect drawRect(0, 0, src.w, src.h); + Common::Rect destRect(pt.x, pt.y, pt.x + src.w, pt.y + src.h); + + // Clip the display area to on-screen + if (!clip(drawRect, destRect)) + // It's completely off-screen + return; + + if (flipped) + drawRect = Common::Rect(src.w - drawRect.right, src.h - drawRect.bottom, + src.w - drawRect.left, src.h - drawRect.top); + + Common::Point destPt(destRect.left, destRect.top); + addDirtyRect(Common::Rect(destPt.x * 2, destPt.y * 2, (destPt.x + drawRect.width()) * 2, + (destPt.y + drawRect.height()) * 2)); + + assert(src.format.bytesPerPixel == 2 && _surface.format.bytesPerPixel == 2); + + for (int yp = 0; yp < drawRect.height(); ++yp) { + const uint16 *srcP = (const uint16 *)src.getBasePtr( + flipped ? drawRect.right - 1 : drawRect.left, drawRect.top + yp); + uint16 *destP = (uint16 *)getBasePtr(destPt.x * 2, (destPt.y + yp) * 2); + + for (int xp = 0; xp < drawRect.width(); ++xp, destP += 2) { + // RGB 0, 0, 0 -> transparent on 3DO + if (*srcP) { + *destP = *srcP; + *(destP + 1) = *srcP; + *(destP + 640) = *srcP; + *(destP + 640 + 1) = *srcP; + } + + srcP = flipped ? srcP - 1 : srcP + 1; + } + } +#endif +} + +void Scalpel3DOScreen::fillRect(const Common::Rect &r, uint color) { + if (_vm->_isScreenDoubled) + ScalpelScreen::fillRect(Common::Rect(r.left * 2, r.top * 2, r.right * 2, r.bottom * 2), color); + else + ScalpelScreen::fillRect(r, color); +} + +void Scalpel3DOScreen::fadeIntoScreen3DO(int speed) { + Events &events = *_vm->_events; + uint16 *currentScreenBasePtr = (uint16 *)getPixels(); + uint16 *targetScreenBasePtr = (uint16 *)_backBuffer.getPixels(); + uint16 currentScreenPixel = 0; + uint16 targetScreenPixel = 0; + + uint16 currentScreenPixelRed = 0; + uint16 currentScreenPixelGreen = 0; + uint16 currentScreenPixelBlue = 0; + + uint16 targetScreenPixelRed = 0; + uint16 targetScreenPixelGreen = 0; + uint16 targetScreenPixelBlue = 0; + + uint16 screenWidth = SHERLOCK_SCREEN_WIDTH; + uint16 screenHeight = SHERLOCK_SCREEN_HEIGHT; + uint16 screenX = 0; + uint16 screenY = 0; + uint16 pixelsChanged = 0; + + clearDirtyRects(); + + do { + pixelsChanged = 0; + uint16 *currentScreenPtr = currentScreenBasePtr; + uint16 *targetScreenPtr = targetScreenBasePtr; + + for (screenY = 0; screenY < screenHeight; screenY++) { + for (screenX = 0; screenX < screenWidth; screenX++) { + currentScreenPixel = *currentScreenPtr; + targetScreenPixel = *targetScreenPtr; + + if (currentScreenPixel != targetScreenPixel) { + // pixel doesn't match, adjust accordingly + currentScreenPixelRed = currentScreenPixel & 0xF800; + currentScreenPixelGreen = currentScreenPixel & 0x07E0; + currentScreenPixelBlue = currentScreenPixel & 0x001F; + targetScreenPixelRed = targetScreenPixel & 0xF800; + targetScreenPixelGreen = targetScreenPixel & 0x07E0; + targetScreenPixelBlue = targetScreenPixel & 0x001F; + + if (currentScreenPixelRed != targetScreenPixelRed) { + if (currentScreenPixelRed < targetScreenPixelRed) { + currentScreenPixelRed += 0x0800; + } else { + currentScreenPixelRed -= 0x0800; + } + } + if (currentScreenPixelGreen != targetScreenPixelGreen) { + // Adjust +2/-2 because we are running RGB555 at RGB565 + if (currentScreenPixelGreen < targetScreenPixelGreen) { + currentScreenPixelGreen += 0x0040; + } else { + currentScreenPixelGreen -= 0x0040; + } + } + if (currentScreenPixelBlue != targetScreenPixelBlue) { + if (currentScreenPixelBlue < targetScreenPixelBlue) { + currentScreenPixelBlue += 0x0001; + } else { + currentScreenPixelBlue -= 0x0001; + } + } + + uint16 v = currentScreenPixelRed | currentScreenPixelGreen | currentScreenPixelBlue; + *currentScreenPtr = v; + if (_vm->_isScreenDoubled) { + *(currentScreenPtr + 1) = v; + *(currentScreenPtr + 640) = v; + *(currentScreenPtr + 640 + 1) = v; + } + + pixelsChanged++; + } + + currentScreenPtr += _vm->_isScreenDoubled ? 2 : 1; + targetScreenPtr++; + } + + if (_vm->_isScreenDoubled) + currentScreenPtr += 640; + } + + // Too much considered dirty at the moment + if (_vm->_isScreenDoubled) + addDirtyRect(Common::Rect(0, 0, screenWidth * 2, screenHeight * 2)); + else + addDirtyRect(Common::Rect(0, 0, screenWidth, screenHeight)); + + events.pollEvents(); + events.delay(10 * speed); + } while ((pixelsChanged) && (!_vm->shouldQuit())); +} + +void Scalpel3DOScreen::blitFrom3DOcolorLimit(uint16 limitColor) { + uint16 *currentScreenPtr = (uint16 *)getPixels(); + uint16 *targetScreenPtr = (uint16 *)_backBuffer.getPixels(); + uint16 currentScreenPixel = 0; + + uint16 screenWidth = SHERLOCK_SCREEN_WIDTH; + uint16 screenHeight = SHERLOCK_SCREEN_HEIGHT; + uint16 screenX = 0; + uint16 screenY = 0; + + uint16 currentScreenPixelRed = 0; + uint16 currentScreenPixelGreen = 0; + uint16 currentScreenPixelBlue = 0; + + uint16 limitPixelRed = limitColor & 0xF800; + uint16 limitPixelGreen = limitColor & 0x07E0; + uint16 limitPixelBlue = limitColor & 0x001F; + + for (screenY = 0; screenY < screenHeight; screenY++) { + for (screenX = 0; screenX < screenWidth; screenX++) { + currentScreenPixel = *targetScreenPtr; + + currentScreenPixelRed = currentScreenPixel & 0xF800; + currentScreenPixelGreen = currentScreenPixel & 0x07E0; + currentScreenPixelBlue = currentScreenPixel & 0x001F; + + if (currentScreenPixelRed < limitPixelRed) + currentScreenPixelRed = limitPixelRed; + if (currentScreenPixelGreen < limitPixelGreen) + currentScreenPixelGreen = limitPixelGreen; + if (currentScreenPixelBlue < limitPixelBlue) + currentScreenPixelBlue = limitPixelBlue; + + uint16 v = currentScreenPixelRed | currentScreenPixelGreen | currentScreenPixelBlue; + *currentScreenPtr = v; + if (_vm->_isScreenDoubled) { + *(currentScreenPtr + 1) = v; + *(currentScreenPtr + 640) = v; + *(currentScreenPtr + 640 + 1) = v; + } + + currentScreenPtr += _vm->_isScreenDoubled ? 2 : 1; + targetScreenPtr++; + } + + if (_vm->_isScreenDoubled) + currentScreenPtr += 640; + } + + // Too much considered dirty at the moment + if (_vm->_isScreenDoubled) + addDirtyRect(Common::Rect(0, 0, screenWidth * 2, screenHeight * 2)); + else + addDirtyRect(Common::Rect(0, 0, screenWidth, screenHeight)); +} + +uint16 Scalpel3DOScreen::width() const { + return _vm->_isScreenDoubled ? this->w / 2 : this->w; +} + +uint16 Scalpel3DOScreen::height() const { + return _vm->_isScreenDoubled ? this->h / 2 : this->h; +} + +void Scalpel3DOScreen::rawBlitFrom(const Graphics::Surface &src, const Common::Point &pt) { + Common::Rect srcRect(0, 0, src.w, src.h); + Common::Rect destRect(pt.x, pt.y, pt.x + src.w, pt.y + src.h); + + addDirtyRect(destRect); + copyRectToSurface(src, destRect.left, destRect.top, srcRect); +} + +} // End of namespace Scalpel + +} // End of namespace Sherlock diff --git a/engines/sherlock/scalpel/3do/scalpel_3do_screen.h b/engines/sherlock/scalpel/3do/scalpel_3do_screen.h new file mode 100644 index 0000000000..422f588b17 --- /dev/null +++ b/engines/sherlock/scalpel/3do/scalpel_3do_screen.h @@ -0,0 +1,76 @@ +/* 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_SCALPEL_3DO_SCREEN_H +#define SHERLOCK_SCALPEL_3DO_SCREEN_H + +#include "sherlock/scalpel/scalpel_screen.h" + +namespace Sherlock { + +class SherlockEngine; + +namespace Scalpel { + +class Scalpel3DOScreen : public ScalpelScreen { +protected: + /** + * Draws a sub-section of a surface at a given position within this surface + * Overriden for the 3DO to automatically double the size of everything to the underlying 640x400 surface + */ + virtual void SHblitFrom(const Graphics::Surface &src, const Common::Point &pt, const Common::Rect &srcBounds); + + /** + * Draws a surface at a given position within this surface with transparency + */ + virtual void transBlitFromUnscaled(const Graphics::Surface &src, const Common::Point &pt, bool flipped, + int overrideColor); +public: + Scalpel3DOScreen(SherlockEngine *vm); + virtual ~Scalpel3DOScreen() {} + + /** + * Draws a sub-section of a surface at a given position within this surface + */ + void rawBlitFrom(const Graphics::Surface &src, const Common::Point &pt); + + /** + * Fade backbuffer 1 into screen (3DO RGB!) + */ + void fadeIntoScreen3DO(int speed); + + void blitFrom3DOcolorLimit(uint16 color); + + /** + * Fill a given area of the surface with a given color + */ + virtual void fillRect(const Common::Rect &r, uint color); + + virtual uint16 width() const; + virtual uint16 height() const; +}; + +} // End of namespace Scalpel + +} // End of namespace Sherlock + +#endif diff --git a/engines/sherlock/scalpel/drivers/adlib.cpp b/engines/sherlock/scalpel/drivers/adlib.cpp index 29a39f0c39..3d29d0c5ed 100644 --- a/engines/sherlock/scalpel/drivers/adlib.cpp +++ b/engines/sherlock/scalpel/drivers/adlib.cpp @@ -21,14 +21,12 @@ */ #include "sherlock/sherlock.h" -#include "sherlock/scalpel/drivers/mididriver.h" -#include "common/file.h" #include "common/system.h" #include "common/textconsole.h" #include "audio/fmopl.h" -#include "audio/softsynth/emumidi.h" +#include "audio/mididrv.h" namespace Sherlock { diff --git a/engines/sherlock/scalpel/scalpel.cpp b/engines/sherlock/scalpel/scalpel.cpp index 17e60f5365..cbb202095f 100644 --- a/engines/sherlock/scalpel/scalpel.cpp +++ b/engines/sherlock/scalpel/scalpel.cpp @@ -29,6 +29,7 @@ #include "sherlock/scalpel/scalpel_people.h" #include "sherlock/scalpel/scalpel_scene.h" #include "sherlock/scalpel/scalpel_screen.h" +#include "sherlock/scalpel/3do/scalpel_3do_screen.h" #include "sherlock/scalpel/tsage/logo.h" #include "sherlock/sherlock.h" #include "sherlock/music.h" @@ -102,78 +103,78 @@ static const byte MAP_SEQUENCES[3][MAX_FRAME] = { struct PeopleData { const char *portrait; - const char *name; + int fixedTextId; byte stillSequences[MAX_TALK_SEQUENCES]; byte talkSequences[MAX_TALK_SEQUENCES]; }; const PeopleData PEOPLE_DATA[MAX_PEOPLE] = { - { "HOLM", "Sherlock Holmes", { 1, 0, 0 }, { 1, 0, 0 } }, - { "WATS", "Dr. Watson", { 6, 0, 0 }, { 5, 5, 6, 7, 8, 7, 8, 6, 0, 0 } }, - { "LEST", "Inspector Lestrade", { 4, 0, 0 }, { 2, 0, 0 } }, - { "CON1", "Constable O'Brien", { 2, 0, 0 }, { 1, 0, 0 } }, - { "CON2", "Constable Lewis", { 2, 0, 0 }, { 1, 0, 0 } }, - { "SHEI", "Sheila Parker", { 2, 0, 0 }, { 2, 3, 0, 0 } }, - { "HENR", "Henry Carruthers", { 3, 0, 0 }, { 3, 0, 0 } }, - { "LESL", "Lesley", { 9, 0, 0 }, { 1, 2, 3, 2, 1, 2, 3, 0, 0 } }, - { "USH1", "An Usher", { 13, 0, 0 }, { 13, 14, 0, 0 } }, - { "USH2", "An Usher", { 2, 0, 0 }, { 2, 0, 0 } }, - { "FRED", "Fredrick Epstein", { 4, 0, 0 }, { 1, 2, 3, 4, 3, 4, 3, 2, 0, 0 } }, - { "WORT", "Mrs. Worthington", { 9, 0, 0 }, { 8, 0, 0 } }, - { "COAC", "The Coach", { 2, 0, 0 }, { 1, 2, 3, 4, 5, 4, 3, 2, 0, 0 } }, - { "PLAY", "A Player", { 8, 0, 0 }, { 7, 8, 0, 0 } }, - { "WBOY", "Tim", { 13, 0, 0 }, { 12, 13, 0, 0 } }, - { "JAME", "James Sanders", { 6, 0, 0 }, { 3, 4, 0, 0 } }, - { "BELL", "Belle", { 1, 0, 0 }, { 4, 5, 0, 0 } }, - { "GIRL", "Cleaning Girl", { 20, 0, 0 }, { 14, 15, 16, 17, 18, 19, 20, 20, 20, 0, 0 } }, - { "EPST", "Fredrick Epstein", { 17, 0, 0 }, { 16, 17, 18, 18, 18, 17, 17, 0, 0 } }, - { "WIGG", "Wiggins", { 3, 0, 0 }, { 2, 3, 0, 0 } }, - { "PAUL", "Paul", { 2, 0, 0 }, { 1, 2, 0, 0 } }, - { "BART", "The Bartender", { 1, 0, 0 }, { 1, 0, 0 } }, - { "DIRT", "A Dirty Drunk", { 1, 0, 0 }, { 1, 0, 0 } }, - { "SHOU", "A Shouting Drunk", { 1, 0, 0 }, { 1, 0, 0 } }, - { "STAG", "A Staggering Drunk", { 1, 0, 0 }, { 1, 0, 0 } }, - { "BOUN", "The Bouncer", { 1, 0, 0 }, { 1, 0, 0 } }, - { "SAND", "James Sanders", { 6, 0, 0 }, { 5, 6, 0, 0 } }, - { "CORO", "The Coroner", { 6, 0, 0 }, { 4, 5, 0, 0 } }, - { "EQUE", "Reginald Snipes", { 1, 0, 0 }, { 1, 0, 0 } }, - { "GEOR", "George Blackwood", { 1, 0, 0 }, { 1, 0, 0 } }, - { "LARS", "Lars", { 7, 0, 0 }, { 5, 6, 0, 0 } }, - { "PARK", "Sheila Parker", { 1, 0, 0 }, { 1, 0, 0 } }, - { "CHEM", "The Chemist", { 8, 0, 0 }, { 8, 9, 0, 0 } }, - { "GREG", "Inspector Gregson", { 6, 0, 0 }, { 5, 6, 0, 0 } }, - { "LAWY", "Jacob Farthington", { 1, 0, 0 }, { 1, 0, 0 } }, - { "MYCR", "Mycroft", { 1, 0, 0 }, { 1, 0, 0 } }, - { "SHER", "Old Sherman", { 7, 0, 0 }, { 7, 8, 0, 0 } }, - { "CHMB", "Richard", { 1, 0, 0 }, { 1, 0, 0 } }, - { "BARM", "The Barman", { 1, 0, 0 }, { 1, 0, 0 } }, - { "DAND", "A Dandy Player", { 1, 0, 0 }, { 1, 0, 0 } }, - { "ROUG", "A Rough-looking Player", { 1, 0, 0 }, { 1, 0, 0 } }, - { "SPEC", "A Spectator", { 1, 0, 0 }, { 1, 0, 0 } }, - { "HUNT", "Robert Hunt", { 1, 0, 0 }, { 1, 0, 0 } }, - { "VIOL", "Violet", { 3, 0, 0 }, { 3, 4, 0, 0 } }, - { "PETT", "Pettigrew", { 1, 0, 0 }, { 1, 0, 0 } }, - { "APPL", "Augie", { 8, 0, 0 }, { 14, 15, 0, 0 } }, - { "ANNA", "Anna Carroway", { 16, 0, 0 }, { 3, 4, 5, 6, 0, 0 } }, - { "GUAR", "A Guard", { 1, 0, 0 }, { 4, 5, 6, 0, 0 } }, - { "ANTO", "Antonio Caruso", { 8, 0, 0 }, { 7, 8, 0, 0 } }, - { "TOBY", "Toby the Dog", { 1, 0, 0 }, { 1, 0, 0 } }, - { "KING", "Simon Kingsley", { 13, 0, 0 }, { 13, 14, 0, 0 } }, - { "ALFR", "Alfred", { 2, 0, 0 }, { 2, 3, 0, 0 } }, - { "LADY", "Lady Brumwell", { 1, 0, 0 }, { 3, 4, 0, 0 } }, - { "ROSA", "Madame Rosa", { 1, 0, 0 }, { 1, 30, 0, 0 } }, - { "LADB", "Lady Brumwell", { 1, 0, 0 }, { 3, 4, 0, 0 } }, - { "MOOR", "Joseph Moorehead", { 1, 0, 0 }, { 1, 0, 0 } }, - { "BEAL", "Mrs. Beale", { 5, 0, 0 }, { 14, 15, 16, 17, 18, 19, 20, 0, 0 } }, - { "LION", "Felix", { 1, 0, 0 }, { 1, 0, 0 } }, - { "HOLL", "Hollingston", { 1, 0, 0 }, { 1, 0, 0 } }, - { "CALL", "Constable Callaghan", { 1, 0, 0 }, { 1, 0, 0 } }, - { "JERE", "Sergeant Duncan", { 2, 0, 0 }, { 1, 1, 2, 2, 0, 0 } }, - { "LORD", "Lord Brumwell", { 1, 0, 0 }, { 9, 10, 0, 0 } }, - { "NIGE", "Nigel Jaimeson", { 1, 0, 0 }, { 1, 2, 0, 138, 3, 4, 0, 138, 0, 0 } }, - { "JONA", "Jonas", { 1, 0, 0 }, { 1, 8, 0, 0 } }, - { "DUGA", "Constable Dugan", { 1, 0, 0 }, { 1, 0, 0 } }, - { "INSP", "Inspector Lestrade", { 4, 0, 0 }, { 2, 0, 0 } } + { "HOLM", kFixedText_People_SherlockHolmes, { 1, 0, 0 }, { 1, 0, 0 } }, + { "WATS", kFixedText_People_DrWatson, { 6, 0, 0 }, { 5, 5, 6, 7, 8, 7, 8, 6, 0, 0 } }, + { "LEST", kFixedText_People_InspectorLestrade, { 4, 0, 0 }, { 2, 0, 0 } }, + { "CON1", kFixedText_People_ConstableOBrien, { 2, 0, 0 }, { 1, 0, 0 } }, + { "CON2", kFixedText_People_ConstableLewis, { 2, 0, 0 }, { 1, 0, 0 } }, + { "SHEI", kFixedText_People_SheilaParker, { 2, 0, 0 }, { 2, 3, 0, 0 } }, + { "HENR", kFixedText_People_HenryCarruthers, { 3, 0, 0 }, { 3, 0, 0 } }, + { "LESL", kFixedText_People_Lesley, { 9, 0, 0 }, { 1, 2, 3, 2, 1, 2, 3, 0, 0 } }, + { "USH1", kFixedText_People_AnUsher, { 13, 0, 0 }, { 13, 14, 0, 0 } }, + { "USH2", kFixedText_People_AnUsher, { 2, 0, 0 }, { 2, 0, 0 } }, + { "FRED", kFixedText_People_FredrickEpstein, { 4, 0, 0 }, { 1, 2, 3, 4, 3, 4, 3, 2, 0, 0 } }, + { "WORT", kFixedText_People_MrsWorthington, { 9, 0, 0 }, { 8, 0, 0 } }, + { "COAC", kFixedText_People_TheCoach, { 2, 0, 0 }, { 1, 2, 3, 4, 5, 4, 3, 2, 0, 0 } }, + { "PLAY", kFixedText_People_APlayer, { 8, 0, 0 }, { 7, 8, 0, 0 } }, + { "WBOY", kFixedText_People_Tim, { 13, 0, 0 }, { 12, 13, 0, 0 } }, + { "JAME", kFixedText_People_JamesSanders, { 6, 0, 0 }, { 3, 4, 0, 0 } }, + { "BELL", kFixedText_People_Belle, { 1, 0, 0 }, { 4, 5, 0, 0 } }, + { "GIRL", kFixedText_People_CleaningGirl, { 20, 0, 0 }, { 14, 15, 16, 17, 18, 19, 20, 20, 20, 0, 0 } }, + { "EPST", kFixedText_People_FredrickEpstein, { 17, 0, 0 }, { 16, 17, 18, 18, 18, 17, 17, 0, 0 } }, + { "WIGG", kFixedText_People_Wiggins, { 3, 0, 0 }, { 2, 3, 0, 0 } }, + { "PAUL", kFixedText_People_Paul, { 2, 0, 0 }, { 1, 2, 0, 0 } }, + { "BART", kFixedText_People_TheBartender, { 1, 0, 0 }, { 1, 0, 0 } }, + { "DIRT", kFixedText_People_ADirtyDrunk, { 1, 0, 0 }, { 1, 0, 0 } }, + { "SHOU", kFixedText_People_AShoutingDrunk, { 1, 0, 0 }, { 1, 0, 0 } }, + { "STAG", kFixedText_People_AStaggeringDrunk, { 1, 0, 0 }, { 1, 0, 0 } }, + { "BOUN", kFixedText_People_TheBouncer, { 1, 0, 0 }, { 1, 0, 0 } }, + { "SAND", kFixedText_People_JamesSanders, { 6, 0, 0 }, { 5, 6, 0, 0 } }, + { "CORO", kFixedText_People_TheCoroner, { 6, 0, 0 }, { 4, 5, 0, 0 } }, + { "EQUE", kFixedText_People_ReginaldSnipes, { 1, 0, 0 }, { 1, 0, 0 } }, + { "GEOR", kFixedText_People_GeorgeBlackwood, { 1, 0, 0 }, { 1, 0, 0 } }, + { "LARS", kFixedText_People_Lars, { 7, 0, 0 }, { 5, 6, 0, 0 } }, + { "PARK", kFixedText_People_SheilaParker, { 1, 0, 0 }, { 1, 0, 0 } }, + { "CHEM", kFixedText_People_TheChemist, { 8, 0, 0 }, { 8, 9, 0, 0 } }, + { "GREG", kFixedText_People_InspectorGregson, { 6, 0, 0 }, { 5, 6, 0, 0 } }, + { "LAWY", kFixedText_People_JacobFarthington, { 1, 0, 0 }, { 1, 0, 0 } }, + { "MYCR", kFixedText_People_Mycroft, { 1, 0, 0 }, { 1, 0, 0 } }, + { "SHER", kFixedText_People_OldSherman, { 7, 0, 0 }, { 7, 8, 0, 0 } }, + { "CHMB", kFixedText_People_Richard, { 1, 0, 0 }, { 1, 0, 0 } }, + { "BARM", kFixedText_People_TheBarman, { 1, 0, 0 }, { 1, 0, 0 } }, + { "DAND", kFixedText_People_ADandyPlayer, { 1, 0, 0 }, { 1, 0, 0 } }, + { "ROUG", kFixedText_People_ARoughlookingPlayer, { 1, 0, 0 }, { 1, 0, 0 } }, + { "SPEC", kFixedText_People_ASpectator, { 1, 0, 0 }, { 1, 0, 0 } }, + { "HUNT", kFixedText_People_RobertHunt, { 1, 0, 0 }, { 1, 0, 0 } }, + { "VIOL", kFixedText_People_Violet, { 3, 0, 0 }, { 3, 4, 0, 0 } }, + { "PETT", kFixedText_People_Pettigrew, { 1, 0, 0 }, { 1, 0, 0 } }, + { "APPL", kFixedText_People_Augie, { 8, 0, 0 }, { 14, 15, 0, 0 } }, + { "ANNA", kFixedText_People_AnnaCarroway, { 16, 0, 0 }, { 3, 4, 5, 6, 0, 0 } }, + { "GUAR", kFixedText_People_AGuard, { 1, 0, 0 }, { 4, 5, 6, 0, 0 } }, + { "ANTO", kFixedText_People_AntonioCaruso, { 8, 0, 0 }, { 7, 8, 0, 0 } }, + { "TOBY", kFixedText_People_TobyTheDog, { 1, 0, 0 }, { 1, 0, 0 } }, + { "KING", kFixedText_People_SimonKingsley, { 13, 0, 0 }, { 13, 14, 0, 0 } }, + { "ALFR", kFixedText_People_Alfred, { 2, 0, 0 }, { 2, 3, 0, 0 } }, + { "LADY", kFixedText_People_LadyBrumwell, { 1, 0, 0 }, { 3, 4, 0, 0 } }, + { "ROSA", kFixedText_People_MadameRosa, { 1, 0, 0 }, { 1, 30, 0, 0 } }, + { "LADB", kFixedText_People_LadyBrumwell, { 1, 0, 0 }, { 3, 4, 0, 0 } }, + { "MOOR", kFixedText_People_JosephMoorehead, { 1, 0, 0 }, { 1, 0, 0 } }, + { "BEAL", kFixedText_People_MrsBeale, { 5, 0, 0 }, { 14, 15, 16, 17, 18, 19, 20, 0, 0 } }, + { "LION", kFixedText_People_Felix, { 1, 0, 0 }, { 1, 0, 0 } }, + { "HOLL", kFixedText_People_Hollingston, { 1, 0, 0 }, { 1, 0, 0 } }, + { "CALL", kFixedText_People_ConstableCallaghan, { 1, 0, 0 }, { 1, 0, 0 } }, + { "JERE", kFixedText_People_SergeantDuncan, { 2, 0, 0 }, { 1, 1, 2, 2, 0, 0 } }, + { "LORD", kFixedText_People_LordBrumwell, { 1, 0, 0 }, { 9, 10, 0, 0 } }, + { "NIGE", kFixedText_People_NigelJaimeson, { 1, 0, 0 }, { 1, 2, 0, 138, 3, 4, 0, 138, 0, 0 } }, + { "JONA", kFixedText_People_Jonas, { 1, 0, 0 }, { 1, 8, 0, 0 } }, + { "DUGA", kFixedText_People_ConstableDugan, { 1, 0, 0 }, { 1, 0, 0 } }, + { "INSP", kFixedText_People_InspectorLestrade, { 4, 0, 0 }, { 2, 0, 0 } } }; uint INFO_BLACK; @@ -295,9 +296,14 @@ void ScalpelEngine::initialize() { loadInventory(); // Set up list of people - for (int idx = 0; idx < MAX_PEOPLE; ++idx) - _people->_characters.push_back(PersonData(PEOPLE_DATA[idx].name, PEOPLE_DATA[idx].portrait, + ScalpelFixedText &fixedText = *(ScalpelFixedText *)_fixedText; + const char *peopleNamePtr = nullptr; + + for (int idx = 0; idx < MAX_PEOPLE; ++idx) { + peopleNamePtr = fixedText.getText(PEOPLE_DATA[idx].fixedTextId); + _people->_characters.push_back(PersonData(peopleNamePtr, PEOPLE_DATA[idx].portrait, PEOPLE_DATA[idx].stillSequences, PEOPLE_DATA[idx].talkSequences)); + } _animation->setPrologueNames(&PROLOGUE_NAMES[0], PROLOGUE_NAMES_COUNT); _animation->setPrologueFrames(&PROLOGUE_FRAMES[0][0], 6, 9); @@ -366,8 +372,8 @@ bool ScalpelEngine::showCityCutscene() { if (finished) { ImageFile titleImages_LondonNovember("title2.vgs", true); - _screen->_backBuffer1.blitFrom(*_screen); - _screen->_backBuffer2.blitFrom(*_screen); + _screen->_backBuffer1.SHblitFrom(*_screen); + _screen->_backBuffer2.SHblitFrom(*_screen); Common::Point londonPosition; @@ -381,19 +387,19 @@ bool ScalpelEngine::showCityCutscene() { } // London, England - _screen->_backBuffer1.transBlitFrom(titleImages_LondonNovember[0], londonPosition); + _screen->_backBuffer1.SHtransBlitFrom(titleImages_LondonNovember[0], londonPosition); _screen->randomTransition(); finished = _events->delay(1000, true); // November, 1888 if (finished) { - _screen->_backBuffer1.transBlitFrom(titleImages_LondonNovember[1], Common::Point(100, 100)); + _screen->_backBuffer1.SHtransBlitFrom(titleImages_LondonNovember[1], Common::Point(100, 100)); _screen->randomTransition(); finished = _events->delay(5000, true); } // Transition out the title - _screen->_backBuffer1.blitFrom(_screen->_backBuffer2); + _screen->_backBuffer1.SHblitFrom(_screen->_backBuffer2); _screen->randomTransition(); } @@ -402,8 +408,8 @@ bool ScalpelEngine::showCityCutscene() { if (finished) { ImageFile titleImages_SherlockHolmesTitle("title.vgs", true); - _screen->_backBuffer1.blitFrom(*_screen); - _screen->_backBuffer2.blitFrom(*_screen); + _screen->_backBuffer1.SHblitFrom(*_screen); + _screen->_backBuffer2.SHblitFrom(*_screen); Common::Point lostFilesPosition; Common::Point sherlockHolmesPosition; @@ -422,17 +428,17 @@ bool ScalpelEngine::showCityCutscene() { } // The Lost Files of - _screen->_backBuffer1.transBlitFrom(titleImages_SherlockHolmesTitle[0], lostFilesPosition); + _screen->_backBuffer1.SHtransBlitFrom(titleImages_SherlockHolmesTitle[0], lostFilesPosition); // Sherlock Holmes - _screen->_backBuffer1.transBlitFrom(titleImages_SherlockHolmesTitle[1], sherlockHolmesPosition); + _screen->_backBuffer1.SHtransBlitFrom(titleImages_SherlockHolmesTitle[1], sherlockHolmesPosition); // copyright - _screen->_backBuffer1.transBlitFrom(titleImages_SherlockHolmesTitle[2], copyrightPosition); + _screen->_backBuffer1.SHtransBlitFrom(titleImages_SherlockHolmesTitle[2], copyrightPosition); _screen->verticalTransition(); finished = _events->delay(4000, true); if (finished) { - _screen->_backBuffer1.blitFrom(_screen->_backBuffer2); + _screen->_backBuffer1.SHblitFrom(_screen->_backBuffer2); _screen->randomTransition(); finished = _events->delay(2000); } @@ -456,7 +462,7 @@ bool ScalpelEngine::showCityCutscene() { // English, width 175, height 38 alleyPosition = Common::Point(72, 51); } - _screen->transBlitFrom(titleImages_SherlockHolmesTitle[3], alleyPosition); + _screen->SHtransBlitFrom(titleImages_SherlockHolmesTitle[3], alleyPosition); _screen->fadeIn(palette, 3); // Wait until the track got looped and the first few notes were played @@ -532,7 +538,7 @@ bool ScalpelEngine::showAlleyCutscene() { earlyTheFollowingMorningPosition = Common::Point(35, 52); } - _screen->transBlitFrom(titleImages_EarlyTheFollowingMorning[0], earlyTheFollowingMorningPosition); + _screen->SHtransBlitFrom(titleImages_EarlyTheFollowingMorning[0], earlyTheFollowingMorningPosition); // fast fade-in _screen->fadeIn(palette, 1); @@ -636,23 +642,23 @@ bool ScalpelEngine::scrollCredits() { delete stream; // Save a copy of the screen background for use in drawing each credit frame - _screen->_backBuffer1.blitFrom(*_screen); + _screen->_backBuffer1.SHblitFrom(*_screen); // Loop for showing the credits for(int idx = 0; idx < 600 && !_events->kbHit() && !shouldQuit(); ++idx) { // Copy the entire screen background before writing text - _screen->blitFrom(_screen->_backBuffer1); + _screen->SHblitFrom(_screen->_backBuffer1); // Write the text appropriate for the next frame if (idx < 400) - _screen->transBlitFrom(creditsImages[0], Common::Point(10, 200 - idx), false, 0); + _screen->SHtransBlitFrom(creditsImages[0], Common::Point(10, 200 - idx), false, 0); if (idx > 200) - _screen->transBlitFrom(creditsImages[1], Common::Point(10, 400 - idx), false, 0); + _screen->SHtransBlitFrom(creditsImages[1], Common::Point(10, 400 - idx), false, 0); // Don't show credit text on the top and bottom ten rows of the screen - _screen->blitFrom(_screen->_backBuffer1, Common::Point(0, 0), Common::Rect(0, 0, _screen->w(), 10)); - _screen->blitFrom(_screen->_backBuffer1, Common::Point(0, _screen->h() - 10), - Common::Rect(0, _screen->h() - 10, _screen->w(), _screen->h())); + _screen->SHblitFrom(_screen->_backBuffer1, Common::Point(0, 0), Common::Rect(0, 0, _screen->width(), 10)); + _screen->SHblitFrom(_screen->_backBuffer1, Common::Point(0, _screen->height() - 10), + Common::Rect(0, _screen->height() - 10, _screen->width(), _screen->height())); _events->delay(100); } @@ -665,7 +671,7 @@ bool ScalpelEngine::show3DOSplash() { // 3DO EA Splash screen ImageFile3DO titleImage_3DOSplash("3DOSplash.cel", kImageFile3DOType_Cel); - _screen->transBlitFrom(titleImage_3DOSplash[0]._frame, Common::Point(0, -20)); + _screen->SHtransBlitFrom(titleImage_3DOSplash[0]._frame, Common::Point(0, -20)); bool finished = _events->delay(3000, true); if (finished) { @@ -701,7 +707,7 @@ bool ScalpelEngine::showCityCutscene3DO() { _sound->playAiff("prologue/sounds/rain.aiff", 15, true); // Fade screen to grey - screen._backBuffer1.fill(0xCE59); // RGB565: 25, 50, 25 (grey) + screen._backBuffer1.clear(0xCE59); // RGB565: 25, 50, 25 (grey) screen.fadeIntoScreen3DO(2); } @@ -710,16 +716,16 @@ bool ScalpelEngine::showCityCutscene3DO() { } if (finished) { - screen._backBuffer1.fill(0); // fill backbuffer with black to avoid issues during fade from white + screen._backBuffer1.clear(0); // fill backbuffer with black to avoid issues during fade from white finished = _animation->play3DO("26open1", true, 1, true, 2); } if (finished) { - screen._backBuffer2.blitFrom(screen._backBuffer1); + screen._backBuffer2.SHblitFrom(screen._backBuffer1); // "London, England" ImageFile3DO titleImage_London("title2a.cel", kImageFile3DOType_Cel); - screen._backBuffer1.transBlitFrom(titleImage_London[0]._frame, Common::Point(30, 50)); + screen._backBuffer1.SHtransBlitFrom(titleImage_London[0]._frame, Common::Point(30, 50)); screen.fadeIntoScreen3DO(1); finished = _events->delay(1500, true); @@ -727,7 +733,7 @@ bool ScalpelEngine::showCityCutscene3DO() { if (finished) { // "November, 1888" ImageFile3DO titleImage_November("title2b.cel", kImageFile3DOType_Cel); - screen._backBuffer1.transBlitFrom(titleImage_November[0]._frame, Common::Point(100, 100)); + screen._backBuffer1.SHtransBlitFrom(titleImage_November[0]._frame, Common::Point(100, 100)); screen.fadeIntoScreen3DO(1); finished = _music->waitUntilMSec(14700, 0, 0, 5000); @@ -735,8 +741,8 @@ bool ScalpelEngine::showCityCutscene3DO() { if (finished) { // Restore screen - _screen->_backBuffer1.blitFrom(screen._backBuffer2); - _screen->blitFrom(screen._backBuffer1); + _screen->_backBuffer1.SHblitFrom(screen._backBuffer2); + _screen->SHblitFrom(screen._backBuffer1); } } @@ -746,7 +752,7 @@ bool ScalpelEngine::showCityCutscene3DO() { if (finished) { // "Sherlock Holmes" (title) ImageFile3DO titleImage_SherlockHolmesTitle("title1ab.cel", kImageFile3DOType_Cel); - screen._backBuffer1.transBlitFrom(titleImage_SherlockHolmesTitle[0]._frame, Common::Point(34, 5)); + screen._backBuffer1.SHtransBlitFrom(titleImage_SherlockHolmesTitle[0]._frame, Common::Point(34, 5)); // Blend in screen.fadeIntoScreen3DO(2); @@ -756,7 +762,7 @@ bool ScalpelEngine::showCityCutscene3DO() { if (finished) { ImageFile3DO titleImage_Copyright("title1c.cel", kImageFile3DOType_Cel); - screen.transBlitFrom(titleImage_Copyright[0]._frame, Common::Point(20, 190)); + screen.SHtransBlitFrom(titleImage_Copyright[0]._frame, Common::Point(20, 190)); finished = _events->delay(3500, true); } } @@ -775,7 +781,7 @@ bool ScalpelEngine::showCityCutscene3DO() { if (finished) { // "In the alley behind the Regency Theatre..." ImageFile3DO titleImage_InTheAlley("title1d.cel", kImageFile3DOType_Cel); - screen._backBuffer1.transBlitFrom(titleImage_InTheAlley[0]._frame, Common::Point(72, 51)); + screen._backBuffer1.SHtransBlitFrom(titleImage_InTheAlley[0]._frame, Common::Point(72, 51)); // Fade in screen.fadeIntoScreen3DO(4); @@ -814,7 +820,7 @@ bool ScalpelEngine::showAlleyCutscene3DO() { ImageFile3DO titleImage_ScreamingVictim("scream.cel", kImageFile3DOType_Cel); screen.clear(); - screen.transBlitFrom(titleImage_ScreamingVictim[0]._frame, Common::Point(0, 0)); + screen.SHtransBlitFrom(titleImage_ScreamingVictim[0]._frame, Common::Point(0, 0)); // Play "scream.aiff" if (_sound->_voices) @@ -843,7 +849,7 @@ bool ScalpelEngine::showAlleyCutscene3DO() { if (finished) { // "Early the following morning on Baker Street..." ImageFile3DO titleImage_EarlyTheFollowingMorning("title3.cel", kImageFile3DOType_Cel); - screen._backBuffer1.transBlitFrom(titleImage_EarlyTheFollowingMorning[0]._frame, Common::Point(35, 51)); + screen._backBuffer1.SHtransBlitFrom(titleImage_EarlyTheFollowingMorning[0]._frame, Common::Point(35, 51)); // Fade in screen.fadeIntoScreen3DO(4); @@ -903,7 +909,7 @@ bool ScalpelEngine::showOfficeCutscene3DO() { ImageFile3DO titleImage_CoffeeNote("note.cel", kImageFile3DOType_Cel); _screen->clear(); - _screen->transBlitFrom(titleImage_CoffeeNote[0]._frame, Common::Point(0, 0)); + _screen->SHtransBlitFrom(titleImage_CoffeeNote[0]._frame, Common::Point(0, 0)); if (_sound->_voices) { finished = _sound->playSound("prologue/sounds/note.aiff", WAIT_KBD_OR_FINISH); @@ -932,7 +938,7 @@ bool ScalpelEngine::showOfficeCutscene3DO() { // TODO: Brighten the image, possibly by doing a partial fade // to white. - _screen->_backBuffer2.blitFrom(_screen->_backBuffer1); + _screen->_backBuffer2.SHblitFrom(_screen->_backBuffer1); for (int nr = 1; finished && nr <= 4; nr++) { char filename[15]; @@ -940,8 +946,8 @@ bool ScalpelEngine::showOfficeCutscene3DO() { ImageFile3DO *creditsImage = new ImageFile3DO(filename, kImageFile3DOType_Cel); ImageFrame *creditsFrame = &(*creditsImage)[0]; for (int i = 0; finished && i < 200 + creditsFrame->_height; i++) { - _screen->blitFrom(_screen->_backBuffer2); - _screen->transBlitFrom(creditsFrame->_frame, Common::Point((320 - creditsFrame->_width) / 2, 200 - i)); + _screen->SHblitFrom(_screen->_backBuffer2); + _screen->SHtransBlitFrom(creditsFrame->_frame, Common::Point((320 - creditsFrame->_width) / 2, 200 - i)); if (!_events->delay(70, true)) finished = false; } @@ -993,7 +999,7 @@ void ScalpelEngine::showLBV(const Common::String &filename) { delete stream; _screen->setPalette(images._palette); - _screen->_backBuffer1.blitFrom(images[0]); + _screen->_backBuffer1.SHblitFrom(images[0]); _screen->verticalTransition(); } @@ -1151,7 +1157,7 @@ void ScalpelEngine::eraseBrumwellMirror() { // If player is in range of the mirror, then restore background from the secondary back buffer if (Common::Rect(70, 100, 200, 200).contains(pt)) { - _screen->_backBuffer1.blitFrom(_screen->_backBuffer2, Common::Point(137, 18), + _screen->_backBuffer1.SHblitFrom(_screen->_backBuffer2, Common::Point(137, 18), Common::Rect(137, 18, 184, 74)); } } @@ -1213,20 +1219,20 @@ void ScalpelEngine::doBrumwellMirror() { bool flipped = people[HOLMES]._sequenceNumber == WALK_LEFT || people[HOLMES]._sequenceNumber == STOP_LEFT || people[HOLMES]._sequenceNumber == WALK_UPRIGHT || people[HOLMES]._sequenceNumber == STOP_UPRIGHT || people[HOLMES]._sequenceNumber == WALK_DOWNLEFT || people[HOLMES]._sequenceNumber == STOP_DOWNLEFT; - _screen->_backBuffer1.transBlitFrom(imageFrame, pt + Common::Point(38, -imageFrame._frame.h - 25), flipped); + _screen->_backBuffer1.SHtransBlitFrom(imageFrame, pt + Common::Point(38, -imageFrame._frame.h - 25), flipped); // Redraw the mirror borders to prevent the drawn image of Holmes from appearing outside of the mirror - _screen->_backBuffer1.blitFrom(_screen->_backBuffer2, Common::Point(114, 18), + _screen->_backBuffer1.SHblitFrom(_screen->_backBuffer2, Common::Point(114, 18), Common::Rect(114, 18, 137, 114)); - _screen->_backBuffer1.blitFrom(_screen->_backBuffer2, Common::Point(137, 70), + _screen->_backBuffer1.SHblitFrom(_screen->_backBuffer2, Common::Point(137, 70), Common::Rect(137, 70, 142, 114)); - _screen->_backBuffer1.blitFrom(_screen->_backBuffer2, Common::Point(142, 71), + _screen->_backBuffer1.SHblitFrom(_screen->_backBuffer2, Common::Point(142, 71), Common::Rect(142, 71, 159, 114)); - _screen->_backBuffer1.blitFrom(_screen->_backBuffer2, Common::Point(159, 72), + _screen->_backBuffer1.SHblitFrom(_screen->_backBuffer2, Common::Point(159, 72), Common::Rect(159, 72, 170, 116)); - _screen->_backBuffer1.blitFrom(_screen->_backBuffer2, Common::Point(170, 73), + _screen->_backBuffer1.SHblitFrom(_screen->_backBuffer2, Common::Point(170, 73), Common::Rect(170, 73, 184, 114)); - _screen->_backBuffer1.blitFrom(_screen->_backBuffer2, Common::Point(184, 18), + _screen->_backBuffer1.SHblitFrom(_screen->_backBuffer2, Common::Point(184, 18), Common::Rect(184, 18, 212, 114)); } } @@ -1267,7 +1273,7 @@ void ScalpelEngine::showScummVMRestoreDialog() { bool ScalpelEngine::play3doMovie(const Common::String &filename, const Common::Point &pos, bool isPortrait) { Scalpel3DOScreen &screen = *(Scalpel3DOScreen *)_screen; Scalpel3DOMovieDecoder *videoDecoder = new Scalpel3DOMovieDecoder(); - Graphics::Surface tempSurface; + Graphics::ManagedSurface tempSurface; Common::Point framePos(pos.x, pos.y); ImageFile3DO *frameImageFile = nullptr; @@ -1302,7 +1308,7 @@ bool ScalpelEngine::play3doMovie(const Common::String &filename, const Common::P // If we're to show the movie at half-size, we'll need a temporary intermediate surface if (halfSize) - tempSurface.create(width / 2, height / 2, _screen->getPixelFormat()); + tempSurface.create(width / 2, height / 2); while (!shouldQuit() && !videoDecoder->endOfVideo() && !skipVideo) { if (videoDecoder->needsUpdate()) { @@ -1366,19 +1372,19 @@ bool ScalpelEngine::play3doMovie(const Common::String &filename, const Common::P } // Point the drawing frame to the temporary surface - frame = &tempSurface; + frame = &tempSurface.rawSurface(); } if (isPortrait && !frameShown) { // Draw the frame (not the frame of the video, but a frame around the video) itself - _screen->transBlitFrom(frameImage->_frame, framePos); + _screen->SHtransBlitFrom(frameImage->_frame, framePos); frameShown = true; } if (isPortrait && !halfSize) { screen.rawBlitFrom(*frame, Common::Point(pos.x * 2, pos.y * 2)); } else { - _screen->blitFrom(*frame, pos); + _screen->SHblitFrom(*frame, pos); } _screen->update(); @@ -1408,9 +1414,9 @@ bool ScalpelEngine::play3doMovie(const Common::String &filename, const Common::P } // Restore scene - screen._backBuffer1.blitFrom(screen._backBuffer2); + screen._backBuffer1.SHblitFrom(screen._backBuffer2); _scene->updateBackground(); - screen.slamArea(0, 0, screen.w(), CONTROLS_Y); + screen.slamArea(0, 0, screen.width(), CONTROLS_Y); return !skipVideo; } diff --git a/engines/sherlock/scalpel/scalpel_darts.cpp b/engines/sherlock/scalpel/scalpel_darts.cpp index 87f4566837..c5ba8032f3 100644 --- a/engines/sherlock/scalpel/scalpel_darts.cpp +++ b/engines/sherlock/scalpel/scalpel_darts.cpp @@ -102,7 +102,7 @@ void Darts::playDarts() { score -= lastDart; _roundScore += lastDart; - screen._backBuffer1.blitFrom(screen._backBuffer2, Common::Point(DART_INFO_X, DART_INFO_Y - 1), + screen._backBuffer1.SHblitFrom(screen._backBuffer2, Common::Point(DART_INFO_X, DART_INFO_Y - 1), Common::Rect(DART_INFO_X, DART_INFO_Y - 1, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT)); screen.print(Common::Point(DART_INFO_X, DART_INFO_Y), DART_COL_FORE, "Dart # %d", idx + 1); screen.print(Common::Point(DART_INFO_X, DART_INFO_Y + 10), DART_COL_FORE, "Scored %d points", lastDart); @@ -154,7 +154,7 @@ void Darts::playDarts() { events.wait(20); } - screen._backBuffer1.blitFrom(screen._backBuffer2, Common::Point(DART_INFO_X, DART_INFO_Y - 1), + screen._backBuffer1.SHblitFrom(screen._backBuffer2, Common::Point(DART_INFO_X, DART_INFO_Y - 1), Common::Rect(DART_INFO_X, DART_INFO_Y - 1, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT)); screen.slamArea(0, 0, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT); } @@ -166,8 +166,8 @@ void Darts::playDarts() { done |= _vm->shouldQuit(); if (!done) { - screen._backBuffer2.blitFrom((*_dartImages)[0], Common::Point(0, 0)); - screen._backBuffer1.blitFrom(screen._backBuffer2); + screen._backBuffer2.SHblitFrom((*_dartImages)[0], Common::Point(0, 0)); + screen._backBuffer1.SHblitFrom(screen._backBuffer2); screen.slamArea(0, 0, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT); } } while (!done); @@ -185,7 +185,7 @@ void Darts::loadDarts() { _dartImages = new ImageFile("darts.vgs"); screen.setPalette(_dartImages->_palette); - screen._backBuffer1.blitFrom((*_dartImages)[0], Common::Point(0, 0)); + screen._backBuffer1.SHblitFrom((*_dartImages)[0], Common::Point(0, 0)); screen.slamArea(0, 0, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT); } @@ -245,7 +245,7 @@ void Darts::showNames(int playerNum) { screen.slamArea(STATUS_INFO_X + 50, STATUS_INFO_Y + 10, 81, 12); // Make a copy of the back buffer to the secondary one - screen._backBuffer2.blitFrom(screen._backBuffer1); + screen._backBuffer2.SHblitFrom(screen._backBuffer1); } void Darts::showStatus(int playerNum) { @@ -253,7 +253,7 @@ void Darts::showStatus(int playerNum) { byte color; // Copy scoring screen from secondary back buffer. This will erase any previously displayed status/score info - screen._backBuffer1.blitFrom(screen._backBuffer2, Common::Point(STATUS_INFO_X, STATUS_INFO_Y + 10), + screen._backBuffer1.SHblitFrom(screen._backBuffer2, Common::Point(STATUS_INFO_X, STATUS_INFO_Y + 10), Common::Rect(STATUS_INFO_X, STATUS_INFO_Y + 10, SHERLOCK_SCREEN_WIDTH, STATUS_INFO_Y + 48)); color = (playerNum == 0) ? PLAYER_COLOR : DART_COL_FORE; @@ -292,7 +292,7 @@ int Darts::throwDart(int dartNum, int computer) { if (_vm->shouldQuit()) return 0; - screen._backBuffer1.blitFrom(screen._backBuffer2, Common::Point(DART_INFO_X, DART_INFO_Y - 1), + screen._backBuffer1.SHblitFrom(screen._backBuffer2, Common::Point(DART_INFO_X, DART_INFO_Y - 1), Common::Rect(DART_INFO_X, DART_INFO_Y - 1, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT)); screen.slamRect(Common::Rect(DART_INFO_X, DART_INFO_Y - 1, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT)); @@ -309,9 +309,9 @@ int Darts::throwDart(int dartNum, int computer) { // Copy the bars to the secondary back buffer so that they remain fixed at their selected values // whilst the dart is being animated at being thrown at the board - screen._backBuffer2.blitFrom(screen._backBuffer1, Common::Point(DARTBARHX - 1, DARTHORIZY - 1), + screen._backBuffer2.SHblitFrom(screen._backBuffer1, Common::Point(DARTBARHX - 1, DARTHORIZY - 1), Common::Rect(DARTBARHX - 1, DARTHORIZY - 1, DARTBARHX + DARTBARSIZE + 3, DARTHORIZY + 10)); - screen._backBuffer2.blitFrom(screen._backBuffer1, Common::Point(DARTBARVX - 1, DARTHEIGHTY - 1), + screen._backBuffer2.SHblitFrom(screen._backBuffer1, Common::Point(DARTBARVX - 1, DARTHEIGHTY - 1), Common::Rect(DARTBARVX - 1, DARTHEIGHTY - 1, DARTBARVX + 11, DARTHEIGHTY + DARTBARSIZE + 3)); // Convert height and width to relative range of -50 to 50, where 0,0 is the exact centre of the board @@ -344,7 +344,7 @@ void Darts::drawDartThrow(const Common::Point &pt) { // Draw the dart Common::Point drawPos(pos.x - frame._width / 2, pos.y - frame._height); - screen._backBuffer1.transBlitFrom(frame, drawPos); + screen._backBuffer1.SHtransBlitFrom(frame, drawPos); screen.slamArea(drawPos.x, drawPos.y, frame._width, frame._height); // Handle erasing old dart frame area @@ -352,14 +352,14 @@ void Darts::drawDartThrow(const Common::Point &pt) { screen.slamRect(oldDrawBounds); oldDrawBounds = Common::Rect(drawPos.x, drawPos.y, drawPos.x + frame._width, drawPos.y + frame._height); - screen._backBuffer1.blitFrom(screen._backBuffer2, drawPos, oldDrawBounds); + screen._backBuffer1.SHblitFrom(screen._backBuffer2, drawPos, oldDrawBounds); events.wait(2); } // Draw dart in final "stuck to board" form - screen._backBuffer1.transBlitFrom((*_dartImages)[22], Common::Point(oldDrawBounds.left, oldDrawBounds.top)); - screen._backBuffer2.transBlitFrom((*_dartImages)[22], Common::Point(oldDrawBounds.left, oldDrawBounds.top)); + screen._backBuffer1.SHtransBlitFrom((*_dartImages)[22], Common::Point(oldDrawBounds.left, oldDrawBounds.top)); + screen._backBuffer2.SHtransBlitFrom((*_dartImages)[22], Common::Point(oldDrawBounds.left, oldDrawBounds.top)); screen.slamRect(oldDrawBounds); } @@ -368,8 +368,8 @@ void Darts::erasePowerBars() { screen._backBuffer1.fillRect(Common::Rect(DARTBARHX, DARTHORIZY, DARTBARHX + DARTBARSIZE, DARTHORIZY + 10), BLACK); screen._backBuffer1.fillRect(Common::Rect(DARTBARVX, DARTHEIGHTY, DARTBARVX + 10, DARTHEIGHTY + DARTBARSIZE), BLACK); - screen._backBuffer1.transBlitFrom((*_dartImages)[2], Common::Point(DARTBARHX - 1, DARTHORIZY - 1)); - screen._backBuffer1.transBlitFrom((*_dartImages)[3], Common::Point(DARTBARVX - 1, DARTHEIGHTY - 1)); + screen._backBuffer1.SHtransBlitFrom((*_dartImages)[2], Common::Point(DARTBARHX - 1, DARTHORIZY - 1)); + screen._backBuffer1.SHtransBlitFrom((*_dartImages)[3], Common::Point(DARTBARVX - 1, DARTHEIGHTY - 1)); screen.slamArea(DARTBARHX - 1, DARTHORIZY - 1, DARTBARSIZE + 3, 11); screen.slamArea(DARTBARVX - 1, DARTHEIGHTY - 1, 11, DARTBARSIZE + 3); } @@ -398,11 +398,11 @@ int Darts::doPowerBar(const Common::Point &pt, byte color, int goToPower, bool i if (isVertical) { screen._backBuffer1.hLine(pt.x, pt.y + DARTBARSIZE - 1 - idx, pt.x + 8, color); - screen._backBuffer1.transBlitFrom((*_dartImages)[3], Common::Point(pt.x - 1, pt.y - 1)); + screen._backBuffer1.SHtransBlitFrom((*_dartImages)[3], Common::Point(pt.x - 1, pt.y - 1)); screen.slamArea(pt.x, pt.y + DARTBARSIZE - 1 - idx, 8, 2); } else { screen._backBuffer1.vLine(pt.x + idx, pt.y, pt.y + 8, color); - screen._backBuffer1.transBlitFrom((*_dartImages)[2], Common::Point(pt.x - 1, pt.y - 1)); + screen._backBuffer1.SHtransBlitFrom((*_dartImages)[2], Common::Point(pt.x - 1, pt.y - 1)); screen.slamArea(pt.x + idx, pt.y, 1, 8); } diff --git a/engines/sherlock/scalpel/scalpel_debugger.cpp b/engines/sherlock/scalpel/scalpel_debugger.cpp index 7f5e1efa69..02b39ade9b 100644 --- a/engines/sherlock/scalpel/scalpel_debugger.cpp +++ b/engines/sherlock/scalpel/scalpel_debugger.cpp @@ -22,10 +22,9 @@ #include "sherlock/scalpel/scalpel_debugger.h" #include "sherlock/sherlock.h" +#include "audio/audiostream.h" #include "audio/mixer.h" -#include "audio/decoders/3do.h" #include "audio/decoders/aiff.h" -#include "audio/decoders/wave.h" namespace Sherlock { @@ -42,7 +41,7 @@ bool ScalpelDebugger::cmd3DO_PlayMovie(int argc, const char **argv) { return true; } - // play gets postboned until debugger is closed + // play gets postponed until debugger is closed Common::String filename = argv[1]; _3doPlayMovieFile = filename; diff --git a/engines/sherlock/scalpel/scalpel_fixed_text.cpp b/engines/sherlock/scalpel/scalpel_fixed_text.cpp index 63f84d68c6..d76136a1db 100644 --- a/engines/sherlock/scalpel/scalpel_fixed_text.cpp +++ b/engines/sherlock/scalpel/scalpel_fixed_text.cpp @@ -28,33 +28,70 @@ namespace Sherlock { namespace Scalpel { static const char *const fixedTextEN[] = { + // Game hotkeys + "LMTPOCIUGJFS", // SH1: Window buttons - "Exit", - "Up", - "Down", + "EExit", + "UUp", + "DDown", // SH1: Inventory buttons - "Exit", - "Look", - "Use", - "Give", + "EExit", + "LLook", + "UUse", + "GGive", // SH1: Journal text "Watson's Journal", "Page %d", // SH1: Journal buttons - "Exit", - "Back 10", - "Up", - "Down", - "Ahead 10", - "Search", - "First Page", - "Last Page", - "Print Text", + "EExit", + "BBack 10", + "UUp", + "DDown", + "AAhead 10", + "SSearch", + "FFirst Page", + "LLast Page", + "PPrint Text", // SH1: Journal search - "Exit", - "Backward", - "Forward", + "EExit", + "BBackward", + "FForward", "Text Not Found !", + // SH1: Settings + "EExit", + "MMusic on", + "MMusic off", + "PPortraits on", + "PPortraits off", + "JJoystick off", + "NNew Font Style", + "SSound Effects on", + "SSound Effects off", + "WWindows Slide", + "WWindows Appear", + "CCalibrate Joystick", + "AAuto Help left", + "AAuto Help right", + "VVoices on", + "VVoices off", + "FFade by Pixel", + "FFade Directly", + "KKey Pad Slow", + "KKey Pad Fast", + // Load/Save + "EExit", + "LLoad", + "SSave", + "UUp", + "DDown", + "QQuit", + // Quit Game + "Are you sure you wish to Quit ?", + "YYes", + "NNo", + // SH1: Press key text + "PPress any Key for More.", + "PPress any Key to Continue.", // SH1: Initial Inventory "A message requesting help", "A number of business cards", @@ -68,11 +105,75 @@ static const char *const fixedTextEN[] = { "Tarot Cards", "An ornate key", "A pawn ticket", - // SH2: Verbs - "Open", - "Look", - "Talk", - "Journal" + // SH1: User Interface + "No, thank you.", + "You can't do that.", + "Done...", + "Use ", + " on %s", + "Give ", + " to %s", + // SH1: People names + "Sherlock Holmes", + "Dr. Watson", + "Inspector Lestrade", + "Constable O'Brien", + "Constable Lewis", + "Sheila Parker", + "Henry Carruthers", + "Lesley", + "An Usher", + "Fredrick Epstein", + "Mrs. Worthington", + "The Coach", + "A Player", + "Tim", + "James Sanders", + "Belle", + "Cleaning Girl", + "Wiggins", + "Paul", + "The Bartender", + "A Dirty Drunk", + "A Shouting Drunk", + "A Staggering Drunk", + "The Bouncer", + "The Coroner", + "Reginald Snipes", + "George Blackwood", + "Lars", + "The Chemist", + "Inspector Gregson", + "Jacob Farthington", + "Mycroft", + "Old Sherman", + "Richard", + "The Barman", + "A Dandy Player", + "A Rough-looking Player", + "A Spectator", + "Robert Hunt", + "Violet", + "Pettigrew", + "Augie", + "Anna Carroway", + "A Guard", + "Antonio Caruso", + "Toby the Dog", + "Simon Kingsley", + "Alfred", + "Lady Brumwell", + "Madame Rosa", + "Joseph Moorehead", + "Mrs. Beale", + "Felix", + "Hollingston", + "Constable Callaghan", + "Sergeant Duncan", + "Lord Brumwell", + "Nigel Jaimeson", + "Jonas", + "Constable Dugan" }; // sharp-s : 0xE1 / octal 341 @@ -80,33 +181,70 @@ static const char *const fixedTextEN[] = { // small o-umlaut: 0x94 / octal 224 // small u-umlaut: 0x81 / octal 201 static const char *const fixedTextDE[] = { + // Game hotkeys + "SBRNOCTEGADU", // original: did not support hotkeys for actions // SH1: Window buttons - "Zur\201ck", - "Hoch", - "Runter", + "ZZur\201ck", + "HHoch", + "RRunter", // SH1: Inventory buttons - "Zur\201ck", - "Schau", - "Benutze", - "Gib", + "ZZur\201ck", + "SSchau", + "BBenutze", + "GGib", // SH1: Journal text "Watsons Tagebuch", "Seite %d", // SH1: Journal buttons - "Zur\201ck", - "10 hoch", - "Hoch", - "Runter", - "10 runter", - "Suche", - "Erste Seite", - "Letzte Seite", - "Drucke Text", + "ZZur\201ck", // original: "Zur\201ck" + "o10 hoch", + "HHoch", + "RRunter", + "u10 runter", // original: "10 runter" + "SSuche", + "EErste Seite", + "LLetzte Seite", + "DDrucke Text", // SH1: Journal search - "Zur\201ck", - "R\201ckw\204rts", // original: "Backward" - "Vorw\204rts", // original: "Forward" + "ZZur\201ck", + "RR\201ckw\204rts", // original: "Backward" + "VVorw\204rts", // original: "Forward" "Text nicht gefunden!", + // SH1: Settings + "ZZur\201ck", // original interpreter: "Exit" + "MMusik an", + "MMusik aus", + "PPortr\204ts an", // original interpreter: "Portraits" + "PPortr\204ts aus", + "JJoystick aus", + "NNeue Schrift", + "GGer\204uscheffekte on", // original interpreter: "Effekte" + "GGer\204uscheffekte off", + "FFenster gleitend", + "FFenster direkt", + "JJustiere Joystick", + "HHilfe links", + "HHilfe rechts", + "SSprache an", + "SSprache aus", + "cSchnitt", + "BBlende", + "CCursor langsam", + "CCursor schnell", + // Load/Save + "ZZur\201ck", + "LLaden", + "SSichern", + "HHoch", + "RRunter", + "EEnde", + // Quit Game + "Das Spiel verlassen ?", + "JJa", + "NNein", + // SH1: Press key text + "MMehr auf Tastendruck...", + "BBeliebige Taste dr\201cken.", // SH1: Initial Inventory "Ein Hilferuf von Lestrade", "Holmes' Visitenkarten", @@ -117,47 +255,149 @@ static const char *const fixedTextDE[] = { "Eine offene Taschenuhr", "Ein Zettel mit Zahlen drauf", "Ein mehrfach gefalteter Briefbogen", - "Ein Tarock-Kartenspiel", // [sic] + "Ein Tarot-Kartenspiel", // original interpreter: "Ein Tarock-Kartenspiel" [sic] "Ein verzierter Schl\201ssel", "Ein Pfandschein", - // SH2: Verbs - "\231ffne", - "Schau", - "Rede", - "Tagebuch" + // SH1: User Interface + "Nein, vielen Dank.", + "Nein, das geht wirklich nicht.", // original: "Nein, das geht wirklich nicht" + "Fertig...", + "Benutze ", + " mit %s", + "Gib ", // original: "Gebe " + " an %s", // original: " zu %s" + // SH1: People names + "Sherlock Holmes", + "Dr. Watson", + "Inspektor Lestrade", + "Konstabler O'Brien", + "Konstabler Lewis", + "Sheila Parker", + "Henry Carruthers", + "Lesley", + "Platzanweiser", + "Fredrick Epstein", + "Mrs. Worthington", + "Der Trainer", + "Ein Spieler", + "Tim", + "James Sanders", + "Belle", + "Putzm\204dchen", + "Wiggins", + "Paul", + "Gastwirt", + "Schmutziger Betrunkener", + "Lallender Betrunkener", + "Torkelnder Betrunkener", + "The Bouncer", + "Der Leichenbeschauer", + "Reginald Snipes", + "George Blackwood", + "Lars", + "Apotheker", + "Inspektor Gregson", + "Jacob Farthington", + "Mycroft", + "Old Sherman", + "Richard", + "Barkeeper", + "Jock Mahoney", + "Nobby Charleton", + "Zuschauer", + "Robert Hunt", + "Violet", + "Pettigrew", + "Augie", + "Anna Carroway", + "Wache", + "Antonio Caruso", + "Toby the Dog", + "Simon Kingsley", + "Alfred", + "Lady Brumwell", + "Madame Rosa", + "Joseph Moorehead", + "Mrs. Beale", + "Felix", + "Hollingston", + "Konstabler Callaghan", + "Sergeant Duncan", + "Lord Brumwell", + "Nigel Jaimeson", + "Jonas", + "Konstabler Dugan" }; // up-side down exclamation mark - 0xAD / octal 255 // up-side down question mark - 0xA8 / octal 250 // n with a wave on top - 0xA4 / octal 244 +// more characters see engines/sherlock/fixed_text.cpp static const char *const fixedTextES[] = { + // Game hotkeys + "VMHTACIUDNFO", // SH1: Window buttons - "Exit", - "Subir", - "Bajar", + "aSalir", // original interpreter: "Exit" + "SSubir", + "BBajar", // SH1: Inventory buttons - "Exit", - "Mirar", - "Usar", - "Dar", + "SSalir", // original interpreter: "Exit" + "MMirar", + "UUsar", + "DDar", // SH1: Journal text "Diario de Watson", "Pagina %d", // SH1: Journal buttons - "Exit", - "Retroceder", - "Subir", - "baJar", - "Adelante", - "Buscar", - "1a pagina", - "Ult pagina", - "Imprimir", + "aSalir", // original interpreter: "Exit" + "RRetroceder", + "SSubir", + "JbaJar", + "AAdelante", + "BBuscar", + "11a pagina", + "UUlt pagina", + "IImprimir", // SH1: Journal search - "Exit", - "Retroceder", - "Avanzar", + "SSalir", // original interpreter: "Exit" + "RRetroceder", + "AAvanzar", "Texto no encontrado!", + // SH1: Settings + "aSalir", // original interpreter: "Exit" + "MMusica si", + "MMusica no", + "RRetratos si", + "RRetratos no", + "JJoystick no", + "NNuevo fuente", + "Sefectos Sonido si", + "Sefectos Sonido no", + "Tven Tanas desliz.", + "Tven Tanas aparecen", + "CCalibrar Joystick", + "yAyuda lzq", // TODO: check this + "yAyuda Dcha", + "VVoces si", + "VVoces no", + "FFundido a pixel", + "FFundido directo", + "eTeclado lento", + "eTeclado rapido", + // Load/Save + "aSalir", // original interpreter: "Exit" + "CCargar", + "GGrabar", + "SSubir", + "BBajar", + "AAcabar", + // Quit Game + "\250Seguro que quieres Acabar?", + "SSi", + "NNo", + // SH1: Press key text + "TTecla para ver mas", + "TTecla para continuar", // SH1: Initial Inventory "Un mensaje solicitando ayuda", "Unas cuantas tarjetas de visita", @@ -171,6 +411,75 @@ static const char *const fixedTextES[] = { "Unas cartas de Tarot", "Una llave muy vistosa", "Una papeleta de empe\244o", + // SH1: User Interface + "No, gracias.", + "No puedes hacerlo.", // original: "No puedes hacerlo" + "Hecho...", + "Usar ", + " sobre %s", + "Dar ", + " a %s", + // SH1: People names + "Sherlock Holmes", + "Dr. Watson", + "El inspector Lestrade", + "El agente O'Brien", + "El agente Lewis", + "Sheila Parker", + "Henry Carruthers", + "Lesley", + "Un ujier", + "Fredrick Epstein", + "Mrs. Worthington", + "El entrenador", + "El jugador", + "Tim", + "James Sanders", + "Belle", + "La chica de la limpieza", + "Wiggins", + "Paul", + "El barman", + "Un sucio borracho", + "Un borracho griton", + "Un tambaleante borracho", + "El gorila", + "El forense", + "Reginald Snipes", + "George Blackwood", + "Lars", + "El quimico", + "El inspector Gregson", + "Jacob Farthington", + "Mycroft", + "Old Sherman", + "Richard", + "El barman", + "Un jugador dandy", + "Un duro jugador", + "Un espectador", + "Robert Hunt", + "Violeta", + "Pettigrew", + "Augie", + "Anna Carroway", + "Un guarda", + "Antonio Caruso", + "El perro Toby", + "Simon Kingsley", + "Alfred", + "Lady Brumwell", + "Madame Rosa", + "Joseph Moorehead", + "Mrs. Beale", + "Felix", + "Hollingston", + "El agente Callaghan", + "El sargento Duncan", + "Lord Brumwell", + "Nigel Jaimeson", + "Jonas", + "El agente Dugan" }; // ========================================= @@ -233,7 +542,7 @@ static const char *const fixedTextDE_ActionMove[] = { "L\204\341t sich nicht bewegen", "Festged\201belt in der Erde...", "Oha, VIEL zu schwer", - "Der andere Kiste ist im Weg" // [sic] + "Die andere Kiste ist im Weg" // original: "Der andere Kiste ist im Weg" }; static const char *const fixedTextES_ActionMove[] = { @@ -332,8 +641,6 @@ static const FixedTextActionEntry fixedTextES_Actions[] = { // ========================================= -// TODO: -// It seems there was a French version of Sherlock Holmes 2 static const FixedTextLanguageEntry fixedTextLanguages[] = { { Common::DE_DEU, fixedTextDE, fixedTextDE_Actions }, { Common::ES_ESP, fixedTextES, fixedTextES_Actions }, diff --git a/engines/sherlock/scalpel/scalpel_fixed_text.h b/engines/sherlock/scalpel/scalpel_fixed_text.h index eae86b8f27..d9b3bbed79 100644 --- a/engines/sherlock/scalpel/scalpel_fixed_text.h +++ b/engines/sherlock/scalpel/scalpel_fixed_text.h @@ -30,8 +30,10 @@ namespace Sherlock { namespace Scalpel { enum FixedTextId { + // Game hotkeys + kFixedText_Game_Hotkeys = 0, // Window buttons - kFixedText_Window_Exit = 0, + kFixedText_Window_Exit, kFixedText_Window_Up, kFixedText_Window_Down, // Inventory buttons @@ -57,6 +59,41 @@ enum FixedTextId { kFixedText_JournalSearch_Backward, kFixedText_JournalSearch_Forward, kFixedText_JournalSearch_NotFound, + // Settings + kFixedText_Settings_Exit, + kFixedText_Settings_MusicOn, + kFixedText_Settings_MusicOff, + kFixedText_Settings_PortraitsOn, + kFixedText_Settings_PortraitsOff, + kFixedText_Settings_JoystickOff, + kFixedText_Settings_NewFontStyle, + kFixedText_Settings_SoundEffectsOn, + kFixedText_Settings_SoundEffectsOff, + kFixedText_Settings_WindowsSlide, + kFixedText_Settings_WindowsAppear, + kFixedText_Settings_CalibrateJoystick, + kFixedText_Settings_AutoHelpLeft, + kFixedText_Settings_AutoHelpRight, + kFixedText_Settings_VoicesOn, + kFixedText_Settings_VoicesOff, + kFixedText_Settings_FadeByPixel, + kFixedText_Settings_FadeDirectly, + kFixedText_Settings_KeyPadSlow, + kFixedText_Settings_KeyPadFast, + // Load/Save + kFixedText_LoadSave_Exit, + kFixedText_LoadSave_Load, + kFixedText_LoadSave_Save, + kFixedText_LoadSave_Up, + kFixedText_LoadSave_Down, + kFixedText_LoadSave_Quit, + // Quit Game + kFixedText_QuitGame_Question, + kFixedText_QuitGame_Yes, + kFixedText_QuitGame_No, + // Press key text + kFixedText_PressKey_ForMore, + kFixedText_PressKey_ToContinue, // Initial inventory kFixedText_InitInventory_Message, kFixedText_InitInventory_HolmesCard, @@ -69,7 +106,76 @@ enum FixedTextId { kFixedText_InitInventory_Letter, kFixedText_InitInventory_Tarot, kFixedText_InitInventory_OrnateKey, - kFixedText_InitInventory_PawnTicket + kFixedText_InitInventory_PawnTicket, + // SH1: User Interface + kFixedText_UserInterface_NoThankYou, + kFixedText_UserInterface_YouCantDoThat, + kFixedText_UserInterface_Done, + kFixedText_UserInterface_Use, + kFixedText_UserInterface_UseOn, + kFixedText_UserInterface_Give, + kFixedText_UserInterface_GiveTo, + // People names + kFixedText_People_SherlockHolmes, + kFixedText_People_DrWatson, + kFixedText_People_InspectorLestrade, + kFixedText_People_ConstableOBrien, + kFixedText_People_ConstableLewis, + kFixedText_People_SheilaParker, + kFixedText_People_HenryCarruthers, + kFixedText_People_Lesley, + kFixedText_People_AnUsher, + kFixedText_People_FredrickEpstein, + kFixedText_People_MrsWorthington, + kFixedText_People_TheCoach, + kFixedText_People_APlayer, + kFixedText_People_Tim, + kFixedText_People_JamesSanders, + kFixedText_People_Belle, + kFixedText_People_CleaningGirl, + kFixedText_People_Wiggins, + kFixedText_People_Paul, + kFixedText_People_TheBartender, + kFixedText_People_ADirtyDrunk, + kFixedText_People_AShoutingDrunk, + kFixedText_People_AStaggeringDrunk, + kFixedText_People_TheBouncer, + kFixedText_People_TheCoroner, + kFixedText_People_ReginaldSnipes, + kFixedText_People_GeorgeBlackwood, + kFixedText_People_Lars, + kFixedText_People_TheChemist, + kFixedText_People_InspectorGregson, + kFixedText_People_JacobFarthington, + kFixedText_People_Mycroft, + kFixedText_People_OldSherman, + kFixedText_People_Richard, + kFixedText_People_TheBarman, + kFixedText_People_ADandyPlayer, + kFixedText_People_ARoughlookingPlayer, + kFixedText_People_ASpectator, + kFixedText_People_RobertHunt, + kFixedText_People_Violet, + kFixedText_People_Pettigrew, + kFixedText_People_Augie, + kFixedText_People_AnnaCarroway, + kFixedText_People_AGuard, + kFixedText_People_AntonioCaruso, + kFixedText_People_TobyTheDog, + kFixedText_People_SimonKingsley, + kFixedText_People_Alfred, + kFixedText_People_LadyBrumwell, + kFixedText_People_MadameRosa, + kFixedText_People_JosephMoorehead, + kFixedText_People_MrsBeale, + kFixedText_People_Felix, + kFixedText_People_Hollingston, + kFixedText_People_ConstableCallaghan, + kFixedText_People_SergeantDuncan, + kFixedText_People_LordBrumwell, + kFixedText_People_NigelJaimeson, + kFixedText_People_Jonas, + kFixedText_People_ConstableDugan }; struct FixedTextActionEntry { diff --git a/engines/sherlock/scalpel/scalpel_inventory.cpp b/engines/sherlock/scalpel/scalpel_inventory.cpp index e19a43238c..07659b41f2 100644 --- a/engines/sherlock/scalpel/scalpel_inventory.cpp +++ b/engines/sherlock/scalpel/scalpel_inventory.cpp @@ -32,13 +32,39 @@ namespace Scalpel { ScalpelInventory::ScalpelInventory(SherlockEngine *vm) : Inventory(vm) { _invShapes.resize(6); + + _fixedTextExit = FIXED(Inventory_Exit); + _fixedTextLook = FIXED(Inventory_Look); + _fixedTextUse = FIXED(Inventory_Use); + _fixedTextGive = FIXED(Inventory_Give); + + _hotkeyExit = toupper(_fixedTextExit[0]); + _hotkeyLook = toupper(_fixedTextLook[0]); + _hotkeyUse = toupper(_fixedTextUse[0]); + _hotkeyGive = toupper(_fixedTextGive[0]); + + _hotkeysIndexed[0] = _hotkeyExit; + _hotkeysIndexed[1] = _hotkeyLook; + _hotkeysIndexed[2] = _hotkeyUse; + _hotkeysIndexed[3] = _hotkeyGive; + _hotkeysIndexed[4] = '-'; + _hotkeysIndexed[5] = '+'; + _hotkeysIndexed[6] = ','; + _hotkeysIndexed[7] = '.'; } ScalpelInventory::~ScalpelInventory() { } +int ScalpelInventory::identifyUserButton(int key) { + for (uint16 hotkeyNr = 0; hotkeyNr < sizeof(_hotkeysIndexed); hotkeyNr++) { + if (key == _hotkeysIndexed[hotkeyNr]) + return hotkeyNr; + } + return -1; +} + void ScalpelInventory::drawInventory(InvNewMode mode) { - FixedText &fixedText = *_vm->_fixedText; ScalpelScreen &screen = *(ScalpelScreen *)_vm->_screen; UserInterface &ui = *_vm->_ui; InvNewMode tempMode = mode; @@ -46,11 +72,11 @@ void ScalpelInventory::drawInventory(InvNewMode mode) { loadInv(); if (mode == INVENTORY_DONT_DISPLAY) { - screen._backBuffer = &screen._backBuffer2; + screen.activateBackBuffer2(); } // Draw the window background - Surface &bb = *screen._backBuffer; + Surface &bb = *screen.getBackBuffer(); bb.fillRect(Common::Rect(0, CONTROLS_Y1, SHERLOCK_SCREEN_WIDTH, CONTROLS_Y1 + 10), BORDER_COLOR); bb.fillRect(Common::Rect(0, CONTROLS_Y1 + 10, 2, SHERLOCK_SCREEN_HEIGHT), BORDER_COLOR); bb.fillRect(Common::Rect(SHERLOCK_SCREEN_WIDTH - 2, CONTROLS_Y1 + 10, @@ -61,34 +87,30 @@ void ScalpelInventory::drawInventory(InvNewMode mode) { INV_BACKGROUND); // Draw the buttons - Common::String fixedText_Exit = fixedText.getText(kFixedText_Inventory_Exit); - Common::String fixedText_Look = fixedText.getText(kFixedText_Inventory_Look); - Common::String fixedText_Use = fixedText.getText(kFixedText_Inventory_Use); - Common::String fixedText_Give = fixedText.getText(kFixedText_Inventory_Give); - screen.makeButton(Common::Rect(INVENTORY_POINTS[0][0], CONTROLS_Y1, INVENTORY_POINTS[0][1], - CONTROLS_Y1 + 10), INVENTORY_POINTS[0][2] - screen.stringWidth(fixedText_Exit) / 2, fixedText_Exit); + CONTROLS_Y1 + 10), INVENTORY_POINTS[0][2], _fixedTextExit); screen.makeButton(Common::Rect(INVENTORY_POINTS[1][0], CONTROLS_Y1, INVENTORY_POINTS[1][1], - CONTROLS_Y1 + 10), INVENTORY_POINTS[1][2] - screen.stringWidth(fixedText_Look) / 2, fixedText_Look); + CONTROLS_Y1 + 10), INVENTORY_POINTS[1][2], _fixedTextLook); screen.makeButton(Common::Rect(INVENTORY_POINTS[2][0], CONTROLS_Y1, INVENTORY_POINTS[2][1], - CONTROLS_Y1 + 10), INVENTORY_POINTS[2][2] - screen.stringWidth(fixedText_Use) / 2, fixedText_Use); + CONTROLS_Y1 + 10), INVENTORY_POINTS[2][2], _fixedTextUse); screen.makeButton(Common::Rect(INVENTORY_POINTS[3][0], CONTROLS_Y1, INVENTORY_POINTS[3][1], - CONTROLS_Y1 + 10), INVENTORY_POINTS[3][2] - screen.stringWidth(fixedText_Give) / 2, fixedText_Give); + CONTROLS_Y1 + 10), INVENTORY_POINTS[3][2], _fixedTextGive); screen.makeButton(Common::Rect(INVENTORY_POINTS[4][0], CONTROLS_Y1, INVENTORY_POINTS[4][1], - CONTROLS_Y1 + 10), INVENTORY_POINTS[4][2], "^^"); // 2 arrows pointing to the left + CONTROLS_Y1 + 10), INVENTORY_POINTS[4][2] + 8, "^^", false); // 2 arrows pointing to the left screen.makeButton(Common::Rect(INVENTORY_POINTS[5][0], CONTROLS_Y1, INVENTORY_POINTS[5][1], - CONTROLS_Y1 + 10), INVENTORY_POINTS[5][2], "^"); // 1 arrow pointing to the left + CONTROLS_Y1 + 10), INVENTORY_POINTS[5][2] + 4, "^", false); // 1 arrow pointing to the left screen.makeButton(Common::Rect(INVENTORY_POINTS[6][0], CONTROLS_Y1, INVENTORY_POINTS[6][1], - CONTROLS_Y1 + 10), INVENTORY_POINTS[6][2], "_"); // 1 arrow pointing to the right + CONTROLS_Y1 + 10), INVENTORY_POINTS[6][2] + 4, "_", false); // 1 arrow pointing to the right screen.makeButton(Common::Rect(INVENTORY_POINTS[7][0], CONTROLS_Y1, INVENTORY_POINTS[7][1], - CONTROLS_Y1 + 10), INVENTORY_POINTS[7][2], "__"); // 2 arrows pointing to the right + CONTROLS_Y1 + 10), INVENTORY_POINTS[7][2] + 8, "__", false); // 2 arrows pointing to the right if (tempMode == INVENTORY_DONT_DISPLAY) mode = LOOK_INVENTORY_MODE; _invMode = (InvMode)((int)mode); if (mode != PLAIN_INVENTORY) { - ui._oldKey = INVENTORY_COMMANDS[(int)mode]; + assert((uint)mode < sizeof(_hotkeysIndexed)); + ui._oldKey = _hotkeysIndexed[mode]; } else { ui._oldKey = -1; } @@ -106,7 +128,7 @@ void ScalpelInventory::drawInventory(InvNewMode mode) { ui._windowOpen = true; } else { // Reset the screen back buffer to the first buffer now that drawing is done - screen._backBuffer = &screen._backBuffer1; + screen.activateBackBuffer1(); } assert(IS_SERRATED_SCALPEL); @@ -114,28 +136,22 @@ void ScalpelInventory::drawInventory(InvNewMode mode) { } void ScalpelInventory::invCommands(bool slamIt) { - FixedText &fixedText = *_vm->_fixedText; ScalpelScreen &screen = *(ScalpelScreen *)_vm->_screen; UserInterface &ui = *_vm->_ui; - Common::String fixedText_Exit = fixedText.getText(kFixedText_Inventory_Exit); - Common::String fixedText_Look = fixedText.getText(kFixedText_Inventory_Look); - Common::String fixedText_Use = fixedText.getText(kFixedText_Inventory_Use); - Common::String fixedText_Give = fixedText.getText(kFixedText_Inventory_Give); - if (slamIt) { screen.buttonPrint(Common::Point(INVENTORY_POINTS[0][2], CONTROLS_Y1), _invMode == INVMODE_EXIT ? COMMAND_HIGHLIGHTED :COMMAND_FOREGROUND, - true, fixedText_Exit); + true, _fixedTextExit); screen.buttonPrint(Common::Point(INVENTORY_POINTS[1][2], CONTROLS_Y1), _invMode == INVMODE_LOOK ? COMMAND_HIGHLIGHTED :COMMAND_FOREGROUND, - true, fixedText_Look); + true, _fixedTextLook); screen.buttonPrint(Common::Point(INVENTORY_POINTS[2][2], CONTROLS_Y1), _invMode == INVMODE_USE ? COMMAND_HIGHLIGHTED : COMMAND_FOREGROUND, - true, fixedText_Use); + true, _fixedTextUse); screen.buttonPrint(Common::Point(INVENTORY_POINTS[3][2], CONTROLS_Y1), _invMode == INVMODE_GIVE ? COMMAND_HIGHLIGHTED : COMMAND_FOREGROUND, - true, fixedText_Give); + true, _fixedTextGive); screen.print(Common::Point(INVENTORY_POINTS[4][2], CONTROLS_Y1 + 1), _invIndex == 0 ? COMMAND_NULL : COMMAND_FOREGROUND, "^^"); // 2 arrows pointing to the left @@ -153,16 +169,16 @@ void ScalpelInventory::invCommands(bool slamIt) { } else { screen.buttonPrint(Common::Point(INVENTORY_POINTS[0][2], CONTROLS_Y1), _invMode == INVMODE_EXIT ? COMMAND_HIGHLIGHTED : COMMAND_FOREGROUND, - false, fixedText_Exit); + false, _fixedTextExit); screen.buttonPrint(Common::Point(INVENTORY_POINTS[1][2], CONTROLS_Y1), _invMode == INVMODE_LOOK ? COMMAND_HIGHLIGHTED : COMMAND_FOREGROUND, - false, fixedText_Look); + false, _fixedTextLook); screen.buttonPrint(Common::Point(INVENTORY_POINTS[2][2], CONTROLS_Y1), _invMode == INVMODE_USE ? COMMAND_HIGHLIGHTED : COMMAND_FOREGROUND, - false, fixedText_Use); + false, _fixedTextUse); screen.buttonPrint(Common::Point(INVENTORY_POINTS[3][2], CONTROLS_Y1), _invMode == INVMODE_GIVE ? COMMAND_HIGHLIGHTED : COMMAND_FOREGROUND, - false, fixedText_Give); + false, _fixedTextGive); screen.gPrint(Common::Point(INVENTORY_POINTS[4][2], CONTROLS_Y1), _invIndex == 0 ? COMMAND_NULL : COMMAND_FOREGROUND, "^^"); // 2 arrows pointing to the left @@ -180,12 +196,12 @@ void ScalpelInventory::invCommands(bool slamIt) { void ScalpelInventory::highlight(int index, byte color) { Screen &screen = *_vm->_screen; - Surface &bb = *screen._backBuffer; + Surface &bb = *screen.getBackBuffer(); int slot = index - _invIndex; ImageFrame &frame = (*_invShapes[slot])[0]; bb.fillRect(Common::Rect(8 + slot * 52, 165, (slot + 1) * 52, 194), color); - bb.transBlitFrom(frame, Common::Point(6 + slot * 52 + ((47 - frame._width) / 2), + bb.SHtransBlitFrom(frame, Common::Point(6 + slot * 52 + ((47 - frame._width) / 2), 163 + ((33 - frame._height) / 2))); screen.slamArea(8 + slot * 52, 165, 44, 30); } @@ -201,12 +217,12 @@ void ScalpelInventory::refreshInv() { ui._infoFlag = true; ui.clearInfo(); - screen._backBuffer2.blitFrom(screen._backBuffer1, Common::Point(0, CONTROLS_Y), + screen._backBuffer2.SHblitFrom(screen._backBuffer1, Common::Point(0, CONTROLS_Y), Common::Rect(0, CONTROLS_Y, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT)); ui.examine(); if (!talk._talkToAbort) { - screen._backBuffer2.blitFrom((*ui._controlPanel)[0], Common::Point(0, CONTROLS_Y)); + screen._backBuffer2.SHblitFrom((*ui._controlPanel)[0], Common::Point(0, CONTROLS_Y)); loadInv(); } } @@ -248,7 +264,7 @@ void ScalpelInventory::putInv(InvSlamMode slamIt) { // Draw the item image ImageFrame &frame = (*_invShapes[itemNum])[0]; - bb.transBlitFrom(frame, Common::Point(6 + itemNum * 52 + ((47 - frame._width) / 2), + bb.SHtransBlitFrom(frame, Common::Point(6 + itemNum * 52 + ((47 - frame._width) / 2), 163 + ((33 - frame._height) / 2))); } @@ -262,9 +278,9 @@ void ScalpelInventory::putInv(InvSlamMode slamIt) { invCommands(0); } else if (slamIt == SLAM_SECONDARY_BUFFER) { - screen._backBuffer = &screen._backBuffer2; + screen.activateBackBuffer2(); invCommands(0); - screen._backBuffer = &screen._backBuffer1; + screen.activateBackBuffer1(); } } diff --git a/engines/sherlock/scalpel/scalpel_inventory.h b/engines/sherlock/scalpel/scalpel_inventory.h index afafb0b94a..49d055593a 100644 --- a/engines/sherlock/scalpel/scalpel_inventory.h +++ b/engines/sherlock/scalpel/scalpel_inventory.h @@ -34,6 +34,18 @@ public: ScalpelInventory(SherlockEngine *vm); ~ScalpelInventory(); + Common::String _fixedTextExit; + Common::String _fixedTextLook; + Common::String _fixedTextUse; + Common::String _fixedTextGive; + + byte _hotkeyExit; + byte _hotkeyLook; + byte _hotkeyUse; + byte _hotkeyGive; + + byte _hotkeysIndexed[8]; + /** * Put the game into inventory mode and open the interface window. */ @@ -65,6 +77,11 @@ public: * and then calls loadGraphics to load the associated graphics */ virtual void loadInv(); + + /** + * Identifies a button number according to the key, that the user pressed + */ + int identifyUserButton(int key); }; } // End of namespace Scalpel diff --git a/engines/sherlock/scalpel/scalpel_journal.cpp b/engines/sherlock/scalpel/scalpel_journal.cpp index 787d899aee..151d986d81 100644 --- a/engines/sherlock/scalpel/scalpel_journal.cpp +++ b/engines/sherlock/scalpel/scalpel_journal.cpp @@ -64,6 +64,36 @@ ScalpelJournal::ScalpelJournal(SherlockEngine *vm) : Journal(vm) { // Load the journal directory and location names loadLocations(); } + + _fixedTextWatsonsJournal = FIXED(Journal_WatsonsJournal); + _fixedTextExit = FIXED(Journal_Exit); + _fixedTextBack10 = FIXED(Journal_Back10); + _fixedTextUp = FIXED(Journal_Up); + _fixedTextDown = FIXED(Journal_Down); + _fixedTextAhead10 = FIXED(Journal_Ahead10); + _fixedTextSearch = FIXED(Journal_Search); + _fixedTextFirstPage = FIXED(Journal_FirstPage); + _fixedTextLastPage = FIXED(Journal_LastPage); + _fixedTextPrintText = FIXED(Journal_PrintText); + + _hotkeyExit = toupper(_fixedTextExit[0]); + _hotkeyBack10 = toupper(_fixedTextBack10[0]); + _hotkeyUp = toupper(_fixedTextUp[0]); + _hotkeyDown = toupper(_fixedTextDown[0]); + _hotkeyAhead10 = toupper(_fixedTextAhead10[0]); + _hotkeySearch = toupper(_fixedTextSearch[0]); + _hotkeyFirstPage = toupper(_fixedTextFirstPage[0]); + _hotkeyLastPage = toupper(_fixedTextLastPage[0]); + _hotkeyPrintText = toupper(_fixedTextPrintText[0]); + + _fixedTextSearchExit = FIXED(JournalSearch_Exit); + _fixedTextSearchBackward = FIXED(JournalSearch_Backward); + _fixedTextSearchForward = FIXED(JournalSearch_Forward); + _fixedTextSearchNotFound = FIXED(JournalSearch_NotFound); + + _hotkeySearchExit = toupper(_fixedTextSearchExit[0]); + _hotkeySearchBackward = toupper(_fixedTextSearchBackward[0]); + _hotkeySearchForward = toupper(_fixedTextSearchForward[0]); } void ScalpelJournal::loadLocations() { @@ -104,6 +134,25 @@ void ScalpelJournal::loadLocations() { while ((c = loc->readByte()) != 0) line += c; + // WORKAROUND: Special fixes for faulty translations + // Was obviously not done in the original interpreter + if (_vm->getLanguage() == Common::ES_ESP) { + // Spanish version + // We fix all sorts of typos + // see bug #6931 + if (line == "En el cajellon destras del teatro Regency") { + line = "En el callejon detras del teatro Regency"; + } else if (line == "En el apartamente de Simon Kingsley") { + line = "En el apartamento de Simon Kingsley"; + } else if (line == "Bajo la muelle de Savoy Pier") { + line = "Bajo el muelle de Savoy Pier"; + } else if (line == "En le viejo Sherman") { + line = "En el viejo Sherman"; + } else if (line == "En la entrada de la cada de Anna Carroway") { + line = "En la entrada de la casa de Anna Carroway"; + } + } + _locations.push_back(line); } @@ -111,7 +160,6 @@ void ScalpelJournal::loadLocations() { } void ScalpelJournal::drawFrame() { - FixedText &fixedText = *_vm->_fixedText; Resources &res = *_vm->_res; ScalpelScreen &screen = *(ScalpelScreen *)_vm->_screen; byte palette[PALETTE_SIZE]; @@ -126,54 +174,43 @@ void ScalpelJournal::drawFrame() { for (int idx = 0; idx < PALETTE_SIZE; ++idx) palette[idx] = VGA_COLOR_TRANS(palette[idx]); - Common::String fixedText_WatsonsJournal = fixedText.getText(kFixedText_Journal_WatsonsJournal); - Common::String fixedText_Exit = fixedText.getText(kFixedText_Journal_Exit); - Common::String fixedText_Back10 = fixedText.getText(kFixedText_Journal_Back10); - Common::String fixedText_Up = fixedText.getText(kFixedText_Journal_Up); - Common::String fixedText_Down = fixedText.getText(kFixedText_Journal_Down); - Common::String fixedText_Ahead10 = fixedText.getText(kFixedText_Journal_Ahead10); - Common::String fixedText_Search = fixedText.getText(kFixedText_Journal_Search); - Common::String fixedText_FirstPage = fixedText.getText(kFixedText_Journal_FirstPage); - Common::String fixedText_LastPage = fixedText.getText(kFixedText_Journal_LastPage); - Common::String fixedText_PrintText = fixedText.getText(kFixedText_Journal_PrintText); - // Set the palette and print the title screen.setPalette(palette); - screen.gPrint(Common::Point(111, 18), BUTTON_BOTTOM, "%s", fixedText_WatsonsJournal.c_str()); - screen.gPrint(Common::Point(110, 17), INV_FOREGROUND, "%s", fixedText_WatsonsJournal.c_str()); + screen.gPrint(Common::Point(111, 18), BUTTON_BOTTOM, "%s", _fixedTextWatsonsJournal.c_str()); + screen.gPrint(Common::Point(110, 17), INV_FOREGROUND, "%s", _fixedTextWatsonsJournal.c_str()); // Draw the buttons screen.makeButton(Common::Rect(JOURNAL_POINTS[0][0], JOURNAL_BUTTONS_Y, JOURNAL_POINTS[0][1], JOURNAL_BUTTONS_Y + 10), - JOURNAL_POINTS[0][2] - screen.stringWidth(fixedText_Exit) / 2, fixedText_Exit); + JOURNAL_POINTS[0][2], _fixedTextExit); screen.makeButton(Common::Rect(JOURNAL_POINTS[1][0], JOURNAL_BUTTONS_Y, JOURNAL_POINTS[1][1], JOURNAL_BUTTONS_Y + 10), - JOURNAL_POINTS[1][2] - screen.stringWidth(fixedText_Back10) / 2, fixedText_Back10); + JOURNAL_POINTS[1][2], _fixedTextBack10); screen.makeButton(Common::Rect(JOURNAL_POINTS[2][0], JOURNAL_BUTTONS_Y, JOURNAL_POINTS[2][1], JOURNAL_BUTTONS_Y + 10), - JOURNAL_POINTS[2][2] - screen.stringWidth(fixedText_Up) / 2, fixedText_Up); + JOURNAL_POINTS[2][2], _fixedTextUp); screen.makeButton(Common::Rect(JOURNAL_POINTS[3][0], JOURNAL_BUTTONS_Y, JOURNAL_POINTS[3][1], JOURNAL_BUTTONS_Y + 10), - JOURNAL_POINTS[3][2] - screen.stringWidth(fixedText_Down) / 2, fixedText_Down); + JOURNAL_POINTS[3][2], _fixedTextDown); screen.makeButton(Common::Rect(JOURNAL_POINTS[4][0], JOURNAL_BUTTONS_Y, JOURNAL_POINTS[4][1], JOURNAL_BUTTONS_Y + 10), - JOURNAL_POINTS[4][2] - screen.stringWidth(fixedText_Ahead10) / 2, fixedText_Ahead10); + JOURNAL_POINTS[4][2], _fixedTextAhead10); screen.makeButton(Common::Rect(JOURNAL_POINTS[5][0], JOURNAL_BUTTONS_Y + 11, JOURNAL_POINTS[5][1], JOURNAL_BUTTONS_Y + 21), - JOURNAL_POINTS[5][2] - screen.stringWidth(fixedText_Search) / 2, fixedText_Search); + JOURNAL_POINTS[5][2], _fixedTextSearch); screen.makeButton(Common::Rect(JOURNAL_POINTS[6][0], JOURNAL_BUTTONS_Y + 11, JOURNAL_POINTS[6][1], JOURNAL_BUTTONS_Y + 21), - JOURNAL_POINTS[6][2] - screen.stringWidth(fixedText_FirstPage) / 2, fixedText_FirstPage); + JOURNAL_POINTS[6][2], _fixedTextFirstPage); screen.makeButton(Common::Rect(JOURNAL_POINTS[7][0], JOURNAL_BUTTONS_Y + 11, JOURNAL_POINTS[7][1], JOURNAL_BUTTONS_Y + 21), - JOURNAL_POINTS[7][2] - screen.stringWidth(fixedText_LastPage) / 2, fixedText_LastPage); + JOURNAL_POINTS[7][2], _fixedTextLastPage); // WORKAROUND: Draw Print Text button as disabled, since we don't support it in ScummVM screen.makeButton(Common::Rect(JOURNAL_POINTS[8][0], JOURNAL_BUTTONS_Y + 11, JOURNAL_POINTS[8][1], JOURNAL_BUTTONS_Y + 21), - JOURNAL_POINTS[8][2] - screen.stringWidth(fixedText_PrintText) / 2, fixedText_PrintText); + JOURNAL_POINTS[8][2], _fixedTextPrintText); screen.buttonPrint(Common::Point(JOURNAL_POINTS[8][2], JOURNAL_BUTTONS_Y + 11), - COMMAND_NULL, false, fixedText_PrintText); + COMMAND_NULL, false, _fixedTextPrintText); } void ScalpelJournal::drawInterface() { @@ -194,34 +231,24 @@ void ScalpelJournal::drawInterface() { } void ScalpelJournal::doArrows() { - FixedText &fixedText = *_vm->_fixedText; ScalpelScreen &screen = *(ScalpelScreen *)_vm->_screen; byte color; - Common::String fixedText_Back10 = fixedText.getText(kFixedText_Journal_Back10); - Common::String fixedText_Up = fixedText.getText(kFixedText_Journal_Up); - Common::String fixedText_Down = fixedText.getText(kFixedText_Journal_Down); - Common::String fixedText_Ahead10 = fixedText.getText(kFixedText_Journal_Ahead10); - Common::String fixedText_Search = fixedText.getText(kFixedText_Journal_Search); - Common::String fixedText_FirstPage = fixedText.getText(kFixedText_Journal_FirstPage); - Common::String fixedText_LastPage = fixedText.getText(kFixedText_Journal_LastPage); - Common::String fixedText_PrintText = fixedText.getText(kFixedText_Journal_PrintText); - color = (_page > 1) ? COMMAND_FOREGROUND : COMMAND_NULL; - screen.buttonPrint(Common::Point(JOURNAL_POINTS[1][2], JOURNAL_BUTTONS_Y), color, false, fixedText_Back10); - screen.buttonPrint(Common::Point(JOURNAL_POINTS[2][2], JOURNAL_BUTTONS_Y), color, false, fixedText_Up); + screen.buttonPrint(Common::Point(JOURNAL_POINTS[1][2], JOURNAL_BUTTONS_Y), color, false, _fixedTextBack10); + screen.buttonPrint(Common::Point(JOURNAL_POINTS[2][2], JOURNAL_BUTTONS_Y), color, false, _fixedTextUp); color = _down ? COMMAND_FOREGROUND : COMMAND_NULL; - screen.buttonPrint(Common::Point(JOURNAL_POINTS[3][2], JOURNAL_BUTTONS_Y), color, false, fixedText_Down); - screen.buttonPrint(Common::Point(JOURNAL_POINTS[4][2], JOURNAL_BUTTONS_Y), color, false, fixedText_Ahead10); - screen.buttonPrint(Common::Point(JOURNAL_POINTS[7][2], JOURNAL_BUTTONS_Y + 11), color, false, fixedText_LastPage); + screen.buttonPrint(Common::Point(JOURNAL_POINTS[3][2], JOURNAL_BUTTONS_Y), color, false, _fixedTextDown); + screen.buttonPrint(Common::Point(JOURNAL_POINTS[4][2], JOURNAL_BUTTONS_Y), color, false, _fixedTextAhead10); + screen.buttonPrint(Common::Point(JOURNAL_POINTS[7][2], JOURNAL_BUTTONS_Y + 11), color, false, _fixedTextLastPage); color = _journal.size() > 0 ? COMMAND_FOREGROUND : COMMAND_NULL; - screen.buttonPrint(Common::Point(JOURNAL_POINTS[5][2], JOURNAL_BUTTONS_Y + 11), color, false, fixedText_Search); - screen.buttonPrint(Common::Point(JOURNAL_POINTS[8][2], JOURNAL_BUTTONS_Y + 11), COMMAND_NULL, false, fixedText_PrintText); + screen.buttonPrint(Common::Point(JOURNAL_POINTS[5][2], JOURNAL_BUTTONS_Y + 11), color, false, _fixedTextSearch); + screen.buttonPrint(Common::Point(JOURNAL_POINTS[8][2], JOURNAL_BUTTONS_Y + 11), COMMAND_NULL, false, _fixedTextPrintText); color = _page > 1 ? COMMAND_FOREGROUND : COMMAND_NULL; - screen.buttonPrint(Common::Point(JOURNAL_POINTS[6][2], JOURNAL_BUTTONS_Y + 11), color, false, fixedText_FirstPage); + screen.buttonPrint(Common::Point(JOURNAL_POINTS[6][2], JOURNAL_BUTTONS_Y + 11), color, false, _fixedTextFirstPage); } JournalButton ScalpelJournal::getHighlightedButton(const Common::Point &pt) { @@ -266,7 +293,6 @@ JournalButton ScalpelJournal::getHighlightedButton(const Common::Point &pt) { bool ScalpelJournal::handleEvents(int key) { Events &events = *_vm->_events; - FixedText &fixedText = *_vm->_fixedText; ScalpelScreen &screen = *(ScalpelScreen *)_vm->_screen; bool doneFlag = false; @@ -275,46 +301,36 @@ bool ScalpelJournal::handleEvents(int key) { byte color; if (events._pressed || events._released) { - Common::String fixedText_Exit = fixedText.getText(kFixedText_Journal_Exit); - Common::String fixedText_Back10 = fixedText.getText(kFixedText_Journal_Back10); - Common::String fixedText_Up = fixedText.getText(kFixedText_Journal_Up); - Common::String fixedText_Down = fixedText.getText(kFixedText_Journal_Down); - Common::String fixedText_Ahead10 = fixedText.getText(kFixedText_Journal_Ahead10); - Common::String fixedText_Search = fixedText.getText(kFixedText_Journal_Search); - Common::String fixedText_FirstPage = fixedText.getText(kFixedText_Journal_FirstPage); - Common::String fixedText_LastPage = fixedText.getText(kFixedText_Journal_LastPage); - Common::String fixedText_PrintText = fixedText.getText(kFixedText_Journal_PrintText); - // Exit button color = (btn == BTN_EXIT) ? COMMAND_HIGHLIGHTED : COMMAND_FOREGROUND; - screen.buttonPrint(Common::Point(JOURNAL_POINTS[0][2], JOURNAL_BUTTONS_Y), color, true, fixedText_Exit); + screen.buttonPrint(Common::Point(JOURNAL_POINTS[0][2], JOURNAL_BUTTONS_Y), color, true, _fixedTextExit); // Back 10 button if (btn == BTN_BACK10) { - screen.buttonPrint(Common::Point(JOURNAL_POINTS[1][2], JOURNAL_BUTTONS_Y), COMMAND_HIGHLIGHTED, true, fixedText_Back10); + screen.buttonPrint(Common::Point(JOURNAL_POINTS[1][2], JOURNAL_BUTTONS_Y), COMMAND_HIGHLIGHTED, true, _fixedTextBack10); } else if (_page > 1) { - screen.buttonPrint(Common::Point(JOURNAL_POINTS[1][2], JOURNAL_BUTTONS_Y), COMMAND_FOREGROUND, true, fixedText_Back10); + screen.buttonPrint(Common::Point(JOURNAL_POINTS[1][2], JOURNAL_BUTTONS_Y), COMMAND_FOREGROUND, true, _fixedTextBack10); } // Up button if (btn == BTN_UP) { - screen.buttonPrint(Common::Point(JOURNAL_POINTS[2][2], JOURNAL_BUTTONS_Y), COMMAND_HIGHLIGHTED, true, fixedText_Up); + screen.buttonPrint(Common::Point(JOURNAL_POINTS[2][2], JOURNAL_BUTTONS_Y), COMMAND_HIGHLIGHTED, true, _fixedTextUp); } else if (_up) { - screen.buttonPrint(Common::Point(JOURNAL_POINTS[2][2], JOURNAL_BUTTONS_Y), COMMAND_FOREGROUND, true, fixedText_Up); + screen.buttonPrint(Common::Point(JOURNAL_POINTS[2][2], JOURNAL_BUTTONS_Y), COMMAND_FOREGROUND, true, _fixedTextUp); } // Down button if (btn == BTN_DOWN) { - screen.buttonPrint(Common::Point(JOURNAL_POINTS[3][2], JOURNAL_BUTTONS_Y), COMMAND_HIGHLIGHTED, true, fixedText_Down); + screen.buttonPrint(Common::Point(JOURNAL_POINTS[3][2], JOURNAL_BUTTONS_Y), COMMAND_HIGHLIGHTED, true, _fixedTextDown); } else if (_down) { - screen.buttonPrint(Common::Point(JOURNAL_POINTS[3][2], JOURNAL_BUTTONS_Y), COMMAND_FOREGROUND, true, fixedText_Down); + screen.buttonPrint(Common::Point(JOURNAL_POINTS[3][2], JOURNAL_BUTTONS_Y), COMMAND_FOREGROUND, true, _fixedTextDown); } // Ahead 10 button if (btn == BTN_AHEAD110) { - screen.buttonPrint(Common::Point(JOURNAL_POINTS[4][2], JOURNAL_BUTTONS_Y), COMMAND_HIGHLIGHTED, true, fixedText_Ahead10); + screen.buttonPrint(Common::Point(JOURNAL_POINTS[4][2], JOURNAL_BUTTONS_Y), COMMAND_HIGHLIGHTED, true, _fixedTextAhead10); } else if (_down) { - screen.buttonPrint(Common::Point(JOURNAL_POINTS[4][2], JOURNAL_BUTTONS_Y), COMMAND_FOREGROUND, true, fixedText_Ahead10); + screen.buttonPrint(Common::Point(JOURNAL_POINTS[4][2], JOURNAL_BUTTONS_Y), COMMAND_FOREGROUND, true, _fixedTextAhead10); } // Search button @@ -325,7 +341,7 @@ bool ScalpelJournal::handleEvents(int key) { } else { color = COMMAND_FOREGROUND; } - screen.buttonPrint(Common::Point(JOURNAL_POINTS[5][2], JOURNAL_BUTTONS_Y + 11), color, true, fixedText_Search); + screen.buttonPrint(Common::Point(JOURNAL_POINTS[5][2], JOURNAL_BUTTONS_Y + 11), color, true, _fixedTextSearch); // First Page button if (btn == BTN_FIRST_PAGE) { @@ -335,7 +351,7 @@ bool ScalpelJournal::handleEvents(int key) { } else { color = COMMAND_NULL; } - screen.buttonPrint(Common::Point(JOURNAL_POINTS[6][2], JOURNAL_BUTTONS_Y + 11), color, true, fixedText_FirstPage); + screen.buttonPrint(Common::Point(JOURNAL_POINTS[6][2], JOURNAL_BUTTONS_Y + 11), color, true, _fixedTextFirstPage); // Last Page button if (btn == BTN_LAST_PAGE) { @@ -345,17 +361,17 @@ bool ScalpelJournal::handleEvents(int key) { } else { color = COMMAND_NULL; } - screen.buttonPrint(Common::Point(JOURNAL_POINTS[7][2], JOURNAL_BUTTONS_Y + 11), color, true, fixedText_LastPage); + screen.buttonPrint(Common::Point(JOURNAL_POINTS[7][2], JOURNAL_BUTTONS_Y + 11), color, true, _fixedTextLastPage); // Print Text button - screen.buttonPrint(Common::Point(JOURNAL_POINTS[8][2], JOURNAL_BUTTONS_Y + 11), COMMAND_NULL, true, fixedText_PrintText); + screen.buttonPrint(Common::Point(JOURNAL_POINTS[8][2], JOURNAL_BUTTONS_Y + 11), COMMAND_NULL, true, _fixedTextPrintText); } if (btn == BTN_EXIT && events._released) { // Exit button pressed doneFlag = true; - } else if (((btn == BTN_BACK10 && events._released) || key == 'B') && (_page > 1)) { + } else if (((btn == BTN_BACK10 && events._released) || key == _hotkeyBack10) && (_page > 1)) { // Scrolll up 10 pages if (_page < 11) drawJournal(1, (_page - 1) * LINES_PER_PAGE); @@ -365,19 +381,19 @@ bool ScalpelJournal::handleEvents(int key) { doArrows(); screen.slamArea(0, 0, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT); - } else if (((btn == BTN_UP && events._released) || key == 'U') && _up) { + } else if (((btn == BTN_UP && events._released) || key == _hotkeyUp) && _up) { // Scroll up drawJournal(1, LINES_PER_PAGE); doArrows(); screen.slamArea(0, 0, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT); - } else if (((btn == BTN_DOWN && events._released) || key == 'D') && _down) { + } else if (((btn == BTN_DOWN && events._released) || key == _hotkeyDown) && _down) { // Scroll down drawJournal(2, LINES_PER_PAGE); doArrows(); screen.slamArea(0, 0, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT); - } else if (((btn == BTN_AHEAD110 && events._released) || key == 'A') && _down) { + } else if (((btn == BTN_AHEAD110 && events._released) || key == _hotkeyAhead10) && _down) { // Scroll down 10 pages if ((_page + 10) > _maxPage) drawJournal(2, (_maxPage - _page) * LINES_PER_PAGE); @@ -387,8 +403,8 @@ bool ScalpelJournal::handleEvents(int key) { doArrows(); screen.slamArea(0, 0, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT); - } else if (((btn == BTN_SEARCH && events._released) || key == 'S') && !_journal.empty()) { - screen.buttonPrint(Common::Point(JOURNAL_POINTS[5][2], JOURNAL_BUTTONS_Y + 11), COMMAND_FOREGROUND, true, "Search"); + } else if (((btn == BTN_SEARCH && events._released) || key == _hotkeySearch) && !_journal.empty()) { + screen.buttonPrint(Common::Point(JOURNAL_POINTS[5][2], JOURNAL_BUTTONS_Y + 11), COMMAND_FOREGROUND, true, _fixedTextSearch); bool notFound = false; do { @@ -418,7 +434,7 @@ bool ScalpelJournal::handleEvents(int key) { } while (!doneFlag); doneFlag = false; - } else if (((btn == BTN_FIRST_PAGE && events._released) || key == 'F') && _up) { + } else if (((btn == BTN_FIRST_PAGE && events._released) || key == _hotkeyFirstPage) && _up) { // First page _index = _sub = 0; _up = _down = false; @@ -429,7 +445,7 @@ bool ScalpelJournal::handleEvents(int key) { doArrows(); screen.slamArea(0, 0, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT); - } else if (((btn == BTN_LAST_PAGE && events._released) || key == 'L') && _down) { + } else if (((btn == BTN_LAST_PAGE && events._released) || key == _hotkeyLastPage) && _down) { // Last page if ((_page + 10) > _maxPage) drawJournal(2, (_maxPage - _page) * LINES_PER_PAGE); @@ -449,7 +465,6 @@ int ScalpelJournal::getSearchString(bool printError) { enum Button { BTN_NONE, BTN_EXIT, BTN_BACKWARD, BTN_FORWARD }; Events &events = *_vm->_events; - FixedText &fixedText = *_vm->_fixedText; ScalpelScreen &screen = *(ScalpelScreen *)_vm->_screen; Talk &talk = *_vm->_talk; int xp; @@ -459,37 +474,20 @@ int ScalpelJournal::getSearchString(bool printError) { int done = 0; byte color; - Common::String fixedText_Exit = fixedText.getText(kFixedText_JournalSearch_Exit); - Common::String fixedText_Backward = fixedText.getText(kFixedText_JournalSearch_Backward); - Common::String fixedText_Forward = fixedText.getText(kFixedText_JournalSearch_Forward); - Common::String fixedText_NotFound = fixedText.getText(kFixedText_JournalSearch_NotFound); - // Draw search panel screen.makePanel(Common::Rect(6, 171, 313, 199)); screen.makeButton(Common::Rect(SEARCH_POINTS[0][0], yp, SEARCH_POINTS[0][1], yp + 10), - SEARCH_POINTS[0][2] - screen.stringWidth(fixedText_Exit) / 2, fixedText_Exit); + SEARCH_POINTS[0][2], _fixedTextSearchExit); screen.makeButton(Common::Rect(SEARCH_POINTS[1][0], yp, SEARCH_POINTS[1][1], yp + 10), - SEARCH_POINTS[1][2] - screen.stringWidth(fixedText_Backward) / 2, fixedText_Backward); + SEARCH_POINTS[1][2], _fixedTextSearchBackward); screen.makeButton(Common::Rect(SEARCH_POINTS[2][0], yp, SEARCH_POINTS[2][1], yp + 10), - SEARCH_POINTS[2][2] - screen.stringWidth(fixedText_Forward) / 2, fixedText_Forward); - - screen.gPrint(Common::Point(SEARCH_POINTS[0][2] - screen.stringWidth(fixedText_Exit) / 2, yp), - COMMAND_HIGHLIGHTED, "%c", fixedText_Exit[0]); - screen.gPrint(Common::Point(SEARCH_POINTS[1][2] - screen.stringWidth(fixedText_Backward) / 2, yp), - COMMAND_HIGHLIGHTED, "%c", fixedText_Backward[0]); - screen.gPrint(Common::Point(SEARCH_POINTS[2][2] - screen.stringWidth(fixedText_Forward) / 2, yp), - COMMAND_HIGHLIGHTED, "%c", fixedText_Forward[0]); + SEARCH_POINTS[2][2], _fixedTextSearchForward); screen.makeField(Common::Rect(12, 185, 307, 196)); - screen.fillRect(Common::Rect(12, 185, 307, 186), BUTTON_BOTTOM); - screen.vLine(12, 185, 195, BUTTON_BOTTOM); - screen.hLine(13, 195, 306, BUTTON_TOP); - screen.hLine(306, 186, 195, BUTTON_TOP); - if (printError) { - screen.gPrint(Common::Point((SHERLOCK_SCREEN_WIDTH - screen.stringWidth(fixedText_NotFound)) / 2, 185), - INV_FOREGROUND, "%s", fixedText_NotFound.c_str()); + screen.gPrint(Common::Point((SHERLOCK_SCREEN_WIDTH - screen.stringWidth(_fixedTextSearchNotFound)) / 2, 185), + INV_FOREGROUND, "%s", _fixedTextSearchNotFound.c_str()); } else if (!_find.empty()) { // There's already a search term, display it already screen.gPrint(Common::Point(15, 185), TALK_FOREGROUND, "%s", _find.c_str()); @@ -544,7 +542,7 @@ int ScalpelJournal::getSearchString(bool printError) { } else { color = COMMAND_FOREGROUND; } - screen.print(Common::Point(SEARCH_POINTS[0][2] - screen.stringWidth(fixedText_Exit) / 2, 175), color, "%s", fixedText_Exit.c_str()); + screen.buttonPrint(Common::Point(SEARCH_POINTS[0][0], SEARCH_POINTS[0][2]), color, false, _fixedTextSearchExit); if (pt.x > SEARCH_POINTS[1][0] && pt.x < SEARCH_POINTS[1][1] && pt.y > 174 && pt.y < 183) { found = BTN_BACKWARD; @@ -552,7 +550,7 @@ int ScalpelJournal::getSearchString(bool printError) { } else { color = COMMAND_FOREGROUND; } - screen.print(Common::Point(SEARCH_POINTS[1][2] - screen.stringWidth(fixedText_Backward) / 2, 175), color, "%s", fixedText_Backward.c_str()); + screen.buttonPrint(Common::Point(SEARCH_POINTS[1][0], SEARCH_POINTS[1][2]), color, false, _fixedTextSearchBackward); if (pt.x > SEARCH_POINTS[2][0] && pt.x < SEARCH_POINTS[2][1] && pt.y > 174 && pt.y < 183) { found = BTN_FORWARD; @@ -560,7 +558,7 @@ int ScalpelJournal::getSearchString(bool printError) { } else { color = COMMAND_FOREGROUND; } - screen.print(Common::Point(SEARCH_POINTS[2][2] - screen.stringWidth(fixedText_Forward) / 2, 175), color, "%s", fixedText_Forward.c_str()); + screen.buttonPrint(Common::Point(SEARCH_POINTS[2][0], SEARCH_POINTS[2][2]), color, false, _fixedTextSearchForward); } events.wait(2); diff --git a/engines/sherlock/scalpel/scalpel_journal.h b/engines/sherlock/scalpel/scalpel_journal.h index c8e9c01739..50f1917fca 100644 --- a/engines/sherlock/scalpel/scalpel_journal.h +++ b/engines/sherlock/scalpel/scalpel_journal.h @@ -41,6 +41,37 @@ enum JournalButton { }; class ScalpelJournal: public Journal { +public: + Common::String _fixedTextWatsonsJournal; + Common::String _fixedTextExit; + Common::String _fixedTextBack10; + Common::String _fixedTextUp; + Common::String _fixedTextDown; + Common::String _fixedTextAhead10; + Common::String _fixedTextSearch; + Common::String _fixedTextFirstPage; + Common::String _fixedTextLastPage; + Common::String _fixedTextPrintText; + + byte _hotkeyExit; + byte _hotkeyBack10; + byte _hotkeyUp; + byte _hotkeyDown; + byte _hotkeyAhead10; + byte _hotkeySearch; + byte _hotkeyFirstPage; + byte _hotkeyLastPage; + byte _hotkeyPrintText; + + Common::String _fixedTextSearchExit; + Common::String _fixedTextSearchBackward; + Common::String _fixedTextSearchForward; + Common::String _fixedTextSearchNotFound; + + byte _hotkeySearchExit; + byte _hotkeySearchBackward; + byte _hotkeySearchForward; + private: /** * Load the list of journal locations diff --git a/engines/sherlock/scalpel/scalpel_map.cpp b/engines/sherlock/scalpel/scalpel_map.cpp index 369822ba02..ba14b5b300 100644 --- a/engines/sherlock/scalpel/scalpel_map.cpp +++ b/engines/sherlock/scalpel/scalpel_map.cpp @@ -100,6 +100,21 @@ void ScalpelMap::loadData() { while ((c = txtStream->readByte()) != '\0') line += c; + // WORKAROUND: Special fixes for faulty translations + // Was obviously not done in the original interpreter + if (_vm->getLanguage() == Common::ES_ESP) { + // Spanish version + if (line == " Alley") { + // The "Alley" location was not translated, we do this now + // see bug #6931 + line = " Callejon"; + } else if (line == " Alamacen") { + // "Warehouse" location has a typo, we fix it + // see bug #6931 + line = " Almacen"; + } + } + _locationNames.push_back(line); } @@ -152,13 +167,13 @@ int ScalpelMap::show() { setupSprites(); if (!IS_3DO) { - screen._backBuffer1.blitFrom((*bigMap)[0], Common::Point(-_bigPos.x, -_bigPos.y)); - screen._backBuffer1.blitFrom((*bigMap)[1], Common::Point(-_bigPos.x, SHERLOCK_SCREEN_HEIGHT - _bigPos.y)); - screen._backBuffer1.blitFrom((*bigMap)[2], Common::Point(SHERLOCK_SCREEN_WIDTH - _bigPos.x, -_bigPos.y)); - screen._backBuffer1.blitFrom((*bigMap)[3], Common::Point(SHERLOCK_SCREEN_WIDTH - _bigPos.x, SHERLOCK_SCREEN_HEIGHT - _bigPos.y)); + screen._backBuffer1.SHblitFrom((*bigMap)[0], Common::Point(-_bigPos.x, -_bigPos.y)); + screen._backBuffer1.SHblitFrom((*bigMap)[1], Common::Point(-_bigPos.x, SHERLOCK_SCREEN_HEIGHT - _bigPos.y)); + screen._backBuffer1.SHblitFrom((*bigMap)[2], Common::Point(SHERLOCK_SCREEN_WIDTH - _bigPos.x, -_bigPos.y)); + screen._backBuffer1.SHblitFrom((*bigMap)[3], Common::Point(SHERLOCK_SCREEN_WIDTH - _bigPos.x, SHERLOCK_SCREEN_HEIGHT - _bigPos.y)); } else { - screen._backBuffer1.blitFrom((*bigMap)[0], Common::Point(-_bigPos.x, -_bigPos.y)); - screen.blitFrom((*bigMap)[0], Common::Point(-_bigPos.x, -_bigPos.y)); + screen._backBuffer1.SHblitFrom((*bigMap)[0], Common::Point(-_bigPos.x, -_bigPos.y)); + screen.SHblitFrom((*bigMap)[0], Common::Point(-_bigPos.x, -_bigPos.y)); } _drawMap = true; @@ -223,12 +238,12 @@ int ScalpelMap::show() { changed = false; if (!IS_3DO) { - screen._backBuffer1.blitFrom((*bigMap)[0], Common::Point(-_bigPos.x, -_bigPos.y)); - screen._backBuffer1.blitFrom((*bigMap)[1], Common::Point(-_bigPos.x, SHERLOCK_SCREEN_HEIGHT - _bigPos.y)); - screen._backBuffer1.blitFrom((*bigMap)[2], Common::Point(SHERLOCK_SCREEN_WIDTH - _bigPos.x, -_bigPos.y)); - screen._backBuffer1.blitFrom((*bigMap)[3], Common::Point(SHERLOCK_SCREEN_WIDTH - _bigPos.x, SHERLOCK_SCREEN_HEIGHT - _bigPos.y)); + screen._backBuffer1.SHblitFrom((*bigMap)[0], Common::Point(-_bigPos.x, -_bigPos.y)); + screen._backBuffer1.SHblitFrom((*bigMap)[1], Common::Point(-_bigPos.x, SHERLOCK_SCREEN_HEIGHT - _bigPos.y)); + screen._backBuffer1.SHblitFrom((*bigMap)[2], Common::Point(SHERLOCK_SCREEN_WIDTH - _bigPos.x, -_bigPos.y)); + screen._backBuffer1.SHblitFrom((*bigMap)[3], Common::Point(SHERLOCK_SCREEN_WIDTH - _bigPos.x, SHERLOCK_SCREEN_HEIGHT - _bigPos.y)); } else { - screen._backBuffer1.blitFrom((*bigMap)[0], Common::Point(-_bigPos.x, -_bigPos.y)); + screen._backBuffer1.SHblitFrom((*bigMap)[0], Common::Point(-_bigPos.x, -_bigPos.y)); } showPlaces(); @@ -344,7 +359,6 @@ void ScalpelMap::freeSprites() { delete _mapCursors; delete _shapes; delete _iconShapes; - _iconSave.free(); } void ScalpelMap::showPlaces() { @@ -361,7 +375,7 @@ void ScalpelMap::showPlaces() { if (pt.x >= _bigPos.x && (pt.x - _bigPos.x) < SHERLOCK_SCREEN_WIDTH && pt.y >= _bigPos.y && (pt.y - _bigPos.y) < SHERLOCK_SCREEN_HEIGHT) { if (_vm->readFlags(idx)) { - screen._backBuffer1.transBlitFrom((*_iconShapes)[pt._translate], + screen._backBuffer1.SHtransBlitFrom((*_iconShapes)[pt._translate], Common::Point(pt.x - _bigPos.x - 6, pt.y - _bigPos.y - 12)); } } @@ -373,13 +387,13 @@ void ScalpelMap::showPlaces() { } void ScalpelMap::saveTopLine() { - _topLine.blitFrom(_vm->_screen->_backBuffer1, Common::Point(0, 0), Common::Rect(0, 0, SHERLOCK_SCREEN_WIDTH, 12)); + _topLine.SHblitFrom(_vm->_screen->_backBuffer1, Common::Point(0, 0), Common::Rect(0, 0, SHERLOCK_SCREEN_WIDTH, 12)); } void ScalpelMap::eraseTopLine() { Screen &screen = *_vm->_screen; - screen._backBuffer1.blitFrom(_topLine, Common::Point(0, 0)); - screen.slamArea(0, 0, SHERLOCK_SCREEN_WIDTH, _topLine.h()); + screen._backBuffer1.SHblitFrom(_topLine, Common::Point(0, 0)); + screen.slamArea(0, 0, SHERLOCK_SCREEN_WIDTH, _topLine.height()); } void ScalpelMap::showPlaceName(int idx, bool highlighted) { @@ -394,7 +408,7 @@ void ScalpelMap::showPlaceName(int idx, bool highlighted) { bool flipped = people[HOLMES]._sequenceNumber == MAP_DOWNLEFT || people[HOLMES]._sequenceNumber == MAP_LEFT || people[HOLMES]._sequenceNumber == MAP_UPLEFT; - screen._backBuffer1.transBlitFrom(*people[HOLMES]._imageFrame, _lDrawnPos, flipped); + screen._backBuffer1.SHtransBlitFrom(*people[HOLMES]._imageFrame, _lDrawnPos, flipped); } if (highlighted) { @@ -436,9 +450,9 @@ void ScalpelMap::updateMap(bool flushScreen) { saveIcon(people[HOLMES]._imageFrame, hPos); if (people[HOLMES]._sequenceNumber == MAP_DOWNLEFT || people[HOLMES]._sequenceNumber == MAP_LEFT || people[HOLMES]._sequenceNumber == MAP_UPLEFT) - screen._backBuffer1.transBlitFrom(*people[HOLMES]._imageFrame, hPos, true); + screen._backBuffer1.SHtransBlitFrom(*people[HOLMES]._imageFrame, hPos, true); else - screen._backBuffer1.transBlitFrom(*people[HOLMES]._imageFrame, hPos, false); + screen._backBuffer1.SHtransBlitFrom(*people[HOLMES]._imageFrame, hPos, false); if (flushScreen) { screen.slamArea(0, 0, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT); @@ -538,8 +552,8 @@ void ScalpelMap::saveIcon(ImageFrame *src, const Common::Point &pt) { return; } - assert(size.x <= _iconSave.w() && size.y <= _iconSave.h()); - _iconSave.blitFrom(screen._backBuffer1, Common::Point(0, 0), + assert(size.x <= _iconSave.width() && size.y <= _iconSave.height()); + _iconSave.SHblitFrom(screen._backBuffer1, Common::Point(0, 0), Common::Rect(pos.x, pos.y, pos.x + size.x, pos.y + size.y)); _savedPos = pos; _savedSize = size; @@ -550,7 +564,7 @@ void ScalpelMap::restoreIcon() { if (_savedPos.x >= 0 && _savedPos.y >= 0 && _savedPos.x <= SHERLOCK_SCREEN_WIDTH && _savedPos.y < SHERLOCK_SCREEN_HEIGHT) - screen._backBuffer1.blitFrom(_iconSave, _savedPos, Common::Rect(0, 0, _savedSize.x, _savedSize.y)); + screen._backBuffer1.SHblitFrom(_iconSave, _savedPos, Common::Rect(0, 0, _savedSize.x, _savedSize.y)); } void ScalpelMap::highlightIcon(const Common::Point &pt) { diff --git a/engines/sherlock/scalpel/scalpel_saveload.cpp b/engines/sherlock/scalpel/scalpel_saveload.cpp index 01ba149813..90eab5930c 100644 --- a/engines/sherlock/scalpel/scalpel_saveload.cpp +++ b/engines/sherlock/scalpel/scalpel_saveload.cpp @@ -20,6 +20,7 @@ * */ +#include "sherlock/scalpel/scalpel_fixed_text.h" #include "sherlock/scalpel/scalpel_saveload.h" #include "sherlock/scalpel/scalpel_screen.h" #include "sherlock/scalpel/scalpel.h" @@ -39,7 +40,44 @@ const int ENV_POINTS[6][3] = { /*----------------------------------------------------------------*/ -ScalpelSaveManager::ScalpelSaveManager(SherlockEngine *vm, const Common::String &target) : SaveManager(vm, target) { +ScalpelSaveManager::ScalpelSaveManager(SherlockEngine *vm, const Common::String &target) : + SaveManager(vm, target), _envMode(SAVEMODE_NONE) { + + _fixedTextExit = FIXED(LoadSave_Exit); + _fixedTextLoad = FIXED(LoadSave_Load); + _fixedTextSave = FIXED(LoadSave_Save); + _fixedTextUp = FIXED(LoadSave_Up); + _fixedTextDown = FIXED(LoadSave_Down); + _fixedTextQuit = FIXED(LoadSave_Quit); + + _hotkeyExit = toupper(_fixedTextExit[0]); + _hotkeyLoad = toupper(_fixedTextLoad[0]); + _hotkeySave = toupper(_fixedTextSave[0]); + _hotkeyUp = toupper(_fixedTextUp[0]); + _hotkeyDown = toupper(_fixedTextDown[0]); + _hotkeyQuit = toupper(_fixedTextQuit[0]); + + _hotkeysIndexed[0] = _hotkeyExit; + _hotkeysIndexed[1] = _hotkeyLoad; + _hotkeysIndexed[2] = _hotkeySave; + _hotkeysIndexed[3] = _hotkeyUp; + _hotkeysIndexed[4] = _hotkeyDown; + _hotkeysIndexed[5] = _hotkeyQuit; + + _fixedTextQuitGameQuestion = FIXED(QuitGame_Question); + _fixedTextQuitGameYes = FIXED(QuitGame_Yes); + _fixedTextQuitGameNo = FIXED(QuitGame_No); + + _hotkeyQuitGameYes = toupper(_fixedTextQuitGameYes[0]); + _hotkeyQuitGameNo = toupper(_fixedTextQuitGameNo[0]); +} + +int ScalpelSaveManager::identifyUserButton(int key) { + for (uint16 hotkeyNr = 0; hotkeyNr < sizeof(_hotkeysIndexed); hotkeyNr++) { + if (key == _hotkeysIndexed[hotkeyNr]) + return hotkeyNr; + } + return -1; } void ScalpelSaveManager::drawInterface() { @@ -56,23 +94,23 @@ void ScalpelSaveManager::drawInterface() { screen._backBuffer1.fillRect(Common::Rect(2, CONTROLS_Y + 10, SHERLOCK_SCREEN_WIDTH - 2, SHERLOCK_SCREEN_HEIGHT - 2), INV_BACKGROUND); screen.makeButton(Common::Rect(ENV_POINTS[0][0], CONTROLS_Y, ENV_POINTS[0][1], CONTROLS_Y + 10), - ENV_POINTS[0][2] - screen.stringWidth("Exit") / 2, "Exit"); + ENV_POINTS[0][2], _fixedTextExit); screen.makeButton(Common::Rect(ENV_POINTS[1][0], CONTROLS_Y, ENV_POINTS[1][1], CONTROLS_Y + 10), - ENV_POINTS[1][2] - screen.stringWidth("Load") / 2, "Load"); + ENV_POINTS[1][2], _fixedTextLoad); screen.makeButton(Common::Rect(ENV_POINTS[2][0], CONTROLS_Y, ENV_POINTS[2][1], CONTROLS_Y + 10), - ENV_POINTS[2][2] - screen.stringWidth("Save") / 2, "Save"); + ENV_POINTS[2][2], _fixedTextSave); screen.makeButton(Common::Rect(ENV_POINTS[3][0], CONTROLS_Y, ENV_POINTS[3][1], CONTROLS_Y + 10), - ENV_POINTS[3][2] - screen.stringWidth("Up") / 2, "Up"); + ENV_POINTS[3][2], _fixedTextUp); screen.makeButton(Common::Rect(ENV_POINTS[4][0], CONTROLS_Y, ENV_POINTS[4][1], CONTROLS_Y + 10), - ENV_POINTS[4][2] - screen.stringWidth("Down") / 2, "Down"); + ENV_POINTS[4][2], _fixedTextDown); screen.makeButton(Common::Rect(ENV_POINTS[5][0], CONTROLS_Y, ENV_POINTS[5][1], CONTROLS_Y + 10), - ENV_POINTS[5][2] - screen.stringWidth("Quit") / 2, "Quit"); + ENV_POINTS[5][2], _fixedTextQuit); if (!_savegameIndex) - screen.buttonPrint(Common::Point(ENV_POINTS[3][2], CONTROLS_Y), COMMAND_NULL, 0, "Up"); + screen.buttonPrint(Common::Point(ENV_POINTS[3][2], CONTROLS_Y), COMMAND_NULL, 0, _fixedTextUp); if (_savegameIndex == MAX_SAVEGAME_SLOTS - ONSCREEN_FILES_COUNT) - screen.buttonPrint(Common::Point(ENV_POINTS[4][2], CONTROLS_Y), COMMAND_NULL, 0, "Down"); + screen.buttonPrint(Common::Point(ENV_POINTS[4][2], CONTROLS_Y), COMMAND_NULL, 0, _fixedTextDown); for (int idx = _savegameIndex; idx < _savegameIndex + ONSCREEN_FILES_COUNT; ++idx) { screen.gPrint(Common::Point(6, CONTROLS_Y + 11 + (idx - _savegameIndex) * 10), @@ -106,31 +144,31 @@ void ScalpelSaveManager::highlightButtons(int btnIndex) { ScalpelScreen &screen = *(ScalpelScreen *)_vm->_screen; byte color = (btnIndex == 0) ? COMMAND_HIGHLIGHTED : COMMAND_FOREGROUND; - screen.buttonPrint(Common::Point(ENV_POINTS[0][2], CONTROLS_Y), color, 1, "Exit"); + screen.buttonPrint(Common::Point(ENV_POINTS[0][2], CONTROLS_Y), color, 1, _fixedTextExit); if ((btnIndex == 1) || ((_envMode == SAVEMODE_LOAD) && (btnIndex != 2))) - screen.buttonPrint(Common::Point(ENV_POINTS[1][2], CONTROLS_Y), COMMAND_HIGHLIGHTED, true, "Load"); + screen.buttonPrint(Common::Point(ENV_POINTS[1][2], CONTROLS_Y), COMMAND_HIGHLIGHTED, true, _fixedTextLoad); else - screen.buttonPrint(Common::Point(ENV_POINTS[1][2], CONTROLS_Y), COMMAND_FOREGROUND, true, "Load"); + screen.buttonPrint(Common::Point(ENV_POINTS[1][2], CONTROLS_Y), COMMAND_FOREGROUND, true, _fixedTextLoad); if ((btnIndex == 2) || ((_envMode == SAVEMODE_SAVE) && (btnIndex != 1))) - screen.buttonPrint(Common::Point(ENV_POINTS[2][2], CONTROLS_Y), COMMAND_HIGHLIGHTED, true, "Save"); + screen.buttonPrint(Common::Point(ENV_POINTS[2][2], CONTROLS_Y), COMMAND_HIGHLIGHTED, true, _fixedTextSave); else - screen.buttonPrint(Common::Point(ENV_POINTS[2][2], CONTROLS_Y), COMMAND_FOREGROUND, true, "Save"); + screen.buttonPrint(Common::Point(ENV_POINTS[2][2], CONTROLS_Y), COMMAND_FOREGROUND, true, _fixedTextSave); if (btnIndex == 3 && _savegameIndex) - screen.buttonPrint(Common::Point(ENV_POINTS[3][2], CONTROLS_Y), COMMAND_HIGHLIGHTED, true, "Up"); + screen.buttonPrint(Common::Point(ENV_POINTS[3][2], CONTROLS_Y), COMMAND_HIGHLIGHTED, true, _fixedTextUp); else if (_savegameIndex) - screen.buttonPrint(Common::Point(ENV_POINTS[3][2], CONTROLS_Y), COMMAND_FOREGROUND, true, "Up"); + screen.buttonPrint(Common::Point(ENV_POINTS[3][2], CONTROLS_Y), COMMAND_FOREGROUND, true, _fixedTextUp); if ((btnIndex == 4) && (_savegameIndex < MAX_SAVEGAME_SLOTS - 5)) - screen.buttonPrint(Common::Point(ENV_POINTS[4][2], CONTROLS_Y), COMMAND_HIGHLIGHTED, true, "Down"); + screen.buttonPrint(Common::Point(ENV_POINTS[4][2], CONTROLS_Y), COMMAND_HIGHLIGHTED, true, _fixedTextDown); else if (_savegameIndex < (MAX_SAVEGAME_SLOTS - 5)) - screen.buttonPrint(Common::Point(ENV_POINTS[4][2], CONTROLS_Y), COMMAND_FOREGROUND, true, "Down"); + screen.buttonPrint(Common::Point(ENV_POINTS[4][2], CONTROLS_Y), COMMAND_FOREGROUND, true, _fixedTextDown); color = (btnIndex == 5) ? COMMAND_HIGHLIGHTED : COMMAND_FOREGROUND; - screen.buttonPrint(Common::Point(ENV_POINTS[5][2], CONTROLS_Y), color, 1, "Quit"); + screen.buttonPrint(Common::Point(ENV_POINTS[5][2], CONTROLS_Y), color, 1, _fixedTextQuit); } bool ScalpelSaveManager::checkGameOnScreen(int slot) { @@ -153,10 +191,10 @@ bool ScalpelSaveManager::checkGameOnScreen(int slot) { screen.slamRect(Common::Rect(3, CONTROLS_Y + 11, 318, SHERLOCK_SCREEN_HEIGHT)); byte color = !_savegameIndex ? COMMAND_NULL : COMMAND_FOREGROUND; - screen.buttonPrint(Common::Point(ENV_POINTS[3][2], CONTROLS_Y), color, 1, "Up"); + screen.buttonPrint(Common::Point(ENV_POINTS[3][2], CONTROLS_Y), color, 1, _fixedTextUp); color = (_savegameIndex == (MAX_SAVEGAME_SLOTS - 5)) ? COMMAND_NULL : COMMAND_FOREGROUND; - screen.buttonPrint(Common::Point(ENV_POINTS[4][2], CONTROLS_Y), color, 1, "Down"); + screen.buttonPrint(Common::Point(ENV_POINTS[4][2], CONTROLS_Y), color, 1, _fixedTextDown); return true; } @@ -172,12 +210,12 @@ bool ScalpelSaveManager::promptForDescription(int slot) { int xp, yp; bool flag = false; - screen.buttonPrint(Common::Point(ENV_POINTS[0][2], CONTROLS_Y), COMMAND_NULL, true, "Exit"); - screen.buttonPrint(Common::Point(ENV_POINTS[1][2], CONTROLS_Y), COMMAND_NULL, true, "Load"); - screen.buttonPrint(Common::Point(ENV_POINTS[2][2], CONTROLS_Y), COMMAND_NULL, true, "Save"); - screen.buttonPrint(Common::Point(ENV_POINTS[3][2], CONTROLS_Y), COMMAND_NULL, true, "Up"); - screen.buttonPrint(Common::Point(ENV_POINTS[4][2], CONTROLS_Y), COMMAND_NULL, true, "Down"); - screen.buttonPrint(Common::Point(ENV_POINTS[5][2], CONTROLS_Y), COMMAND_NULL, true, "Quit"); + screen.buttonPrint(Common::Point(ENV_POINTS[0][2], CONTROLS_Y), COMMAND_NULL, true, _fixedTextExit); + screen.buttonPrint(Common::Point(ENV_POINTS[1][2], CONTROLS_Y), COMMAND_NULL, true, _fixedTextLoad); + screen.buttonPrint(Common::Point(ENV_POINTS[2][2], CONTROLS_Y), COMMAND_NULL, true, _fixedTextSave); + screen.buttonPrint(Common::Point(ENV_POINTS[3][2], CONTROLS_Y), COMMAND_NULL, true, _fixedTextUp); + screen.buttonPrint(Common::Point(ENV_POINTS[4][2], CONTROLS_Y), COMMAND_NULL, true, _fixedTextDown); + screen.buttonPrint(Common::Point(ENV_POINTS[5][2], CONTROLS_Y), COMMAND_NULL, true, _fixedTextQuit); Common::String saveName = _savegames[slot]; if (isSlotEmpty(slot)) { diff --git a/engines/sherlock/scalpel/scalpel_saveload.h b/engines/sherlock/scalpel/scalpel_saveload.h index 6b035cace3..81e3d834aa 100644 --- a/engines/sherlock/scalpel/scalpel_saveload.h +++ b/engines/sherlock/scalpel/scalpel_saveload.h @@ -34,6 +34,30 @@ extern const int ENV_POINTS[6][3]; class ScalpelSaveManager: public SaveManager { public: SaveMode _envMode; + + Common::String _fixedTextExit; + Common::String _fixedTextLoad; + Common::String _fixedTextSave; + Common::String _fixedTextUp; + Common::String _fixedTextDown; + Common::String _fixedTextQuit; + + byte _hotkeyExit; + byte _hotkeyLoad; + byte _hotkeySave; + byte _hotkeyUp; + byte _hotkeyDown; + byte _hotkeyQuit; + + byte _hotkeysIndexed[6]; + + Common::String _fixedTextQuitGameQuestion; + Common::String _fixedTextQuitGameYes; + Common::String _fixedTextQuitGameNo; + + byte _hotkeyQuitGameYes; + byte _hotkeyQuitGameNo; + public: ScalpelSaveManager(SherlockEngine *vm, const Common::String &target); virtual ~ScalpelSaveManager() {} @@ -62,6 +86,11 @@ public: * Prompts the user to enter a description in a given slot */ bool promptForDescription(int slot); + + /** + * Identifies a button number according to the key, that the user pressed + */ + int identifyUserButton(int key); }; } // End of namespace Scalpel diff --git a/engines/sherlock/scalpel/scalpel_scene.cpp b/engines/sherlock/scalpel/scalpel_scene.cpp index b2c7339363..11fb807c3b 100644 --- a/engines/sherlock/scalpel/scalpel_scene.cpp +++ b/engines/sherlock/scalpel/scalpel_scene.cpp @@ -40,6 +40,11 @@ const int FS_TRANS[8] = { /*----------------------------------------------------------------*/ +ScalpelScene::~ScalpelScene() { + for (uint idx = 0; idx < _canimShapes.size(); ++idx) + delete _canimShapes[idx]; +} + bool ScalpelScene::loadScene(const Common::String &filename) { ScalpelMap &map = *(ScalpelMap *)_vm->_map; bool result = Scene::loadScene(filename); @@ -66,27 +71,27 @@ void ScalpelScene::drawAllShapes() { // Draw all active shapes which are behind the person for (uint idx = 0; idx < _bgShapes.size(); ++idx) { if (_bgShapes[idx]._type == ACTIVE_BG_SHAPE && _bgShapes[idx]._misc == BEHIND) - screen._backBuffer->transBlitFrom(*_bgShapes[idx]._imageFrame, _bgShapes[idx]._position, _bgShapes[idx]._flags & OBJ_FLIPPED); + screen.getBackBuffer()->SHtransBlitFrom(*_bgShapes[idx]._imageFrame, _bgShapes[idx]._position, _bgShapes[idx]._flags & OBJ_FLIPPED); } // Draw all canimations which are behind the person for (uint idx = 0; idx < _canimShapes.size(); ++idx) { - if (_canimShapes[idx]._type == ACTIVE_BG_SHAPE && _canimShapes[idx]._misc == BEHIND) - screen._backBuffer->transBlitFrom(*_canimShapes[idx]._imageFrame, - _canimShapes[idx]._position, _canimShapes[idx]._flags & OBJ_FLIPPED); + if (_canimShapes[idx]->_type == ACTIVE_BG_SHAPE && _canimShapes[idx]->_misc == BEHIND) + screen.getBackBuffer()->SHtransBlitFrom(*_canimShapes[idx]->_imageFrame, + _canimShapes[idx]->_position, _canimShapes[idx]->_flags & OBJ_FLIPPED); } // Draw all active shapes which are normal and behind the person for (uint idx = 0; idx < _bgShapes.size(); ++idx) { if (_bgShapes[idx]._type == ACTIVE_BG_SHAPE && _bgShapes[idx]._misc == NORMAL_BEHIND) - screen._backBuffer->transBlitFrom(*_bgShapes[idx]._imageFrame, _bgShapes[idx]._position, _bgShapes[idx]._flags & OBJ_FLIPPED); + screen.getBackBuffer()->SHtransBlitFrom(*_bgShapes[idx]._imageFrame, _bgShapes[idx]._position, _bgShapes[idx]._flags & OBJ_FLIPPED); } // Draw all canimations which are normal and behind the person for (uint idx = 0; idx < _canimShapes.size(); ++idx) { - if (_canimShapes[idx]._type == ACTIVE_BG_SHAPE && _canimShapes[idx]._misc == NORMAL_BEHIND) - screen._backBuffer->transBlitFrom(*_canimShapes[idx]._imageFrame, _canimShapes[idx]._position, - _canimShapes[idx]._flags & OBJ_FLIPPED); + if (_canimShapes[idx]->_type == ACTIVE_BG_SHAPE && _canimShapes[idx]->_misc == NORMAL_BEHIND) + screen.getBackBuffer()->SHtransBlitFrom(*_canimShapes[idx]->_imageFrame, _canimShapes[idx]->_position, + _canimShapes[idx]->_flags & OBJ_FLIPPED); } // Draw any active characters @@ -98,7 +103,7 @@ void ScalpelScene::drawAllShapes() { p._sequenceNumber == WALK_UPLEFT || p._sequenceNumber == STOP_UPLEFT || p._sequenceNumber == WALK_DOWNRIGHT || p._sequenceNumber == STOP_DOWNRIGHT); - screen._backBuffer->transBlitFrom(*p._imageFrame, Common::Point(p._position.x / FIXED_INT_MULTIPLIER, + screen.getBackBuffer()->SHtransBlitFrom(*p._imageFrame, Common::Point(p._position.x / FIXED_INT_MULTIPLIER, p._position.y / FIXED_INT_MULTIPLIER - p.frameHeight()), flipped); } } @@ -107,16 +112,16 @@ void ScalpelScene::drawAllShapes() { for (uint idx = 0; idx < _bgShapes.size(); ++idx) { if ((_bgShapes[idx]._type == ACTIVE_BG_SHAPE || _bgShapes[idx]._type == STATIC_BG_SHAPE) && _bgShapes[idx]._misc == NORMAL_FORWARD) - screen._backBuffer->transBlitFrom(*_bgShapes[idx]._imageFrame, _bgShapes[idx]._position, + screen.getBackBuffer()->SHtransBlitFrom(*_bgShapes[idx]._imageFrame, _bgShapes[idx]._position, _bgShapes[idx]._flags & OBJ_FLIPPED); } // Draw all static and active canimations that are NORMAL and are in front of the player for (uint idx = 0; idx < _canimShapes.size(); ++idx) { - if ((_canimShapes[idx]._type == ACTIVE_BG_SHAPE || _canimShapes[idx]._type == STATIC_BG_SHAPE) && - _canimShapes[idx]._misc == NORMAL_FORWARD) - screen._backBuffer->transBlitFrom(*_canimShapes[idx]._imageFrame, _canimShapes[idx]._position, - _canimShapes[idx]._flags & OBJ_FLIPPED); + if ((_canimShapes[idx]->_type == ACTIVE_BG_SHAPE || _canimShapes[idx]->_type == STATIC_BG_SHAPE) && + _canimShapes[idx]->_misc == NORMAL_FORWARD) + screen.getBackBuffer()->SHtransBlitFrom(*_canimShapes[idx]->_imageFrame, _canimShapes[idx]->_position, + _canimShapes[idx]->_flags & OBJ_FLIPPED); } // Draw all static and active shapes that are FORWARD @@ -127,16 +132,16 @@ void ScalpelScene::drawAllShapes() { if ((_bgShapes[idx]._type == ACTIVE_BG_SHAPE || _bgShapes[idx]._type == STATIC_BG_SHAPE) && _bgShapes[idx]._misc == FORWARD) - screen._backBuffer->transBlitFrom(*_bgShapes[idx]._imageFrame, _bgShapes[idx]._position, + screen.getBackBuffer()->SHtransBlitFrom(*_bgShapes[idx]._imageFrame, _bgShapes[idx]._position, _bgShapes[idx]._flags & OBJ_FLIPPED); } // Draw all static and active canimations that are forward for (uint idx = 0; idx < _canimShapes.size(); ++idx) { - if ((_canimShapes[idx]._type == ACTIVE_BG_SHAPE || _canimShapes[idx]._type == STATIC_BG_SHAPE) && - _canimShapes[idx]._misc == FORWARD) - screen._backBuffer->transBlitFrom(*_canimShapes[idx]._imageFrame, _canimShapes[idx]._position, - _canimShapes[idx]._flags & OBJ_FLIPPED); + if ((_canimShapes[idx]->_type == ACTIVE_BG_SHAPE || _canimShapes[idx]->_type == STATIC_BG_SHAPE) && + _canimShapes[idx]->_misc == FORWARD) + screen.getBackBuffer()->SHtransBlitFrom(*_canimShapes[idx]->_imageFrame, _canimShapes[idx]->_position, + _canimShapes[idx]->_flags & OBJ_FLIPPED); } screen.resetDisplayBounds(); @@ -152,7 +157,7 @@ void ScalpelScene::checkBgShapes() { // Iterate through the canim list for (uint idx = 0; idx < _canimShapes.size(); ++idx) { - Object &obj = _canimShapes[idx]; + Object &obj = *_canimShapes[idx]; if (obj._type == STATIC_BG_SHAPE || obj._type == ACTIVE_BG_SHAPE) { if ((obj._flags & 5) == 1) { obj._misc = (pt.y < (obj._position.y + obj._imageFrame->_frame.h - 1)) ? @@ -221,8 +226,8 @@ void ScalpelScene::doBgAnim() { people._portrait.checkObject(); for (uint idx = 0; idx < _canimShapes.size(); ++idx) { - if (_canimShapes[idx]._type != INVALID && _canimShapes[idx]._type != REMOVE) - _canimShapes[idx].checkObject(); + if (_canimShapes[idx]->_type != INVALID && _canimShapes[idx]->_type != REMOVE) + _canimShapes[idx]->checkObject(); } if (_currentScene == DRAWING_ROOM) @@ -237,7 +242,7 @@ void ScalpelScene::doBgAnim() { if (people[HOLMES]._type == CHARACTER) screen.restoreBackground(bounds); else if (people[HOLMES]._type == REMOVE) - screen._backBuffer->blitFrom(screen._backBuffer2, pt, bounds); + screen.getBackBuffer()->SHblitFrom(screen._backBuffer2, pt, bounds); for (uint idx = 0; idx < _bgShapes.size(); ++idx) { Object &o = _bgShapes[idx]; @@ -256,7 +261,7 @@ void ScalpelScene::doBgAnim() { Object &o = _bgShapes[idx]; if (o._type == NO_SHAPE && ((o._flags & OBJ_BEHIND) == 0)) { // Restore screen area - screen._backBuffer->blitFrom(screen._backBuffer2, o._position, + screen.getBackBuffer()->SHblitFrom(screen._backBuffer2, o._position, Common::Rect(o._position.x, o._position.y, o._position.x + o._noShapeSize.x, o._position.y + o._noShapeSize.y)); @@ -266,7 +271,7 @@ void ScalpelScene::doBgAnim() { } for (uint idx = 0; idx < _canimShapes.size(); ++idx) { - Object &o = _canimShapes[idx]; + Object &o = *_canimShapes[idx]; if (o._type == ACTIVE_BG_SHAPE || o._type == HIDE_SHAPE || o._type == REMOVE) screen.restoreBackground(Common::Rect(o._oldPosition.x, o._oldPosition.y, o._oldPosition.x + o._oldSize.x, o._oldPosition.y + o._oldSize.y)); @@ -287,8 +292,8 @@ void ScalpelScene::doBgAnim() { people._portrait.adjustObject(); for (uint idx = 0; idx < _canimShapes.size(); ++idx) { - if (_canimShapes[idx]._type != INVALID) - _canimShapes[idx].adjustObject(); + if (_canimShapes[idx]->_type != INVALID) + _canimShapes[idx]->adjustObject(); } if (people[HOLMES]._type == CHARACTER && people._holmesOn) @@ -304,14 +309,14 @@ void ScalpelScene::doBgAnim() { for (uint idx = 0; idx < _bgShapes.size(); ++idx) { Object &o = _bgShapes[idx]; if (o._type == ACTIVE_BG_SHAPE && o._misc == BEHIND) - screen._backBuffer->transBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED); + screen.getBackBuffer()->SHtransBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED); } // Draw all canimations which are behind the person for (uint idx = 0; idx < _canimShapes.size(); ++idx) { - Object &o = _canimShapes[idx]; + Object &o = *_canimShapes[idx]; if (o._type == ACTIVE_BG_SHAPE && o._misc == BEHIND) { - screen._backBuffer->transBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED); + screen.getBackBuffer()->SHtransBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED); } } @@ -319,19 +324,19 @@ void ScalpelScene::doBgAnim() { for (uint idx = 0; idx < _bgShapes.size(); ++idx) { Object &o = _bgShapes[idx]; if (o._type == ACTIVE_BG_SHAPE && o._misc == NORMAL_BEHIND) - screen._backBuffer->transBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED); + screen.getBackBuffer()->SHtransBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED); } // Draw all canimations which are NORMAL and behind the person for (uint idx = 0; idx < _canimShapes.size(); ++idx) { - Object &o = _canimShapes[idx]; + Object &o = *_canimShapes[idx]; if (o._type == ACTIVE_BG_SHAPE && o._misc == NORMAL_BEHIND) { - screen._backBuffer->transBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED); + screen.getBackBuffer()->SHtransBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED); } } - // Draw the person if not animating - if (people[HOLMES]._type == CHARACTER && people[HOLMES]._walkLoaded) { + // Draw the player if he's active and his walk has been loaded into memory + if (people[HOLMES]._type == CHARACTER && people[HOLMES]._walkLoaded && people._holmesOn) { // If Holmes is too far to the right, move him back so he's on-screen int xRight = SHERLOCK_SCREEN_WIDTH - 2 - people[HOLMES]._imageFrame->_frame.w; int tempX = MIN(people[HOLMES]._position.x / FIXED_INT_MULTIPLIER, xRight); @@ -339,7 +344,7 @@ void ScalpelScene::doBgAnim() { bool flipped = people[HOLMES]._sequenceNumber == WALK_LEFT || people[HOLMES]._sequenceNumber == STOP_LEFT || people[HOLMES]._sequenceNumber == WALK_UPLEFT || people[HOLMES]._sequenceNumber == STOP_UPLEFT || people[HOLMES]._sequenceNumber == WALK_DOWNRIGHT || people[HOLMES]._sequenceNumber == STOP_DOWNRIGHT; - screen._backBuffer->transBlitFrom(*people[HOLMES]._imageFrame, + screen.getBackBuffer()->SHtransBlitFrom(*people[HOLMES]._imageFrame, Common::Point(tempX, people[HOLMES]._position.y / FIXED_INT_MULTIPLIER - people[HOLMES]._imageFrame->_frame.h), flipped); } @@ -347,14 +352,14 @@ void ScalpelScene::doBgAnim() { for (uint idx = 0; idx < _bgShapes.size(); ++idx) { Object &o = _bgShapes[idx]; if ((o._type == ACTIVE_BG_SHAPE || o._type == STATIC_BG_SHAPE) && o._misc == NORMAL_FORWARD) - screen._backBuffer->transBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED); + screen.getBackBuffer()->SHtransBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED); } // Draw all static and active canimations that are NORMAL and are in front of the person for (uint idx = 0; idx < _canimShapes.size(); ++idx) { - Object &o = _canimShapes[idx]; + Object &o = *_canimShapes[idx]; if ((o._type == ACTIVE_BG_SHAPE || o._type == STATIC_BG_SHAPE) && o._misc == NORMAL_FORWARD) { - screen._backBuffer->transBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED); + screen.getBackBuffer()->SHtransBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED); } } @@ -362,19 +367,19 @@ void ScalpelScene::doBgAnim() { for (uint idx = 0; idx < _bgShapes.size(); ++idx) { Object &o = _bgShapes[idx]; if ((o._type == ACTIVE_BG_SHAPE || o._type == STATIC_BG_SHAPE) && o._misc == FORWARD) - screen._backBuffer->transBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED); + screen.getBackBuffer()->SHtransBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED); } // Draw any active portrait if (people._portraitLoaded && people._portrait._type == ACTIVE_BG_SHAPE) - screen._backBuffer->transBlitFrom(*people._portrait._imageFrame, + screen.getBackBuffer()->SHtransBlitFrom(*people._portrait._imageFrame, people._portrait._position, people._portrait._flags & OBJ_FLIPPED); // Draw all static and active canimations that are in front of the person for (uint idx = 0; idx < _canimShapes.size(); ++idx) { - Object &o = _canimShapes[idx]; + Object &o = *_canimShapes[idx]; if ((o._type == ACTIVE_BG_SHAPE || o._type == STATIC_BG_SHAPE) && o._misc == FORWARD) { - screen._backBuffer->transBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED); + screen.getBackBuffer()->SHtransBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED); } } @@ -382,7 +387,7 @@ void ScalpelScene::doBgAnim() { for (uint idx = 0; idx < _bgShapes.size(); ++idx) { Object &o = _bgShapes[idx]; if (o._type == NO_SHAPE && (o._flags & OBJ_BEHIND) == 0) - screen._backBuffer->transBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED); + screen.getBackBuffer()->SHtransBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED); } // Bring the newly built picture to the screen @@ -450,16 +455,18 @@ void ScalpelScene::doBgAnim() { } for (int idx = _canimShapes.size() - 1; idx >= 0; --idx) { - Object &o = _canimShapes[idx]; + Object &o = *_canimShapes[idx]; if (o._type == INVALID) { // Anim shape was invalidated by checkEndOfSequence, so at this point we can remove it + delete _canimShapes[idx]; _canimShapes.remove_at(idx); } else if (o._type == REMOVE) { if (_goToScene == -1) screen.slamArea(o._position.x, o._position.y, o._delta.x, o._delta.y); // Shape for an animation is no longer needed, so remove it completely + delete _canimShapes[idx]; _canimShapes.remove_at(idx); } else if (o._type == ACTIVE_BG_SHAPE) { screen.flushImage(o._imageFrame, o._position, @@ -496,6 +503,7 @@ int ScalpelScene::startCAnim(int cAnimNum, int playRate) { int tpDir, walkDir; int tFrames = 0; int gotoCode = -1; + Object *cObj; // Validation if (cAnimNum >= (int)_cAnim.size()) @@ -533,33 +541,33 @@ int ScalpelScene::startCAnim(int cAnimNum, int playRate) { return 1; // Add new anim shape entry for displaying the animation - _canimShapes.push_back(Object()); - Object &cObj = _canimShapes[_canimShapes.size() - 1]; + cObj = new Object(); + _canimShapes.push_back(cObj); // Copy the canimation into the bgShapes type canimation structure so it can be played - cObj._allow = cAnimNum + 1; // Keep track of the parent structure - cObj._name = _cAnim[cAnimNum]._name; // Copy name + cObj->_allow = cAnimNum + 1; // Keep track of the parent structure + cObj->_name = _cAnim[cAnimNum]._name; // Copy name // Remove any attempt to draw object frame if (cAnim._type == NO_SHAPE && cAnim._sequences[0] < 100) cAnim._sequences[0] = 0; - cObj._sequences = cAnim._sequences; - cObj._images = nullptr; - cObj._position = cAnim._position; - cObj._delta = Common::Point(0, 0); - cObj._type = cAnim._type; - cObj._flags = cAnim._flags; - - cObj._maxFrames = 0; - cObj._frameNumber = -1; - cObj._sequenceNumber = cAnimNum; - cObj._oldPosition = Common::Point(0, 0); - cObj._oldSize = Common::Point(0, 0); - cObj._goto = Common::Point(0, 0); - cObj._status = 0; - cObj._misc = 0; - cObj._imageFrame = nullptr; + cObj->_sequences = cAnim._sequences; + cObj->_images = nullptr; + cObj->_position = cAnim._position; + cObj->_delta = Common::Point(0, 0); + cObj->_type = cAnim._type; + cObj->_flags = cAnim._flags; + + cObj->_maxFrames = 0; + cObj->_frameNumber = -1; + cObj->_sequenceNumber = cAnimNum; + cObj->_oldPosition = Common::Point(0, 0); + cObj->_oldSize = Common::Point(0, 0); + cObj->_goto = Common::Point(0, 0); + cObj->_status = 0; + cObj->_misc = 0; + cObj->_imageFrame = nullptr; if (cAnim._name.size() > 0 && cAnim._type != NO_SHAPE) { if (tpPos.x != -1) @@ -584,25 +592,25 @@ int ScalpelScene::startCAnim(int cAnimNum, int playRate) { // Now load the resource as an image if (!IS_3DO) { - cObj._images = new ImageFile(fname); + cObj->_images = new ImageFile(fname); } else { - cObj._images = new ImageFile3DO(fname, kImageFile3DOType_RoomFormat); + cObj->_images = new ImageFile3DO(fname, kImageFile3DOType_RoomFormat); } - cObj._imageFrame = &(*cObj._images)[0]; - cObj._maxFrames = cObj._images->size(); + cObj->_imageFrame = &(*cObj->_images)[0]; + cObj->_maxFrames = cObj->_images->size(); int frames = 0; if (playRate < 0) { // Reverse direction // Count number of frames - while (frames < MAX_FRAME && cObj._sequences[frames]) + while (frames < MAX_FRAME && cObj->_sequences[frames]) ++frames; } else { // Forward direction BaseObject::_countCAnimFrames = true; - while (cObj._type == ACTIVE_BG_SHAPE) { - cObj.checkObject(); + while (cObj->_type == ACTIVE_BG_SHAPE) { + cObj->checkObject(); ++frames; if (frames >= 1000) @@ -614,10 +622,10 @@ int ScalpelScene::startCAnim(int cAnimNum, int playRate) { BaseObject::_countCAnimFrames = false; - cObj._type = cAnim._type; - cObj._frameNumber = -1; - cObj._position = cAnim._position; - cObj._delta = Common::Point(0, 0); + cObj->_type = cAnim._type; + cObj->_frameNumber = -1; + cObj->_position = cAnim._position; + cObj->_delta = Common::Point(0, 0); } // Return if animation has no frames in it @@ -631,7 +639,7 @@ int ScalpelScene::startCAnim(int cAnimNum, int playRate) { if (playRate < 0) { // Play in reverse dir = -2; - cObj._frameNumber = frames - 3; + cObj->_frameNumber = frames - 3; } else { dir = 0; } @@ -648,14 +656,14 @@ int ScalpelScene::startCAnim(int cAnimNum, int playRate) { // Repeat same frame int temp = repeat; while (--temp > 0) { - cObj._frameNumber--; + cObj->_frameNumber--; doBgAnim(); if (_vm->shouldQuit()) return 0; } - cObj._frameNumber += dir; + cObj->_frameNumber += dir; } people[HOLMES]._type = CHARACTER; @@ -670,14 +678,18 @@ int ScalpelScene::startCAnim(int cAnimNum, int playRate) { if (playRate < 0) // Reverse direction - set to end sequence - cObj._frameNumber = tFrames - 1; + cObj->_frameNumber = tFrames - 1; - if (cObj._frameNumber <= 26) - gotoCode = cObj._sequences[cObj._frameNumber + 3]; + if (cObj->_frameNumber <= 26) + gotoCode = cObj->_sequences[cObj->_frameNumber + 3]; - // Unless anim shape has already been freed, set it to REMOVE so doBgAnim can free it - if (_canimShapes.indexOf(cObj) != -1) - cObj.checkObject(); + // Unless anim shape has already been removed, do a final check to allow it to become REMOVEd + for (uint idx = 0; idx < _canimShapes.size(); ++idx) { + if (_canimShapes[idx] == cObj) { + cObj->checkObject(); + break; + } + } if (gotoCode > 0 && !talk._talkToAbort) { _goToScene = gotoCode; diff --git a/engines/sherlock/scalpel/scalpel_scene.h b/engines/sherlock/scalpel/scalpel_scene.h index 8fe3b66b38..8711fea2d0 100644 --- a/engines/sherlock/scalpel/scalpel_scene.h +++ b/engines/sherlock/scalpel/scalpel_scene.h @@ -75,6 +75,8 @@ protected: public: ScalpelScene(SherlockEngine *vm) : Scene(vm) {} + virtual ~ScalpelScene(); + /** * Draw all objects and characters. */ diff --git a/engines/sherlock/scalpel/scalpel_screen.cpp b/engines/sherlock/scalpel/scalpel_screen.cpp index 71bcca5dc5..15e8436be6 100644 --- a/engines/sherlock/scalpel/scalpel_screen.cpp +++ b/engines/sherlock/scalpel/scalpel_screen.cpp @@ -28,313 +28,102 @@ namespace Sherlock { namespace Scalpel { ScalpelScreen::ScalpelScreen(SherlockEngine *vm) : Screen(vm) { + _backBuffer1.create(320, 200); + _backBuffer2.create(320, 200); + activateBackBuffer1(); } void ScalpelScreen::makeButton(const Common::Rect &bounds, int textX, - const Common::String &str) { + const Common::String &buttonText, bool textContainsHotkey) { - Surface &bb = *_backBuffer; + Surface &bb = _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); - gPrint(Common::Point(textX, bounds.top), COMMAND_HIGHLIGHTED, "%c", str[0]); - gPrint(Common::Point(textX + charWidth(str[0]), bounds.top), - COMMAND_FOREGROUND, "%s", str.c_str() + 1); + buttonPrint(Common::Point(textX, bounds.top), COMMAND_FOREGROUND, false, buttonText, textContainsHotkey); } +// ButtonText is supposed to have its hotkey as a prefix. The hotkey will get highlighted. void ScalpelScreen::buttonPrint(const Common::Point &pt, uint color, bool slamIt, - const Common::String &str) { - int xStart = pt.x - stringWidth(str) / 2; + const Common::String &buttonText, bool textContainsHotkey) { + int xStart = pt.x; + int skipTextOffset = textContainsHotkey ? +1 : 0; // skip first char in case text contains hotkey - if (color == COMMAND_FOREGROUND) { - // First character needs to be highlighted - if (slamIt) { - print(Common::Point(xStart, pt.y + 1), COMMAND_HIGHLIGHTED, "%c", str[0]); - print(Common::Point(xStart + charWidth(str[0]), pt.y + 1), - COMMAND_FOREGROUND, "%s", str.c_str() + 1); - } else { - gPrint(Common::Point(xStart, pt.y), COMMAND_HIGHLIGHTED, "%c", str[0]); - gPrint(Common::Point(xStart + charWidth(str[0]), pt.y), - COMMAND_FOREGROUND, "%s", str.c_str() + 1); - } - } else if (slamIt) { - print(Common::Point(xStart, pt.y + 1), color, "%s", str.c_str()); + // Center text around given x-coordinate + if (textContainsHotkey) { + xStart -= (stringWidth(Common::String(buttonText.c_str() + 1)) / 2); } else { - gPrint(Common::Point(xStart, pt.y), color, "%s", str.c_str()); - } -} - -void ScalpelScreen::makePanel(const Common::Rect &r) { - _backBuffer->fillRect(r, BUTTON_MIDDLE); - _backBuffer->hLine(r.left, r.top, r.right - 2, BUTTON_TOP); - _backBuffer->hLine(r.left + 1, r.top + 1, r.right - 3, BUTTON_TOP); - _backBuffer->vLine(r.left, r.top, r.bottom - 1, BUTTON_TOP); - _backBuffer->vLine(r.left + 1, r.top + 1, r.bottom - 2, BUTTON_TOP); - - _backBuffer->vLine(r.right - 1, r.top, r.bottom - 1, BUTTON_BOTTOM); - _backBuffer->vLine(r.right - 2, r.top + 1, r.bottom - 2, BUTTON_BOTTOM); - _backBuffer->hLine(r.left, r.bottom - 1, r.right - 1, BUTTON_BOTTOM); - _backBuffer->hLine(r.left + 1, r.bottom - 2, r.right - 1, BUTTON_BOTTOM); -} - -void ScalpelScreen::makeField(const Common::Rect &r) { - _backBuffer->fillRect(r, BUTTON_MIDDLE); - _backBuffer->hLine(r.left, r.top, r.right - 1, BUTTON_BOTTOM); - _backBuffer->hLine(r.left + 1, r.bottom - 1, r.right - 1, BUTTON_TOP); - _backBuffer->vLine(r.left, r.top + 1, r.bottom - 1, BUTTON_BOTTOM); - _backBuffer->vLine(r.right - 1, r.top + 1, r.bottom - 2, BUTTON_TOP); -} - -/*----------------------------------------------------------------*/ - -void Scalpel3DOScreen::blitFrom(const Graphics::Surface &src, const Common::Point &pt, const Common::Rect &srcBounds) { - if (!_vm->_isScreenDoubled) { - ScalpelScreen::blitFrom(src, pt, srcBounds); - return; - } - - Common::Rect srcRect = srcBounds; - Common::Rect destRect(pt.x, pt.y, pt.x + srcRect.width(), pt.y + srcRect.height()); - - if (!srcRect.isValidRect() || !clip(srcRect, destRect)) - return; - - // Add dirty area remapped to the 640x200 surface - addDirtyRect(Common::Rect(destRect.left * 2, destRect.top * 2, destRect.right * 2, destRect.bottom * 2)); - - // Transfer the area, doubling each pixel - for (int yp = 0; yp < srcRect.height(); ++yp) { - const uint16 *srcP = (const uint16 *)src.getBasePtr(srcRect.left, srcRect.top + yp); - uint16 *destP = (uint16 *)getBasePtr(destRect.left * 2, (destRect.top + yp) * 2); - - for (int xp = srcRect.left; xp < srcRect.right; ++xp, ++srcP, destP += 2) { - *destP = *srcP; - *(destP + 1) = *srcP; - *(destP + 640) = *srcP; - *(destP + 640 + 1) = *srcP; - } - } -} - -void Scalpel3DOScreen::transBlitFromUnscaled(const Graphics::Surface &src, const Common::Point &pt, - bool flipped, int overrideColor) { - if (!_vm->_isScreenDoubled) { - ScalpelScreen::transBlitFromUnscaled(src, pt, flipped, overrideColor); - return; - } - - Common::Rect drawRect(0, 0, src.w, src.h); - Common::Rect destRect(pt.x, pt.y, pt.x + src.w, pt.y + src.h); - - // Clip the display area to on-screen - if (!clip(drawRect, destRect)) - // It's completely off-screen - return; - - if (flipped) - drawRect = Common::Rect(src.w - drawRect.right, src.h - drawRect.bottom, - src.w - drawRect.left, src.h - drawRect.top); - - Common::Point destPt(destRect.left, destRect.top); - addDirtyRect(Common::Rect(destPt.x * 2, destPt.y * 2, (destPt.x + drawRect.width()) * 2, - (destPt.y + drawRect.height()) * 2)); - - assert(src.format.bytesPerPixel == 2 && _surface.format.bytesPerPixel == 2); - - for (int yp = 0; yp < drawRect.height(); ++yp) { - const uint16 *srcP = (const uint16 *)src.getBasePtr( - flipped ? drawRect.right - 1 : drawRect.left, drawRect.top + yp); - uint16 *destP = (uint16 *)getBasePtr(destPt.x * 2, (destPt.y + yp) * 2); - - for (int xp = 0; xp < drawRect.width(); ++xp, destP += 2) { - // RGB 0, 0, 0 -> transparent on 3DO - if (*srcP) { - *destP = *srcP; - *(destP + 1) = *srcP; - *(destP + 640) = *srcP; - *(destP + 640 + 1) = *srcP; - } - - srcP = flipped ? srcP - 1 : srcP + 1; - } + xStart -= (stringWidth(buttonText) / 2); } -} - -void Scalpel3DOScreen::fillRect(const Common::Rect &r, uint color) { - if (_vm->_isScreenDoubled) - ScalpelScreen::fillRect(Common::Rect(r.left * 2, r.top * 2, r.right * 2, r.bottom * 2), color); - else - ScalpelScreen::fillRect(r, color); -} -void Scalpel3DOScreen::fadeIntoScreen3DO(int speed) { - Events &events = *_vm->_events; - uint16 *currentScreenBasePtr = (uint16 *)getPixels(); - uint16 *targetScreenBasePtr = (uint16 *)_backBuffer->getPixels(); - uint16 currentScreenPixel = 0; - uint16 targetScreenPixel = 0; - - uint16 currentScreenPixelRed = 0; - uint16 currentScreenPixelGreen = 0; - uint16 currentScreenPixelBlue = 0; - - uint16 targetScreenPixelRed = 0; - uint16 targetScreenPixelGreen = 0; - uint16 targetScreenPixelBlue = 0; - - uint16 screenWidth = SHERLOCK_SCREEN_WIDTH; - uint16 screenHeight = SHERLOCK_SCREEN_HEIGHT; - uint16 screenX = 0; - uint16 screenY = 0; - uint16 pixelsChanged = 0; - - clearDirtyRects(); - - do { - pixelsChanged = 0; - uint16 *currentScreenPtr = currentScreenBasePtr; - uint16 *targetScreenPtr = targetScreenBasePtr; - - for (screenY = 0; screenY < screenHeight; screenY++) { - for (screenX = 0; screenX < screenWidth; screenX++) { - currentScreenPixel = *currentScreenPtr; - targetScreenPixel = *targetScreenPtr; - - if (currentScreenPixel != targetScreenPixel) { - // pixel doesn't match, adjust accordingly - currentScreenPixelRed = currentScreenPixel & 0xF800; - currentScreenPixelGreen = currentScreenPixel & 0x07E0; - currentScreenPixelBlue = currentScreenPixel & 0x001F; - targetScreenPixelRed = targetScreenPixel & 0xF800; - targetScreenPixelGreen = targetScreenPixel & 0x07E0; - targetScreenPixelBlue = targetScreenPixel & 0x001F; - - if (currentScreenPixelRed != targetScreenPixelRed) { - if (currentScreenPixelRed < targetScreenPixelRed) { - currentScreenPixelRed += 0x0800; - } else { - currentScreenPixelRed -= 0x0800; - } - } - if (currentScreenPixelGreen != targetScreenPixelGreen) { - // Adjust +2/-2 because we are running RGB555 at RGB565 - if (currentScreenPixelGreen < targetScreenPixelGreen) { - currentScreenPixelGreen += 0x0040; - } else { - currentScreenPixelGreen -= 0x0040; - } - } - if (currentScreenPixelBlue != targetScreenPixelBlue) { - if (currentScreenPixelBlue < targetScreenPixelBlue) { - currentScreenPixelBlue += 0x0001; - } else { - currentScreenPixelBlue -= 0x0001; - } - } - - uint16 v = currentScreenPixelRed | currentScreenPixelGreen | currentScreenPixelBlue; - *currentScreenPtr = v; - if (_vm->_isScreenDoubled) { - *(currentScreenPtr + 1) = v; - *(currentScreenPtr + 640) = v; - *(currentScreenPtr + 640 + 1) = v; + if (color == COMMAND_FOREGROUND) { + uint16 prefixOffsetX = 0; + byte hotkey = buttonText[0]; + + // Hotkey needs to be highlighted + if (textContainsHotkey) { + Common::String prefixText = Common::String(buttonText.c_str() + 1); + uint16 prefixTextLen = prefixText.size(); + uint16 prefixTextPos = 0; + + // Hotkey was passed additionally, we search for the hotkey inside the button text and + // remove it from there. We then draw the whole text as highlighted and afterward + // the processed text again as regular text (without the hotkey) + while (prefixTextPos < prefixTextLen) { + if (prefixText[prefixTextPos] == hotkey) { + // Hotkey found, remove remaining text + while (prefixTextPos < prefixText.size()) { + prefixText.deleteLastChar(); } - - pixelsChanged++; + break; } - - currentScreenPtr += _vm->_isScreenDoubled ? 2 : 1; - targetScreenPtr++; + prefixTextPos++; } - if (_vm->_isScreenDoubled) - currentScreenPtr += 640; - } - - // Too much considered dirty at the moment - if (_vm->_isScreenDoubled) - addDirtyRect(Common::Rect(0, 0, screenWidth * 2, screenHeight * 2)); - else - addDirtyRect(Common::Rect(0, 0, screenWidth, screenHeight)); - - events.pollEvents(); - events.delay(10 * speed); - } while ((pixelsChanged) && (!_vm->shouldQuit())); -} - -void Scalpel3DOScreen::blitFrom3DOcolorLimit(uint16 limitColor) { - uint16 *currentScreenPtr = (uint16 *)getPixels(); - uint16 *targetScreenPtr = (uint16 *)_backBuffer->getPixels(); - uint16 currentScreenPixel = 0; - - uint16 screenWidth = SHERLOCK_SCREEN_WIDTH; - uint16 screenHeight = SHERLOCK_SCREEN_HEIGHT; - uint16 screenX = 0; - uint16 screenY = 0; - - uint16 currentScreenPixelRed = 0; - uint16 currentScreenPixelGreen = 0; - uint16 currentScreenPixelBlue = 0; - - uint16 limitPixelRed = limitColor & 0xF800; - uint16 limitPixelGreen = limitColor & 0x07E0; - uint16 limitPixelBlue = limitColor & 0x001F; - - for (screenY = 0; screenY < screenHeight; screenY++) { - for (screenX = 0; screenX < screenWidth; screenX++) { - currentScreenPixel = *targetScreenPtr; - - currentScreenPixelRed = currentScreenPixel & 0xF800; - currentScreenPixelGreen = currentScreenPixel & 0x07E0; - currentScreenPixelBlue = currentScreenPixel & 0x001F; - - if (currentScreenPixelRed < limitPixelRed) - currentScreenPixelRed = limitPixelRed; - if (currentScreenPixelGreen < limitPixelGreen) - currentScreenPixelGreen = limitPixelGreen; - if (currentScreenPixelBlue < limitPixelBlue) - currentScreenPixelBlue = limitPixelBlue; - - uint16 v = currentScreenPixelRed | currentScreenPixelGreen | currentScreenPixelBlue; - *currentScreenPtr = v; - if (_vm->_isScreenDoubled) { - *(currentScreenPtr + 1) = v; - *(currentScreenPtr + 640) = v; - *(currentScreenPtr + 640 + 1) = v; + if (prefixTextPos < prefixTextLen) { + // only adjust in case hotkey character was actually found + prefixOffsetX = stringWidth(prefixText); } - - currentScreenPtr += _vm->_isScreenDoubled ? 2 : 1; - targetScreenPtr++; } - if (_vm->_isScreenDoubled) - currentScreenPtr += 640; + if (slamIt) { + print(Common::Point(xStart, pt.y + 1), + COMMAND_FOREGROUND, "%s", buttonText.c_str() + skipTextOffset); + print(Common::Point(xStart + prefixOffsetX, pt.y + 1), COMMAND_HIGHLIGHTED, "%c", hotkey); + } else { + gPrint(Common::Point(xStart, pt.y), + COMMAND_FOREGROUND, "%s", buttonText.c_str() + skipTextOffset); + gPrint(Common::Point(xStart + prefixOffsetX, pt.y), COMMAND_HIGHLIGHTED, "%c", hotkey); + } + } else if (slamIt) { + print(Common::Point(xStart, pt.y + 1), color, "%s", buttonText.c_str() + skipTextOffset); + } else { + gPrint(Common::Point(xStart, pt.y), color, "%s", buttonText.c_str() + skipTextOffset); } - - // Too much considered dirty at the moment - if (_vm->_isScreenDoubled) - addDirtyRect(Common::Rect(0, 0, screenWidth * 2, screenHeight * 2)); - else - addDirtyRect(Common::Rect(0, 0, screenWidth, screenHeight)); } -uint16 Scalpel3DOScreen::w() const { - return _vm->_isScreenDoubled ? _surface.w / 2 : _surface.w; -} - -uint16 Scalpel3DOScreen::h() const { - return _vm->_isScreenDoubled ? _surface.h / 2 : _surface.h; +void ScalpelScreen::makePanel(const Common::Rect &r) { + _backBuffer.fillRect(r, BUTTON_MIDDLE); + _backBuffer.hLine(r.left, r.top, r.right - 2, BUTTON_TOP); + _backBuffer.hLine(r.left + 1, r.top + 1, r.right - 3, BUTTON_TOP); + _backBuffer.vLine(r.left, r.top, r.bottom - 1, BUTTON_TOP); + _backBuffer.vLine(r.left + 1, r.top + 1, r.bottom - 2, BUTTON_TOP); + + _backBuffer.vLine(r.right - 1, r.top, r.bottom - 1, BUTTON_BOTTOM); + _backBuffer.vLine(r.right - 2, r.top + 1, r.bottom - 2, BUTTON_BOTTOM); + _backBuffer.hLine(r.left, r.bottom - 1, r.right - 1, BUTTON_BOTTOM); + _backBuffer.hLine(r.left + 1, r.bottom - 2, r.right - 1, BUTTON_BOTTOM); } -void Scalpel3DOScreen::rawBlitFrom(const Graphics::Surface &src, const Common::Point &pt) { - Common::Rect srcRect(0, 0, src.w, src.h); - Common::Rect destRect(pt.x, pt.y, pt.x + src.w, pt.y + src.h); - - addDirtyRect(destRect); - _surface.copyRectToSurface(src, destRect.left, destRect.top, srcRect); +void ScalpelScreen::makeField(const Common::Rect &r) { + _backBuffer.fillRect(r, BUTTON_MIDDLE); + _backBuffer.hLine(r.left, r.top, r.right - 1, BUTTON_BOTTOM); + _backBuffer.hLine(r.left + 1, r.bottom - 1, r.right - 1, BUTTON_TOP); + _backBuffer.vLine(r.left, r.top + 1, r.bottom - 1, BUTTON_BOTTOM); + _backBuffer.vLine(r.right - 1, r.top + 1, r.bottom - 2, BUTTON_TOP); } } // End of namespace Scalpel diff --git a/engines/sherlock/scalpel/scalpel_screen.h b/engines/sherlock/scalpel/scalpel_screen.h index d6018a44a0..d9be29c8b2 100644 --- a/engines/sherlock/scalpel/scalpel_screen.h +++ b/engines/sherlock/scalpel/scalpel_screen.h @@ -38,14 +38,16 @@ public: /** * Draws a button for use in the inventory, talk, and examine dialogs. + * ButtonText is supposed to have its hotkey as a prefix. The hotkey will get highlighted. */ - void makeButton(const Common::Rect &bounds, int textX, const Common::String &str); + void makeButton(const Common::Rect &bounds, int textX, const Common::String &buttonText, bool textContainsHotkey = true); /** * Prints an interface command with the first letter highlighted to indicate * what keyboard shortcut is associated with it + * ButtonText is supposed to have its hotkey as a prefix. The hotkey will get highlighted. */ - void buttonPrint(const Common::Point &pt, uint color, bool slamIt, const Common::String &str); + void buttonPrint(const Common::Point &pt, uint color, bool slamIt, const Common::String &buttonText, bool textContainsHotkey = true); /** * Draw a panel in the back buffer with a raised area effect around the edges @@ -59,44 +61,6 @@ public: void makeField(const Common::Rect &r); }; -class Scalpel3DOScreen : public ScalpelScreen { -protected: - /** - * Draws a sub-section of a surface at a given position within this surface - * Overriden for the 3DO to automatically double the size of everything to the underlying 640x400 surface - */ - virtual void blitFrom(const Graphics::Surface &src, const Common::Point &pt, const Common::Rect &srcBounds); - - /** - * Draws a surface at a given position within this surface with transparency - */ - virtual void transBlitFromUnscaled(const Graphics::Surface &src, const Common::Point &pt, bool flipped, - int overrideColor); -public: - Scalpel3DOScreen(SherlockEngine *vm) : ScalpelScreen(vm) {} - virtual ~Scalpel3DOScreen() {} - - /** - * Draws a sub-section of a surface at a given position within this surface - */ - void rawBlitFrom(const Graphics::Surface &src, const Common::Point &pt); - - /** - * Fade backbuffer 1 into screen (3DO RGB!) - */ - void fadeIntoScreen3DO(int speed); - - void blitFrom3DOcolorLimit(uint16 color); - - /** - * Fill a given area of the surface with a given color - */ - virtual void fillRect(const Common::Rect &r, uint color); - - virtual uint16 w() const; - virtual uint16 h() const; -}; - } // End of namespace Scalpel } // End of namespace Sherlock diff --git a/engines/sherlock/scalpel/scalpel_talk.cpp b/engines/sherlock/scalpel/scalpel_talk.cpp index 88a718ea4e..ff38c07537 100644 --- a/engines/sherlock/scalpel/scalpel_talk.cpp +++ b/engines/sherlock/scalpel/scalpel_talk.cpp @@ -22,6 +22,7 @@ #include "sherlock/scalpel/scalpel_talk.h" #include "sherlock/scalpel/scalpel_fixed_text.h" +#include "sherlock/scalpel/scalpel_journal.h" #include "sherlock/scalpel/scalpel_map.h" #include "sherlock/scalpel/scalpel_people.h" #include "sherlock/scalpel/scalpel_scene.h" @@ -169,6 +170,13 @@ ScalpelTalk::ScalpelTalk(SherlockEngine *vm) : Talk(vm) { _opcodes = opcodes; } + _fixedTextWindowExit = FIXED(Window_Exit); + _fixedTextWindowUp = FIXED(Window_Up); + _fixedTextWindowDown = FIXED(Window_Down); + + _hotkeyWindowExit = toupper(_fixedTextWindowExit[0]); + _hotkeyWindowUp = toupper(_fixedTextWindowUp[0]); + _hotkeyWindowDown = toupper(_fixedTextWindowDown[0]); } void ScalpelTalk::talkTo(const Common::String filename) { @@ -184,23 +192,22 @@ void ScalpelTalk::talkTo(const Common::String filename) { } void ScalpelTalk::talkInterface(const byte *&str) { - FixedText &fixedText = *_vm->_fixedText; People &people = *_vm->_people; ScalpelScreen &screen = *(ScalpelScreen *)_vm->_screen; UserInterface &ui = *_vm->_ui; + if (_vm->getLanguage() == Common::DE_DEU) + skipBadText(str); + // If the window isn't yet open, draw the window before printing starts if (!ui._windowOpen && _noTextYet) { _noTextYet = false; drawInterface(); if (_talkTo != -1) { - Common::String fixedText_Exit = fixedText.getText(kFixedText_Window_Exit); - Common::String fixedText_Up = fixedText.getText(kFixedText_Window_Up); - Common::String fixedText_Down = fixedText.getText(kFixedText_Window_Down); - screen.buttonPrint(Common::Point(119, CONTROLS_Y), COMMAND_NULL, false, fixedText_Exit); - screen.buttonPrint(Common::Point(159, CONTROLS_Y), COMMAND_NULL, false, fixedText_Up); - screen.buttonPrint(Common::Point(200, CONTROLS_Y), COMMAND_NULL, false, fixedText_Down); + screen.buttonPrint(Common::Point(119, CONTROLS_Y), COMMAND_NULL, false, _fixedTextWindowExit); + screen.buttonPrint(Common::Point(159, CONTROLS_Y), COMMAND_NULL, false, _fixedTextWindowUp); + screen.buttonPrint(Common::Point(200, CONTROLS_Y), COMMAND_NULL, false, _fixedTextWindowDown); } } @@ -269,7 +276,7 @@ void ScalpelTalk::talkInterface(const byte *&str) { str += idx; // If line wrap occurred, then move to after the separating space between the words - if ((!isOpcode(str[0])) && str[0] != '{') + if (str[0] && (!isOpcode(str[0])) && str[0] != '{') ++str; _yp += 9; @@ -508,7 +515,6 @@ OpcodeReturn ScalpelTalk::cmdSfxCommand(const byte *&str) { OpcodeReturn ScalpelTalk::cmdSummonWindow(const byte *&str) { Events &events = *_vm->_events; - FixedText &fixedText = *_vm->_fixedText; ScalpelScreen &screen = *(ScalpelScreen *)_vm->_screen; drawInterface(); @@ -517,12 +523,9 @@ OpcodeReturn ScalpelTalk::cmdSummonWindow(const byte *&str) { _noTextYet = false; if (_speaker != -1) { - Common::String fixedText_Exit = fixedText.getText(kFixedText_Window_Exit); - Common::String fixedText_Up = fixedText.getText(kFixedText_Window_Up); - Common::String fixedText_Down = fixedText.getText(kFixedText_Window_Down); - screen.buttonPrint(Common::Point(119, CONTROLS_Y), COMMAND_NULL, false, fixedText_Exit); - screen.buttonPrint(Common::Point(159, CONTROLS_Y), COMMAND_NULL, false, fixedText_Up); - screen.buttonPrint(Common::Point(200, CONTROLS_Y), COMMAND_NULL, false, fixedText_Down); + screen.buttonPrint(Common::Point(119, CONTROLS_Y), COMMAND_NULL, false, _fixedTextWindowExit); + screen.buttonPrint(Common::Point(159, CONTROLS_Y), COMMAND_NULL, false, _fixedTextWindowUp); + screen.buttonPrint(Common::Point(200, CONTROLS_Y), COMMAND_NULL, false, _fixedTextWindowDown); } return RET_SUCCESS; @@ -680,9 +683,8 @@ Common::Point ScalpelTalk::get3doPortraitPosition() const { } void ScalpelTalk::drawInterface() { - FixedText &fixedText = *_vm->_fixedText; ScalpelScreen &screen = *(ScalpelScreen *)_vm->_screen; - Surface &bb = *screen._backBuffer; + Surface &bb = *screen.getBackBuffer(); bb.fillRect(Common::Rect(0, CONTROLS_Y, SHERLOCK_SCREEN_WIDTH, CONTROLS_Y1 + 10), BORDER_COLOR); bb.fillRect(Common::Rect(0, CONTROLS_Y + 10, 2, SHERLOCK_SCREEN_HEIGHT), BORDER_COLOR); @@ -694,26 +696,25 @@ void ScalpelTalk::drawInterface() { SHERLOCK_SCREEN_HEIGHT - 2), INV_BACKGROUND); if (_talkTo != -1) { - Common::String fixedText_Exit = fixedText.getText(kFixedText_Window_Exit); - Common::String fixedText_Up = fixedText.getText(kFixedText_Window_Up); - Common::String fixedText_Down = fixedText.getText(kFixedText_Window_Down); + Common::String fixedText_Exit = FIXED(Window_Exit); + Common::String fixedText_Up = FIXED(Window_Up); + Common::String fixedText_Down = FIXED(Window_Down); screen.makeButton(Common::Rect(99, CONTROLS_Y, 139, CONTROLS_Y + 10), - 119 - screen.stringWidth(fixedText_Exit) / 2, fixedText_Exit); + 119, fixedText_Exit); screen.makeButton(Common::Rect(140, CONTROLS_Y, 180, CONTROLS_Y + 10), - 159 - screen.stringWidth(fixedText_Up) / 2, fixedText_Up); + 159, fixedText_Up); screen.makeButton(Common::Rect(181, CONTROLS_Y, 221, CONTROLS_Y + 10), - 200 - screen.stringWidth(fixedText_Down) / 2, fixedText_Down); + 200, fixedText_Down); } else { - int strWidth = screen.stringWidth(Scalpel::PRESS_KEY_TO_CONTINUE); + Common::String fixedText_PressKeyToContinue = FIXED(PressKey_ToContinue); + screen.makeButton(Common::Rect(46, CONTROLS_Y, 273, CONTROLS_Y + 10), - 160 - strWidth / 2, Scalpel::PRESS_KEY_TO_CONTINUE); - screen.gPrint(Common::Point(160 - strWidth / 2, CONTROLS_Y), COMMAND_FOREGROUND, "P"); + 160, fixedText_PressKeyToContinue); } } bool ScalpelTalk::displayTalk(bool slamIt) { - FixedText &fixedText = *_vm->_fixedText; ScalpelScreen &screen = *(ScalpelScreen *)_vm->_screen; int yp = CONTROLS_Y + 14; int lineY = -1; @@ -731,22 +732,20 @@ bool ScalpelTalk::displayTalk(bool slamIt) { } // Display the up arrow and enable Up button if the first option is scrolled off-screen - Common::String fixedText_Up = fixedText.getText(kFixedText_Window_Up); - Common::String fixedText_Down = fixedText.getText(kFixedText_Window_Down); if (_moreTalkUp) { if (slamIt) { screen.print(Common::Point(5, CONTROLS_Y + 13), INV_FOREGROUND, "~"); - screen.buttonPrint(Common::Point(159, CONTROLS_Y), COMMAND_FOREGROUND, true, fixedText_Up); + screen.buttonPrint(Common::Point(159, CONTROLS_Y), COMMAND_FOREGROUND, true, _fixedTextWindowUp); } else { screen.gPrint(Common::Point(5, CONTROLS_Y + 12), INV_FOREGROUND, "~"); - screen.buttonPrint(Common::Point(159, CONTROLS_Y), COMMAND_FOREGROUND, false, fixedText_Up); + screen.buttonPrint(Common::Point(159, CONTROLS_Y), COMMAND_FOREGROUND, false, _fixedTextWindowUp); } } else { if (slamIt) { - screen.buttonPrint(Common::Point(159, CONTROLS_Y), COMMAND_NULL, true, fixedText_Up); + screen.buttonPrint(Common::Point(159, CONTROLS_Y), COMMAND_NULL, true, _fixedTextWindowUp); screen.vgaBar(Common::Rect(5, CONTROLS_Y + 11, 15, CONTROLS_Y + 22), INV_BACKGROUND); } else { - screen.buttonPrint(Common::Point(159, CONTROLS_Y), COMMAND_NULL, false, fixedText_Up); + screen.buttonPrint(Common::Point(159, CONTROLS_Y), COMMAND_NULL, false, _fixedTextWindowUp); screen._backBuffer1.fillRect(Common::Rect(5, CONTROLS_Y + 11, 15, CONTROLS_Y + 22), INV_BACKGROUND); } @@ -781,17 +780,17 @@ bool ScalpelTalk::displayTalk(bool slamIt) { if (slamIt) { screen.print(Common::Point(5, 190), INV_FOREGROUND, "|"); - screen.buttonPrint(Common::Point(200, CONTROLS_Y), COMMAND_FOREGROUND, true, fixedText_Down); + screen.buttonPrint(Common::Point(200, CONTROLS_Y), COMMAND_FOREGROUND, true, _fixedTextWindowDown); } else { screen.gPrint(Common::Point(5, 189), INV_FOREGROUND, "|"); - screen.buttonPrint(Common::Point(200, CONTROLS_Y), COMMAND_FOREGROUND, false, fixedText_Down); + screen.buttonPrint(Common::Point(200, CONTROLS_Y), COMMAND_FOREGROUND, false, _fixedTextWindowDown); } } else { if (slamIt) { - screen.buttonPrint(Common::Point(200, CONTROLS_Y), COMMAND_NULL, true, fixedText_Down); + screen.buttonPrint(Common::Point(200, CONTROLS_Y), COMMAND_NULL, true, _fixedTextWindowDown); screen.vgaBar(Common::Rect(5, 189, 16, 199), INV_BACKGROUND); } else { - screen.buttonPrint(Common::Point(200, CONTROLS_Y), COMMAND_NULL, false, fixedText_Down); + screen.buttonPrint(Common::Point(200, CONTROLS_Y), COMMAND_NULL, false, _fixedTextWindowDown); screen._backBuffer1.fillRect(Common::Rect(5, 189, 16, 199), INV_BACKGROUND); } } @@ -888,11 +887,9 @@ int ScalpelTalk::talkLine(int lineNum, int stateNum, byte color, int lineY, bool } void ScalpelTalk::showTalk() { - FixedText &fixedText = *_vm->_fixedText; People &people = *_vm->_people; ScalpelScreen &screen = *(ScalpelScreen *)_vm->_screen; ScalpelUserInterface &ui = *(ScalpelUserInterface *)_vm->_ui; - Common::String fixedText_Exit = fixedText.getText(kFixedText_Window_Exit); byte color = ui._endKeyActive ? COMMAND_FOREGROUND : COMMAND_NULL; clearSequences(); @@ -912,9 +909,9 @@ void ScalpelTalk::showTalk() { // If the window is already open, simply draw. Otherwise, do it // to the back buffer and then summon the window if (ui._windowOpen) { - screen.buttonPrint(Common::Point(119, CONTROLS_Y), color, true, fixedText_Exit); + screen.buttonPrint(Common::Point(119, CONTROLS_Y), color, true, _fixedTextWindowExit); } else { - screen.buttonPrint(Common::Point(119, CONTROLS_Y), color, false, fixedText_Exit); + screen.buttonPrint(Common::Point(119, CONTROLS_Y), color, false, _fixedTextWindowExit); if (!ui._slideWindows) { screen.slamRect(Common::Rect(0, CONTROLS_Y, @@ -1006,6 +1003,14 @@ void ScalpelTalk::clearSequences() { _sequenceStack.clear(); } +void ScalpelTalk::skipBadText(const byte *&msgP) { + // WORKAROUND: Skip over bad text in the original game + const char *BAD_PHRASE1 = "Change Speaker to Sherlock Holmes "; + + if (!strncmp((const char *)msgP, BAD_PHRASE1, strlen(BAD_PHRASE1))) + msgP += strlen(BAD_PHRASE1); +} + } // End of namespace Scalpel } // End of namespace Sherlock diff --git a/engines/sherlock/scalpel/scalpel_talk.h b/engines/sherlock/scalpel/scalpel_talk.h index 4d54273f4a..e542331ce6 100644 --- a/engines/sherlock/scalpel/scalpel_talk.h +++ b/engines/sherlock/scalpel/scalpel_talk.h @@ -88,6 +88,14 @@ public: ScalpelTalk(SherlockEngine *vm); virtual ~ScalpelTalk() {} + Common::String _fixedTextWindowExit; + Common::String _fixedTextWindowUp; + Common::String _fixedTextWindowDown; + + byte _hotkeyWindowExit; + byte _hotkeyWindowUp; + byte _hotkeyWindowDown; + /** * Opens the talk file 'talk.tlk' and searches the index for the specified * conversation. If found, the data for that conversation is loaded @@ -132,6 +140,11 @@ public: bool talk3DOMovieTrigger(int subIndex); /** + * Handles skipping over bad text in conversations + */ + static void skipBadText(const byte *&msgP); + + /** * Push the details of a passed object onto the saved sequences stack */ virtual void pushSequenceEntry(Object *obj); @@ -145,7 +158,7 @@ public: /** * Returns true if the script stack is empty */ - virtual bool isSequencesEmpty() const { return _scriptStack.empty(); } + virtual bool isSequencesEmpty() const { return _sequenceStack.empty(); } /** * Clears the stack of pending object sequences associated with speakers in the scene diff --git a/engines/sherlock/scalpel/scalpel_user_interface.cpp b/engines/sherlock/scalpel/scalpel_user_interface.cpp index be8f1aaa0c..8dae24ecd4 100644 --- a/engines/sherlock/scalpel/scalpel_user_interface.cpp +++ b/engines/sherlock/scalpel/scalpel_user_interface.cpp @@ -64,11 +64,6 @@ const int INVENTORY_POINTS[8][3] = { { 285, 315, 294 } }; -const char COMMANDS[13] = "LMTPOCIUGJFS"; -const char COMMANDS_3DO[13] = "LMTPOCIUGSFF"; -const char INVENTORY_COMMANDS[9] = { "ELUG-+,." }; -const char *const PRESS_KEY_FOR_MORE = "Press any Key for More."; -const char *const PRESS_KEY_TO_CONTINUE = "Press any Key to Continue."; const int UI_OFFSET_3DO = 16; // (320 - 288) / 2 /*----------------------------------------------------------------*/ @@ -101,6 +96,43 @@ ScalpelUserInterface::ScalpelUserInterface(SherlockEngine *vm): UserInterface(vm _cNum = 0; _find = 0; _oldUse = 0; + + // Set up hotkeys + Common::String gameHotkeys = FIXED(Game_Hotkeys); + + memset(_hotkeysIndexed, 0, sizeof(_hotkeysIndexed)); + assert(gameHotkeys.size() <= sizeof(_hotkeysIndexed)); + memcpy(_hotkeysIndexed, gameHotkeys.c_str(), gameHotkeys.size()); + + _hotkeyLook = gameHotkeys[0]; + _hotkeyMove = gameHotkeys[1]; + _hotkeyTalk = gameHotkeys[2]; + _hotkeyPickUp = gameHotkeys[3]; + _hotkeyOpen = gameHotkeys[4]; + _hotkeyClose = gameHotkeys[5]; + _hotkeyInventory = gameHotkeys[6]; + _hotkeyUse = gameHotkeys[7]; + _hotkeyGive = gameHotkeys[8]; + _hotkeyJournal = gameHotkeys[9]; + _hotkeyFiles = gameHotkeys[10]; + _hotkeySetUp = gameHotkeys[11]; + _hotkeyLoadGame = 0; + _hotkeySaveGame = 0; + + if (IS_3DO) { + // 3DO doesn't have a Journal nor a Files button + // Instead it has the setup button in place of the journal + // and also "Load" and "Save" buttons underneath it. + _hotkeyJournal = 0; + _hotkeyFiles = 0; + _hotkeyLoadGame = 'A'; // "S" already used for SetUp + _hotkeySaveGame = 'V'; // ditto + + _hotkeysIndexed[MAINBUTTON_JOURNAL] = 0; + _hotkeysIndexed[MAINBUTTON_FILES] = 0; + _hotkeysIndexed[MAINBUTTON_LOADGAME] = 'A'; + _hotkeysIndexed[MAINBUTTON_SAVEGAME] = 'V'; + } } ScalpelUserInterface::~ScalpelUserInterface() { @@ -116,23 +148,24 @@ void ScalpelUserInterface::reset() { void ScalpelUserInterface::drawInterface(int bufferNum) { Screen &screen = *_vm->_screen; - const ImageFrame &src = (*_controlPanel)[0]; + const Graphics::Surface &src = (*_controlPanel)[0]._frame; int16 x = (!IS_3DO) ? 0 : UI_OFFSET_3DO; if (bufferNum & 1) { if (IS_3DO) screen._backBuffer1.fillRect(Common::Rect(0, CONTROLS_Y, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT), BLACK); - screen._backBuffer1.transBlitFrom(src, Common::Point(x, CONTROLS_Y)); + screen._backBuffer1.SHtransBlitFrom(src, Common::Point(x, CONTROLS_Y)); } if (bufferNum & 2) { if (IS_3DO) screen._backBuffer2.fillRect(Common::Rect(0, CONTROLS_Y, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT), BLACK); - screen._backBuffer2.transBlitFrom(src, Common::Point(x, CONTROLS_Y)); + screen._backBuffer2.SHtransBlitFrom(src, Common::Point(x, CONTROLS_Y)); } if (bufferNum == 3) - screen._backBuffer2.fillRect(0, INFO_LINE, SHERLOCK_SCREEN_WIDTH, INFO_LINE + 10, INFO_BLACK); + screen._backBuffer2.SHfillRect(Common::Rect(0, INFO_LINE, + SHERLOCK_SCREEN_WIDTH, INFO_LINE + 10), INFO_BLACK); } void ScalpelUserInterface::handleInput() { @@ -394,7 +427,7 @@ void ScalpelUserInterface::depressButton(int num) { offsetButton3DO(pt, num); ImageFrame &frame = (*_controls)[num]; - screen._backBuffer1.transBlitFrom(frame, pt); + screen._backBuffer1.SHtransBlitFrom(frame, pt); screen.slamArea(pt.x, pt.y, pt.x + frame._width, pt.y + frame._height); } @@ -410,7 +443,7 @@ void ScalpelUserInterface::restoreButton(int num) { events.setCursor(ARROW); // Restore the UI on the back buffer - screen._backBuffer1.blitFrom(screen._backBuffer2, pt, + screen._backBuffer1.SHblitFrom(screen._backBuffer2, pt, Common::Rect(pt.x, pt.y, pt.x + 90, pt.y + 19)); screen.slamArea(pt.x, pt.y, pt.x + frame.w, pt.y + frame.h); @@ -437,12 +470,13 @@ void ScalpelUserInterface::pushButton(int num) { restoreButton(num); } -void ScalpelUserInterface::toggleButton(int num) { +void ScalpelUserInterface::toggleButton(uint16 num) { Screen &screen = *_vm->_screen; if (_menuMode != (MenuMode)(num + 1)) { _menuMode = (MenuMode)(num + 1); - _oldKey = COMMANDS[num]; + assert(num < sizeof(_hotkeysIndexed)); + _oldKey = _hotkeysIndexed[num]; _oldTemp = num; if (_keyboardInput) { @@ -456,7 +490,7 @@ void ScalpelUserInterface::toggleButton(int num) { ImageFrame &frame = (*_controls)[num]; Common::Point pt(MENU_POINTS[num][0], MENU_POINTS[num][1]); offsetButton3DO(pt, num); - screen._backBuffer1.transBlitFrom(frame, pt); + screen._backBuffer1.SHtransBlitFrom(frame, pt); screen.slamArea(pt.x, pt.y, pt.x + frame._width, pt.y + frame._height); } } else { @@ -468,7 +502,7 @@ void ScalpelUserInterface::toggleButton(int num) { void ScalpelUserInterface::clearInfo() { if (_infoFlag) { - _vm->_screen->vgaBar(Common::Rect(IS_3DO ? 33 : 16, INFO_LINE, + _vm->_screen->vgaBar(Common::Rect(IS_3DO ? 33 : 16, INFO_LINE, SHERLOCK_SCREEN_WIDTH - (IS_3DO ? 33 : 19), INFO_LINE + 10), INFO_BLACK); _infoFlag = false; _oldLook = -1; @@ -572,74 +606,92 @@ void ScalpelUserInterface::lookScreen(const Common::Point &pt) { // If inventory is active and an item is selected for a Use or Give action if ((_menuMode == INV_MODE || _menuMode == USE_MODE || _menuMode == GIVE_MODE) && (inv._invMode == INVMODE_USE || inv._invMode == INVMODE_GIVE)) { - int width1 = 0, width2 = 0; - int x, width; + int width1 = 0, width2 = 0, width3 = 0; + int x; + if (inv._invMode == INVMODE_USE) { // Using an object - x = width = screen.stringWidth("Use "); + Common::String useText1 = FIXED(UserInterface_Use); + Common::String useText2; + Common::String useText3; - if (temp < 1000 && scene._bgShapes[temp]._aType != PERSON) - // It's not a person, so make it lowercase - tempStr.setChar(tolower(tempStr[0]), 0); + x = width1 = screen.stringWidth(useText1); - x += screen.stringWidth(tempStr); + if (temp < 1000 && scene._bgShapes[temp]._aType != PERSON) { + // It's not a person, so make it lowercase + switch (_vm->getLanguage()) { + case Common::DE_DEU: + case Common::ES_ESP: + // don't do this for German + Spanish version + break; + default: + tempStr.setChar(tolower(tempStr[0]), 0); + break; + } + } // If we're using an inventory object, add in the width // of the object name and the " on " if (_selector != -1) { - width1 = screen.stringWidth(inv[_selector]._name); - x += width1; - width2 = screen.stringWidth(" on "); + useText2 = inv[_selector]._name; + width2 = screen.stringWidth(useText2); x += width2; + + useText3 = Common::String::format(FIXED(UserInterface_UseOn), tempStr.c_str()); + + } else { + useText3 = tempStr; } + width3 = screen.stringWidth(useText3); + x += width3; + // If the line will be too long, keep cutting off characters // until the string will fit while (x > 280) { - x -= screen.charWidth(tempStr.lastChar()); - tempStr.deleteLastChar(); + x -= screen.charWidth(useText3.lastChar()); + useText3.deleteLastChar(); } int xStart = (SHERLOCK_SCREEN_WIDTH - x) / 2; screen.print(Common::Point(xStart, INFO_LINE + 1), - INFO_FOREGROUND, "Use "); + INFO_FOREGROUND, "%s", useText1.c_str()); if (_selector != -1) { - screen.print(Common::Point(xStart + width, INFO_LINE + 1), - TALK_FOREGROUND, "%s", inv[_selector]._name.c_str()); - screen.print(Common::Point(xStart + width + width1, INFO_LINE + 1), - INFO_FOREGROUND, " on "); - screen.print(Common::Point(xStart + width + width1 + width2, INFO_LINE + 1), - INFO_FOREGROUND, "%s", tempStr.c_str()); + screen.print(Common::Point(xStart + width1, INFO_LINE + 1), + TALK_FOREGROUND, "%s", useText2.c_str()); + screen.print(Common::Point(xStart + width1 + width2, INFO_LINE + 1), + INFO_FOREGROUND, "%s", useText3.c_str()); } else { - screen.print(Common::Point(xStart + width, INFO_LINE + 1), - INFO_FOREGROUND, "%s", tempStr.c_str()); + screen.print(Common::Point(xStart + width1, INFO_LINE + 1), + INFO_FOREGROUND, "%s", useText3.c_str()); } } else if (temp >= 0 && temp < 1000 && _selector != -1 && scene._bgShapes[temp]._aType == PERSON) { + Common::String giveText1 = FIXED(UserInterface_Give); + Common::String giveText2 = inv[_selector]._name; + Common::String giveText3 = Common::String::format(FIXED(UserInterface_GiveTo), tempStr.c_str()); + // Giving an object to a person - width1 = screen.stringWidth(inv[_selector]._name); - x = width = screen.stringWidth("Give "); - x += width1; - width2 = screen.stringWidth(" to "); + x = width1 = screen.stringWidth(giveText1); + width2 = screen.stringWidth(giveText2); x += width2; - x += screen.stringWidth(tempStr); + width3 = screen.stringWidth(giveText3); + x += width3; // Ensure string will fit on-screen while (x > 280) { - x -= screen.charWidth(tempStr.lastChar()); - tempStr.deleteLastChar(); + x -= screen.charWidth(giveText3.lastChar()); + giveText3.deleteLastChar(); } int xStart = (SHERLOCK_SCREEN_WIDTH - x) / 2; screen.print(Common::Point(xStart, INFO_LINE + 1), - INFO_FOREGROUND, "Give "); - screen.print(Common::Point(xStart + width, INFO_LINE + 1), - TALK_FOREGROUND, "%s", inv[_selector]._name.c_str()); - screen.print(Common::Point(xStart + width + width1, INFO_LINE + 1), - INFO_FOREGROUND, " to "); - screen.print(Common::Point(xStart + width + width1 + width2, INFO_LINE + 1), - INFO_FOREGROUND, "%s", tempStr.c_str()); + INFO_FOREGROUND, "%s", giveText1.c_str()); + screen.print(Common::Point(xStart + width1, INFO_LINE + 1), + TALK_FOREGROUND, "%s", giveText2.c_str()); + screen.print(Common::Point(xStart + width1 + width2, INFO_LINE + 1), + INFO_FOREGROUND, "%s", giveText3.c_str()); } } else { screen.print(Common::Point(0, INFO_LINE + 1), INFO_FOREGROUND, "%s", tempStr.c_str()); @@ -686,7 +738,6 @@ void ScalpelUserInterface::doEnvControl() { ScalpelScreen &screen = *(ScalpelScreen *)_vm->_screen; Talk &talk = *_vm->_talk; Common::Point mousePos = events.mousePos(); - static const char ENV_COMMANDS[7] = "ELSUDQ"; byte color; @@ -725,15 +776,15 @@ void ScalpelUserInterface::doEnvControl() { // Escape _key will close the dialog if (_key == Common::KEYCODE_ESCAPE) - _key = 'E'; + _key = saves._hotkeyExit; + + int buttonIndex = saves.identifyUserButton(_key); - if (_key == 'E' || _key == 'L' || _key == 'S' || _key == 'U' || _key == 'D' || _key == 'Q') { - const char *chP = strchr(ENV_COMMANDS, _key); - int btnIndex = !chP ? -1 : chP - ENV_COMMANDS; - saves.highlightButtons(btnIndex); + if ((buttonIndex >= 0) || (_key >= '1' && _key <= '9')) { + saves.highlightButtons(buttonIndex); _keyboardInput = true; - if (_key == 'E' || _key == 'Q') { + if (_key == saves._hotkeyExit || _key == saves._hotkeyQuit) { saves._envMode = SAVEMODE_NONE; } else if (_key >= '1' && _key <= '9') { _keyboardInput = true; @@ -768,25 +819,25 @@ void ScalpelUserInterface::doEnvControl() { } if (events._released || _keyboardInput) { - if ((found == 0 && events._released) || _key == 'E') { + if ((found == 0 && events._released) || _key == saves._hotkeyExit) { banishWindow(); _windowBounds.top = CONTROLS_Y1; events._pressed = events._released = _keyboardInput = false; _keyPress = '\0'; - } else if ((found == 1 && events._released) || _key == 'L') { + } else if ((found == 1 && events._released) || _key == saves._hotkeyLoad) { saves._envMode = SAVEMODE_LOAD; if (_selector != -1) { - saves.loadGame(_selector + 1); + saves.loadGame(_selector); } - } else if ((found == 2 && events._released) || _key == 'S') { + } else if ((found == 2 && events._released) || _key == saves._hotkeySave) { saves._envMode = SAVEMODE_SAVE; if (_selector != -1) { if (saves.checkGameOnScreen(_selector)) _oldSelector = _selector; if (saves.promptForDescription(_selector)) { - saves.saveGame(_selector + 1, saves._savegames[_selector]); + saves.saveGame(_selector, saves._savegames[_selector]); banishWindow(1); _windowBounds.top = CONTROLS_Y1; @@ -807,7 +858,7 @@ void ScalpelUserInterface::doEnvControl() { } } } - } else if (((found == 3 && events._released) || _key == 'U') && saves._savegameIndex) { + } else if (((found == 3 && events._released) || _key == saves._hotkeyUp) && saves._savegameIndex) { bool moreKeys; do { saves._savegameIndex--; @@ -826,9 +877,9 @@ void ScalpelUserInterface::doEnvControl() { screen.slamRect(Common::Rect(3, CONTROLS_Y + 11, SHERLOCK_SCREEN_WIDTH - 2, SHERLOCK_SCREEN_HEIGHT)); color = !saves._savegameIndex ? COMMAND_NULL : COMMAND_FOREGROUND; - screen.buttonPrint(Common::Point(ENV_POINTS[3][2], CONTROLS_Y), color, true, "Up"); + screen.buttonPrint(Common::Point(ENV_POINTS[3][2], CONTROLS_Y), color, true, saves._fixedTextUp); color = (saves._savegameIndex == MAX_SAVEGAME_SLOTS - ONSCREEN_FILES_COUNT) ? COMMAND_NULL : COMMAND_FOREGROUND; - screen.buttonPrint(Common::Point(ENV_POINTS[4][2], CONTROLS_Y), color, true, "Down"); + screen.buttonPrint(Common::Point(ENV_POINTS[4][2], CONTROLS_Y), color, true, saves._fixedTextDown); // Check whether there are more pending U keys pressed moreKeys = false; @@ -836,10 +887,10 @@ void ScalpelUserInterface::doEnvControl() { Common::KeyState keyState = events.getKey(); _key = toupper(keyState.keycode); - moreKeys = _key == 'U'; + moreKeys = _key == saves._hotkeyUp; } } while ((saves._savegameIndex) && moreKeys); - } else if (((found == 4 && events._released) || _key == 'D') && saves._savegameIndex < (MAX_SAVEGAME_SLOTS - ONSCREEN_FILES_COUNT)) { + } else if (((found == 4 && events._released) || _key == saves._hotkeyDown) && saves._savegameIndex < (MAX_SAVEGAME_SLOTS - ONSCREEN_FILES_COUNT)) { bool moreKeys; do { saves._savegameIndex++; @@ -861,10 +912,10 @@ void ScalpelUserInterface::doEnvControl() { screen.slamRect(Common::Rect(3, CONTROLS_Y + 11, SHERLOCK_SCREEN_WIDTH - 2, SHERLOCK_SCREEN_HEIGHT)); color = (!saves._savegameIndex) ? COMMAND_NULL : COMMAND_FOREGROUND; - screen.buttonPrint(Common::Point(ENV_POINTS[3][2], CONTROLS_Y), color, true, "Up"); + screen.buttonPrint(Common::Point(ENV_POINTS[3][2], CONTROLS_Y), color, true, saves._fixedTextUp); color = (saves._savegameIndex == MAX_SAVEGAME_SLOTS - ONSCREEN_FILES_COUNT) ? COMMAND_NULL : COMMAND_FOREGROUND; - screen.buttonPrint(Common::Point(ENV_POINTS[4][2], CONTROLS_Y), color, true, "Down"); + screen.buttonPrint(Common::Point(ENV_POINTS[4][2], CONTROLS_Y), color, true, saves._fixedTextDown); // Check whether there are more pending D keys pressed moreKeys = false; @@ -872,16 +923,16 @@ void ScalpelUserInterface::doEnvControl() { Common::KeyState keyState = events.getKey(); _key = toupper(keyState.keycode); - moreKeys = _key == 'D'; + moreKeys = _key == saves._hotkeyDown; } } while (saves._savegameIndex < (MAX_SAVEGAME_SLOTS - ONSCREEN_FILES_COUNT) && moreKeys); - } else if ((found == 5 && events._released) || _key == 'Q') { + } else if ((found == 5 && events._released) || _key == saves._hotkeyQuit) { clearWindow(); - screen.print(Common::Point(0, CONTROLS_Y + 20), INV_FOREGROUND, "Are you sure you wish to Quit ?"); + screen.print(Common::Point(0, CONTROLS_Y + 20), INV_FOREGROUND, "%s", saves._fixedTextQuitGameQuestion.c_str()); screen.vgaBar(Common::Rect(0, CONTROLS_Y, SHERLOCK_SCREEN_WIDTH, CONTROLS_Y + 10), BORDER_COLOR); - screen.makeButton(Common::Rect(112, CONTROLS_Y, 160, CONTROLS_Y + 10), 136 - screen.stringWidth("Yes") / 2, "Yes"); - screen.makeButton(Common::Rect(161, CONTROLS_Y, 209, CONTROLS_Y + 10), 184 - screen.stringWidth("No") / 2, "No"); + screen.makeButton(Common::Rect(112, CONTROLS_Y, 160, CONTROLS_Y + 10), 136, saves._fixedTextQuitGameYes); + screen.makeButton(Common::Rect(161, CONTROLS_Y, 209, CONTROLS_Y + 10), 184, saves._fixedTextQuitGameNo); screen.slamArea(112, CONTROLS_Y, 97, 10); do { @@ -905,7 +956,7 @@ void ScalpelUserInterface::doEnvControl() { } if (_key == Common::KEYCODE_ESCAPE) - _key = 'N'; + _key = saves._hotkeyQuitGameNo; if (_key == Common::KEYCODE_RETURN || _key == ' ') { events._pressed = false; @@ -920,28 +971,28 @@ void ScalpelUserInterface::doEnvControl() { color = COMMAND_HIGHLIGHTED; else color = COMMAND_FOREGROUND; - screen.buttonPrint(Common::Point(136, CONTROLS_Y), color, true, "Yes"); + screen.buttonPrint(Common::Point(136, CONTROLS_Y), color, true, saves._fixedTextQuitGameYes); if (mousePos.x > 161 && mousePos.x < 208 && mousePos.y > CONTROLS_Y && mousePos.y < (CONTROLS_Y + 9)) color = COMMAND_HIGHLIGHTED; else color = COMMAND_FOREGROUND; - screen.buttonPrint(Common::Point(184, CONTROLS_Y), color, true, "No"); + screen.buttonPrint(Common::Point(184, CONTROLS_Y), color, true, saves._fixedTextQuitGameNo); } if (mousePos.x > 112 && mousePos.x < 159 && mousePos.y > CONTROLS_Y && mousePos.y < (CONTROLS_Y + 9) && events._released) - _key = 'Y'; + _key = saves._hotkeyQuitGameYes; if (mousePos.x > 161 && mousePos.x < 208 && mousePos.y > CONTROLS_Y && mousePos.y < (CONTROLS_Y + 9) && events._released) - _key = 'N'; - } while (!_vm->shouldQuit() && _key != 'Y' && _key != 'N'); + _key = saves._hotkeyQuitGameNo; + } while (!_vm->shouldQuit() && _key != saves._hotkeyQuitGameYes && _key != saves._hotkeyQuitGameNo); - if (_key == 'Y') { + if (_key == saves._hotkeyQuitGameYes) { _vm->quitGame(); events.pollEvents(); return; } else { - screen.buttonPrint(Common::Point(184, CONTROLS_Y), COMMAND_HIGHLIGHTED, true, "No"); + screen.buttonPrint(Common::Point(184, CONTROLS_Y), COMMAND_HIGHLIGHTED, true, saves._fixedTextQuitGameNo); banishWindow(1); _windowBounds.top = CONTROLS_Y1; _key = -1; @@ -950,14 +1001,14 @@ void ScalpelUserInterface::doEnvControl() { if (_selector != -1) { // Are we already in Load mode? if (saves._envMode == SAVEMODE_LOAD) { - saves.loadGame(_selector + 1); + saves.loadGame(_selector); } else if (saves._envMode == SAVEMODE_SAVE || saves.isSlotEmpty(_selector)) { // We're already in save mode, or pointing to an empty save slot if (saves.checkGameOnScreen(_selector)) _oldSelector = _selector; if (saves.promptForDescription(_selector)) { - saves.saveGame(_selector + 1, saves._savegames[_selector]); + saves.saveGame(_selector, saves._savegames[_selector]); banishWindow(); _windowBounds.top = CONTROLS_Y1; _key = _oldKey = -1; @@ -983,7 +1034,6 @@ void ScalpelUserInterface::doEnvControl() { void ScalpelUserInterface::doInvControl() { Events &events = *_vm->_events; - FixedText &fixedText = *_vm->_fixedText; ScalpelInventory &inv = *(ScalpelInventory *)_vm->_inventory; Scene &scene = *_vm->_scene; ScalpelScreen &screen = *(ScalpelScreen *)_vm->_screen; @@ -1009,20 +1059,15 @@ void ScalpelUserInterface::doInvControl() { if (events._pressed || events._released) { events.clearKeyboard(); - Common::String fixedText_Exit = fixedText.getText(kFixedText_Inventory_Exit); - Common::String fixedText_Look = fixedText.getText(kFixedText_Inventory_Look); - Common::String fixedText_Use = fixedText.getText(kFixedText_Inventory_Use); - Common::String fixedText_Give = fixedText.getText(kFixedText_Inventory_Give); - if (found != -1) // If a slot highlighted, set its color colors[found] = COMMAND_HIGHLIGHTED; - screen.buttonPrint(Common::Point(INVENTORY_POINTS[0][2], CONTROLS_Y1), colors[0], true, fixedText_Exit); + screen.buttonPrint(Common::Point(INVENTORY_POINTS[0][2], CONTROLS_Y1), colors[0], true, inv._fixedTextExit); if (found >= 0 && found <= 3) { - screen.buttonPrint(Common::Point(INVENTORY_POINTS[1][2], CONTROLS_Y1), colors[1], true, fixedText_Look); - screen.buttonPrint(Common::Point(INVENTORY_POINTS[2][2], CONTROLS_Y1), colors[2], true, fixedText_Use); - screen.buttonPrint(Common::Point(INVENTORY_POINTS[3][2], CONTROLS_Y1), colors[3], true, fixedText_Give); + screen.buttonPrint(Common::Point(INVENTORY_POINTS[1][2], CONTROLS_Y1), colors[1], true, inv._fixedTextLook); + screen.buttonPrint(Common::Point(INVENTORY_POINTS[2][2], CONTROLS_Y1), colors[2], true, inv._fixedTextUse); + screen.buttonPrint(Common::Point(INVENTORY_POINTS[3][2], CONTROLS_Y1), colors[3], true, inv._fixedTextGive); inv._invMode = (InvMode)found; _selector = -1; } @@ -1056,19 +1101,19 @@ void ScalpelUserInterface::doInvControl() { if (_key == Common::KEYCODE_ESCAPE) // Escape will also 'E'xit out of inventory display - _key = 'E'; + _key = inv._hotkeyExit; - if (_key == 'E' || _key == 'L' || _key == 'U' || _key == 'G' - || _key == '-' || _key == '+') { + int buttonIndex = inv.identifyUserButton(_key); + + if ((buttonIndex >= 0) && (buttonIndex <= 5)) { InvMode temp = inv._invMode; - const char *chP = strchr(INVENTORY_COMMANDS, _key); - inv._invMode = !chP ? INVMODE_INVALID : (InvMode)(chP - INVENTORY_COMMANDS); + inv._invMode = (InvMode)buttonIndex; inv.invCommands(true); inv._invMode = temp; _keyboardInput = true; - if (_key == 'E') + if (_key == inv._hotkeyExit) inv._invMode = INVMODE_EXIT; _selector = -1; } else { @@ -1090,7 +1135,7 @@ void ScalpelUserInterface::doInvControl() { } if (events._released || _keyboardInput) { - if ((found == 0 && events._released) || _key == 'E') { + if ((found == 0 && events._released) || _key == inv._hotkeyExit) { inv.freeInv(); _infoFlag = true; clearInfo(); @@ -1098,11 +1143,11 @@ void ScalpelUserInterface::doInvControl() { _key = -1; events.clearEvents(); events.setCursor(ARROW); - } else if ((found == 1 && events._released) || (_key == 'L')) { + } else if ((found == 1 && events._released) || (_key == inv._hotkeyLook)) { inv._invMode = INVMODE_LOOK; - } else if ((found == 2 && events._released) || (_key == 'U')) { + } else if ((found == 2 && events._released) || (_key == inv._hotkeyUse)) { inv._invMode = INVMODE_USE; - } else if ((found == 3 && events._released) || (_key == 'G')) { + } else if ((found == 3 && events._released) || (_key == inv._hotkeyGive)) { inv._invMode = INVMODE_GIVE; } else if (((found == 4 && events._released) || _key == ',') && inv._invIndex) { if (inv._invIndex >= 6) @@ -1228,11 +1273,11 @@ void ScalpelUserInterface::doLookControl() { // Need to close the window and depress the Look button Common::Point pt(MENU_POINTS[0][0], MENU_POINTS[0][1]); offsetButton3DO(pt, 0); - screen._backBuffer2.blitFrom((*_controls)[0], pt); + screen._backBuffer2.SHblitFrom((*_controls)[0], pt); banishWindow(true); _windowBounds.top = CONTROLS_Y1; - _key = _oldKey = COMMANDS[LOOK_MODE - 1]; + _key = _oldKey = _hotkeyLook; _temp = _oldTemp = 0; _menuMode = LOOK_MODE; events.clearEvents(); @@ -1252,17 +1297,17 @@ void ScalpelUserInterface::doLookControl() { // Looking at an inventory object // Backup the user interface Surface tempSurface(SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT - CONTROLS_Y1); - tempSurface.blitFrom(screen._backBuffer2, Common::Point(0, 0), + tempSurface.SHblitFrom(screen._backBuffer2, Common::Point(0, 0), Common::Rect(0, CONTROLS_Y1, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT)); inv.drawInventory(INVENTORY_DONT_DISPLAY); banishWindow(true); // Restore the ui - screen._backBuffer2.blitFrom(tempSurface, Common::Point(0, CONTROLS_Y1)); + screen._backBuffer2.SHblitFrom(tempSurface, Common::Point(0, CONTROLS_Y1)); _windowBounds.top = CONTROLS_Y1; - _key = _oldKey = COMMANDS[LOOK_MODE - 1]; + _key = _oldKey = _hotkeyLook; _temp = _oldTemp = 0; events.clearEvents(); _invLookFlag = false; @@ -1278,39 +1323,83 @@ void ScalpelUserInterface::doMainControl() { ScalpelInventory &inv = *(ScalpelInventory *)_vm->_inventory; ScalpelSaveManager &saves = *(ScalpelSaveManager *)_vm->_saves; Common::Point pt = events.mousePos(); - const char *commands = IS_3DO ? COMMANDS_3DO : COMMANDS; + int pressedButtonId = -1; // button id according to enum MAINBUTTON_* if ((events._pressed || events._released) && pt.y > CONTROLS_Y) { events.clearKeyboard(); _key = -1; + _temp = 12; // no button currently selected // Check whether the mouse is in any of the command areas - for (_temp = 0; (_temp < 12) && (_key == -1); ++_temp) { - Common::Rect r(MENU_POINTS[_temp][0], MENU_POINTS[_temp][1], - MENU_POINTS[_temp][2], MENU_POINTS[_temp][3]); - if (IS_3DO && _temp >= 0 && _temp <= 2) { + for (uint16 buttonNr = 0; buttonNr < 12; buttonNr++) { + Common::Rect r(MENU_POINTS[buttonNr][0], MENU_POINTS[buttonNr][1], + MENU_POINTS[buttonNr][2], MENU_POINTS[buttonNr][3]); + if (IS_3DO && buttonNr <= 2) { r.left += UI_OFFSET_3DO - 1; r.right += UI_OFFSET_3DO - 1; } - if (r.contains(pt)) - _key = commands[_temp]; + if (r.contains(pt)) { + _temp = buttonNr; + pressedButtonId = buttonNr; + if (IS_3DO) { + // Replace some buttons according to 3DO + switch (pressedButtonId) { + case MAINBUTTON_JOURNAL: + pressedButtonId = MAINBUTTON_SETUP; + break; + case MAINBUTTON_FILES: + pressedButtonId = MAINBUTTON_LOADGAME; + break; + case MAINBUTTON_SETUP: + pressedButtonId = MAINBUTTON_SAVEGAME; + break; + default: + break; + } + } + // Get hotkey, that's assigned to it + assert(buttonNr < sizeof(_hotkeysIndexed)); + _key = _hotkeysIndexed[buttonNr]; + break; + } } - --_temp; } else if (_keyPress) { // Keyboard control _keyboardInput = true; + _temp = 12; // no button currently selected + + byte key = toupper(_keyPress); - if (_keyPress >= 'A' && _keyPress <= 'Z') { - const char *c = strchr(commands, _keyPress); - _temp = !c ? 12 : c - commands; + for (uint16 buttonId = 0; buttonId < sizeof(_hotkeysIndexed); buttonId++) { + if (key == _hotkeysIndexed[buttonId]) { + pressedButtonId = buttonId; + } + } + if (pressedButtonId >= 0) { + _temp = pressedButtonId; + _key = key; + if (IS_3DO) { + // Fix up button number for 3DO + switch (pressedButtonId) { + case MAINBUTTON_SETUP: + _temp = 9; + break; + case MAINBUTTON_LOADGAME: + _temp = 10; + break; + case MAINBUTTON_SAVEGAME: + _temp = 11; + break; + default: + break; + } + } } else { - _temp = 12; + _key = -1; } - if (_temp == 12) - _key = -1; - if (events._rightPressed) { + pressedButtonId = -1; _temp = 12; _key = -1; } @@ -1340,58 +1429,52 @@ void ScalpelUserInterface::doMainControl() { } if (!events._pressed && !_windowOpen) { - switch (_key) { - case 'L': + switch (pressedButtonId) { + case MAINBUTTON_LOOK: toggleButton(0); break; - case 'M': + case MAINBUTTON_MOVE: toggleButton(1); break; - case 'T': + case MAINBUTTON_TALK: toggleButton(2); break; - case 'P': + case MAINBUTTON_PICKUP: toggleButton(3); break; - case 'O': + case MAINBUTTON_OPEN: toggleButton(4); break; - case 'C': + case MAINBUTTON_CLOSE: toggleButton(5); break; - case 'I': + case MAINBUTTON_INVENTORY: pushButton(6); _selector = _oldSelector = -1; _menuMode = INV_MODE; - inv.drawInventory(PLAIN_INVENTORY); + inv.drawInventory(LOOK_INVENTORY_MODE); break; - case 'U': + case MAINBUTTON_USE: pushButton(7); _selector = _oldSelector = -1; _menuMode = USE_MODE; inv.drawInventory(USE_INVENTORY_MODE); break; - case 'G': + case MAINBUTTON_GIVE: pushButton(8); _selector = _oldSelector = -1; _menuMode = GIVE_MODE; inv.drawInventory(GIVE_INVENTORY_MODE); break; - case 'J': - pushButton(9); - _menuMode = JOURNAL_MODE; - journalControl(); + case MAINBUTTON_JOURNAL: + if (!IS_3DO) { + pushButton(9); + _menuMode = JOURNAL_MODE; + journalControl(); + } break; - case 'F': - if (IS_3DO) { - if (_temp == 10) { - pushButton(10); - vm.showScummVMRestoreDialog(); - } else if (_temp == 11) { - pushButton(11); - vm.showScummVMSaveDialog(); - } - } else { + case MAINBUTTON_FILES: + if (!IS_3DO) { pushButton(10); // Create a thumbnail of the current screen before the files dialog is shown, in case @@ -1413,7 +1496,19 @@ void ScalpelUserInterface::doMainControl() { } } break; - case 'S': + case MAINBUTTON_LOADGAME: + if (IS_3DO) { + pushButton(10); + vm.showScummVMRestoreDialog(); + } + break; + case MAINBUTTON_SAVEGAME: + if (IS_3DO) { + pushButton(11); + vm.showScummVMSaveDialog(); + } + break; + case MAINBUTTON_SETUP: pushButton(IS_3DO ? 9 : 11); _menuMode = SETUP_MODE; Settings::show(_vm); @@ -1500,7 +1595,6 @@ void ScalpelUserInterface::doPickControl() { void ScalpelUserInterface::doTalkControl() { Events &events = *_vm->_events; - FixedText &fixedText = *_vm->_fixedText; ScalpelJournal &journal = *(ScalpelJournal *)_vm->_journal; ScalpelPeople &people = *(ScalpelPeople *)_vm->_people; ScalpelScreen &screen = *(ScalpelScreen *)_vm->_screen; @@ -1511,28 +1605,24 @@ void ScalpelUserInterface::doTalkControl() { _key = _oldKey = -1; _keyboardInput = false; - Common::String fixedText_Exit = fixedText.getText(kFixedText_Window_Exit); - Common::String fixedText_Up = fixedText.getText(kFixedText_Window_Up); - Common::String fixedText_Down = fixedText.getText(kFixedText_Window_Down); - if (events._pressed || events._released) { events.clearKeyboard(); // Handle button printing if (mousePos.x > 99 && mousePos.x < 138 && mousePos.y > CONTROLS_Y && mousePos.y < (CONTROLS_Y + 10) && !_endKeyActive) - screen.buttonPrint(Common::Point(119, CONTROLS_Y), COMMAND_HIGHLIGHTED, true, fixedText_Exit); + screen.buttonPrint(Common::Point(119, CONTROLS_Y), COMMAND_HIGHLIGHTED, true, talk._fixedTextWindowExit); else if (_endKeyActive) - screen.buttonPrint(Common::Point(119, CONTROLS_Y), COMMAND_FOREGROUND, true, fixedText_Exit); + screen.buttonPrint(Common::Point(119, CONTROLS_Y), COMMAND_FOREGROUND, true, talk._fixedTextWindowExit); if (mousePos.x > 140 && mousePos.x < 170 && mousePos.y > CONTROLS_Y && mousePos.y < (CONTROLS_Y + 10) && talk._moreTalkUp) - screen.buttonPrint(Common::Point(159, CONTROLS_Y), COMMAND_HIGHLIGHTED, true, fixedText_Up); + screen.buttonPrint(Common::Point(159, CONTROLS_Y), COMMAND_HIGHLIGHTED, true, talk._fixedTextWindowUp); else if (talk._moreTalkUp) - screen.buttonPrint(Common::Point(159, CONTROLS_Y), COMMAND_FOREGROUND, true, fixedText_Up); + screen.buttonPrint(Common::Point(159, CONTROLS_Y), COMMAND_FOREGROUND, true, talk._fixedTextWindowUp); if (mousePos.x > 181&& mousePos.x < 220 && mousePos.y > CONTROLS_Y && mousePos.y < (CONTROLS_Y + 10) && talk._moreTalkDown) - screen.buttonPrint(Common::Point(200, CONTROLS_Y), COMMAND_HIGHLIGHTED, true, fixedText_Down); + screen.buttonPrint(Common::Point(200, CONTROLS_Y), COMMAND_HIGHLIGHTED, true, talk._fixedTextWindowDown); else if (talk._moreTalkDown) - screen.buttonPrint(Common::Point(200, CONTROLS_Y), COMMAND_FOREGROUND, true, fixedText_Down); + screen.buttonPrint(Common::Point(200, CONTROLS_Y), COMMAND_FOREGROUND, true, talk._fixedTextWindowDown); bool found = false; for (_selector = talk._talkIndex; _selector < (int)talk._statements.size() && !found; ++_selector) { @@ -1548,7 +1638,7 @@ void ScalpelUserInterface::doTalkControl() { if (_keyPress) { _key = toupper(_keyPress); if (_key == Common::KEYCODE_ESCAPE) - _key = 'E'; + _key = talk._hotkeyWindowExit; // Check for number press indicating reply line if (_key >= '1' && _key <= ('1' + (int)talk._statements.size() - 1)) { @@ -1561,7 +1651,7 @@ void ScalpelUserInterface::doTalkControl() { break; } } - } else if (_key == 'E' || _key == 'U' || _key == 'D') { + } else if (_key == talk._hotkeyWindowExit || _key == talk._hotkeyWindowUp || _key == talk._hotkeyWindowDown) { _keyboardInput = true; } else { _selector = -1; @@ -1589,7 +1679,7 @@ void ScalpelUserInterface::doTalkControl() { if (events._released || _keyboardInput) { if (((Common::Rect(99, CONTROLS_Y, 138, CONTROLS_Y + 10).contains(mousePos) && events._released) - || _key == 'E') && _endKeyActive) { + || _key == talk._hotkeyWindowExit) && _endKeyActive) { talk.freeTalkVars(); talk.pullSequence(); @@ -1597,7 +1687,7 @@ void ScalpelUserInterface::doTalkControl() { banishWindow(); _windowBounds.top = CONTROLS_Y1; } else if (((Common::Rect(140, CONTROLS_Y, 179, CONTROLS_Y + 10).contains(mousePos) && events._released) - || _key == 'U') && talk._moreTalkUp) { + || _key == talk._hotkeyWindowUp) && talk._moreTalkUp) { while (talk._statements[--talk._talkIndex]._talkMap == -1) ; screen._backBuffer1.fillRect(Common::Rect(5, CONTROLS_Y + 11, SHERLOCK_SCREEN_WIDTH - 2, @@ -1606,7 +1696,7 @@ void ScalpelUserInterface::doTalkControl() { screen.slamRect(Common::Rect(5, CONTROLS_Y, SHERLOCK_SCREEN_WIDTH - 5, SHERLOCK_SCREEN_HEIGHT - 2)); } else if (((Common::Rect(181, CONTROLS_Y, 220, CONTROLS_Y + 10).contains(mousePos) && events._released) - || _key == 'D') && talk._moreTalkDown) { + || _key == talk._hotkeyWindowDown) && talk._moreTalkDown) { do { ++talk._talkIndex; } while (talk._talkIndex < (int)talk._statements.size() && talk._statements[talk._talkIndex]._talkMap == -1); @@ -1617,9 +1707,9 @@ void ScalpelUserInterface::doTalkControl() { screen.slamRect(Common::Rect(5, CONTROLS_Y, SHERLOCK_SCREEN_WIDTH - 5, SHERLOCK_SCREEN_HEIGHT - 2)); } else if (_selector != -1) { - screen.buttonPrint(Common::Point(119, CONTROLS_Y), COMMAND_NULL, true, fixedText_Exit); - screen.buttonPrint(Common::Point(159, CONTROLS_Y), COMMAND_NULL, true, fixedText_Up); - screen.buttonPrint(Common::Point(200, CONTROLS_Y), COMMAND_NULL, true, fixedText_Down); + screen.buttonPrint(Common::Point(119, CONTROLS_Y), COMMAND_NULL, true, talk._fixedTextWindowExit); + screen.buttonPrint(Common::Point(159, CONTROLS_Y), COMMAND_NULL, true, talk._fixedTextWindowUp); + screen.buttonPrint(Common::Point(200, CONTROLS_Y), COMMAND_NULL, true, talk._fixedTextWindowDown); // If the reply is new, add it to the journal if (!talk._talkHistory[talk._converseNum][_selector]) { @@ -1713,9 +1803,9 @@ void ScalpelUserInterface::doTalkControl() { !talk._statements[select]._statement.hasPrefix("^")) { // Not a reply first file, so display the new selections if (_endKeyActive) - screen.buttonPrint(Common::Point(119, CONTROLS_Y), COMMAND_FOREGROUND, true, fixedText_Exit); + screen.buttonPrint(Common::Point(119, CONTROLS_Y), COMMAND_FOREGROUND, true, talk._fixedTextWindowExit); else - screen.buttonPrint(Common::Point(119, CONTROLS_Y), COMMAND_NULL, true, fixedText_Exit); + screen.buttonPrint(Common::Point(119, CONTROLS_Y), COMMAND_NULL, true, talk._fixedTextWindowExit); talk.displayTalk(true); events.setCursor(ARROW); @@ -1776,7 +1866,7 @@ void ScalpelUserInterface::journalControl() { if (keyState.keycode == Common::KEYCODE_x && (keyState.flags & Common::KBD_ALT)) { _vm->quitGame(); return; - } else if (keyState.keycode == Common::KEYCODE_e || keyState.keycode == Common::KEYCODE_ESCAPE) { + } else if (toupper(keyState.ascii) == journal._hotkeyExit || keyState.keycode == Common::KEYCODE_ESCAPE) { doneFlag = true; } else { _key = toupper(keyState.keycode); @@ -1798,7 +1888,7 @@ void ScalpelUserInterface::journalControl() { // Reset the palette screen.setPalette(screen._cMap); - screen._backBuffer1.blitFrom(screen._backBuffer2); + screen._backBuffer1.SHblitFrom(screen._backBuffer2); scene.updateBackground(); screen.slamArea(0, 0, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT); } @@ -1832,19 +1922,19 @@ void ScalpelUserInterface::printObjectDesc(const Common::String &str, bool first Common::Point pt(MENU_POINTS[0][0], MENU_POINTS[0][1]); offsetButton3DO(pt, 0); - tempSurface.blitFrom(screen._backBuffer2, Common::Point(0, 0), - Common::Rect(pt.x, pt.y, pt.x + tempSurface.w(), pt.y + tempSurface.h())); - screen._backBuffer2.transBlitFrom((*_controls)[0], pt); + tempSurface.SHblitFrom(screen._backBuffer2, Common::Point(0, 0), + Common::Rect(pt.x, pt.y, pt.x + tempSurface.width(), pt.y + tempSurface.height())); + screen._backBuffer2.SHtransBlitFrom((*_controls)[0], pt); banishWindow(1); events.setCursor(MAGNIFY); _windowBounds.top = CONTROLS_Y1; - _key = _oldKey = COMMANDS[LOOK_MODE - 1]; + _key = _oldKey = _hotkeyLook; _temp = _oldTemp = 0; _menuMode = LOOK_MODE; events.clearEvents(); - screen._backBuffer2.blitFrom(tempSurface, pt); + screen._backBuffer2.SHblitFrom(tempSurface, pt); } else { events.setCursor(ARROW); banishWindow(true); @@ -1866,7 +1956,7 @@ void ScalpelUserInterface::printObjectDesc(const Common::String &str, bool first banishWindow(1); _windowBounds.top = CONTROLS_Y1; - _key = _oldKey = COMMANDS[INV_MODE - 1]; + _key = _oldKey = _hotkeyInventory; _temp = _oldTemp = 0; events.clearEvents(); @@ -1878,7 +1968,7 @@ void ScalpelUserInterface::printObjectDesc(const Common::String &str, bool first return; } - Surface &bb = *screen._backBuffer; + Surface &bb = *screen.getBackBuffer(); if (firstTime) { // Only draw the border on the first call _infoFlag = true; @@ -1938,20 +2028,16 @@ void ScalpelUserInterface::printObjectDesc(const Common::String &str, bool first // Handle display depending on whether all the message was shown if (!endOfStr) { + Common::String fixedText_PressKeyForMore = FIXED(PressKey_ForMore); + screen.makeButton(Common::Rect(46, CONTROLS_Y, 272, CONTROLS_Y + 10), - (SHERLOCK_SCREEN_WIDTH - screen.stringWidth(PRESS_KEY_FOR_MORE)) / 2, - PRESS_KEY_FOR_MORE); - screen.gPrint(Common::Point((SHERLOCK_SCREEN_WIDTH - - screen.stringWidth(PRESS_KEY_FOR_MORE)) / 2, CONTROLS_Y), - COMMAND_FOREGROUND, "P"); + SHERLOCK_SCREEN_WIDTH / 2, fixedText_PressKeyForMore); _descStr = msgP; } else { + Common::String fixedText_PressKeyToContinue = FIXED(PressKey_ToContinue); + screen.makeButton(Common::Rect(46, CONTROLS_Y, 272, CONTROLS_Y + 10), - (SHERLOCK_SCREEN_WIDTH - screen.stringWidth(PRESS_KEY_TO_CONTINUE)) / 2, - PRESS_KEY_TO_CONTINUE); - screen.gPrint(Common::Point((SHERLOCK_SCREEN_WIDTH - - screen.stringWidth(PRESS_KEY_TO_CONTINUE)) / 2, CONTROLS_Y), - COMMAND_FOREGROUND, "P"); + SHERLOCK_SCREEN_WIDTH / 2, fixedText_PressKeyToContinue); _descStr = ""; } @@ -1986,9 +2072,9 @@ void ScalpelUserInterface::summonWindow(const Surface &bgSurface, bool slideUp) if (slideUp) { // Gradually slide up the display of the window - 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)); + for (int idx = 1; idx <= bgSurface.height(); idx += 2) { + screen.getBackBuffer()->SHblitFrom(bgSurface, Common::Point(0, SHERLOCK_SCREEN_HEIGHT - idx), + Common::Rect(0, 0, bgSurface.width(), idx)); screen.slamRect(Common::Rect(0, SHERLOCK_SCREEN_HEIGHT - idx, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT)); @@ -1996,21 +2082,21 @@ void ScalpelUserInterface::summonWindow(const Surface &bgSurface, bool slideUp) } } else { // Gradually slide down the display of the window - for (int idx = 1; idx <= bgSurface.h(); idx += 2) { - screen._backBuffer->blitFrom(bgSurface, - Common::Point(0, SHERLOCK_SCREEN_HEIGHT - bgSurface.h()), - Common::Rect(0, bgSurface.h() - idx, bgSurface.w(), bgSurface.h())); - screen.slamRect(Common::Rect(0, SHERLOCK_SCREEN_HEIGHT - bgSurface.h(), - SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT - bgSurface.h() + idx)); + for (int idx = 1; idx <= bgSurface.height(); idx += 2) { + screen.getBackBuffer()->SHblitFrom(bgSurface, + Common::Point(0, SHERLOCK_SCREEN_HEIGHT - bgSurface.height()), + Common::Rect(0, bgSurface.height() - idx, bgSurface.width(), bgSurface.height())); + screen.slamRect(Common::Rect(0, SHERLOCK_SCREEN_HEIGHT - bgSurface.height(), + SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT - bgSurface.height() + idx)); events.delay(10); } } // Final display of the entire window - screen._backBuffer->blitFrom(bgSurface, Common::Point(0, SHERLOCK_SCREEN_HEIGHT - bgSurface.h()), - Common::Rect(0, 0, bgSurface.w(), bgSurface.h())); - screen.slamArea(0, SHERLOCK_SCREEN_HEIGHT - bgSurface.h(), bgSurface.w(), bgSurface.h()); + screen.getBackBuffer()->SHblitFrom(bgSurface, Common::Point(0, SHERLOCK_SCREEN_HEIGHT - bgSurface.height()), + Common::Rect(0, 0, bgSurface.width(), bgSurface.height())); + screen.slamArea(0, SHERLOCK_SCREEN_HEIGHT - bgSurface.height(), bgSurface.width(), bgSurface.height()); _windowOpen = true; } @@ -2021,10 +2107,10 @@ void ScalpelUserInterface::summonWindow(bool slideUp, int height) { // Extract the window that's been drawn on the back buffer Surface tempSurface(SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT - height); Common::Rect r(0, height, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT); - tempSurface.blitFrom(screen._backBuffer1, Common::Point(0, 0), r); + tempSurface.SHblitFrom(screen._backBuffer1, Common::Point(0, 0), r); // Remove drawn window with original user interface - screen._backBuffer1.blitFrom(screen._backBuffer2, + screen._backBuffer1.SHblitFrom(screen._backBuffer2, Common::Point(0, height), r); // Display the window gradually on-screen @@ -2048,7 +2134,7 @@ void ScalpelUserInterface::banishWindow(bool slideUp) { Common::copy_backward(pSrc, pSrcEnd, pDest); // Restore lines from the ui in the secondary back buffer - screen._backBuffer1.blitFrom(screen._backBuffer2, + screen._backBuffer1.SHblitFrom(screen._backBuffer2, Common::Point(0, CONTROLS_Y), Common::Rect(0, CONTROLS_Y, SHERLOCK_SCREEN_WIDTH, CONTROLS_Y + idx)); @@ -2058,14 +2144,14 @@ void ScalpelUserInterface::banishWindow(bool slideUp) { } // Restore final two old lines - screen._backBuffer1.blitFrom(screen._backBuffer2, + screen._backBuffer1.SHblitFrom(screen._backBuffer2, Common::Point(0, SHERLOCK_SCREEN_HEIGHT - 2), Common::Rect(0, SHERLOCK_SCREEN_HEIGHT - 2, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT)); screen.slamArea(0, SHERLOCK_SCREEN_HEIGHT - 2, SHERLOCK_SCREEN_WIDTH, 2); } else { // Restore old area to completely erase window - screen._backBuffer1.blitFrom(screen._backBuffer2, + screen._backBuffer1.SHblitFrom(screen._backBuffer2, Common::Point(0, CONTROLS_Y), Common::Rect(0, CONTROLS_Y, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT)); screen.slamRect(Common::Rect(0, CONTROLS_Y, SHERLOCK_SCREEN_WIDTH, @@ -2085,7 +2171,7 @@ void ScalpelUserInterface::banishWindow(bool slideUp) { } // Show entire final area - screen._backBuffer1.blitFrom(screen._backBuffer2, Common::Point(0, CONTROLS_Y1), + screen._backBuffer1.SHblitFrom(screen._backBuffer2, Common::Point(0, CONTROLS_Y1), Common::Rect(0, CONTROLS_Y1, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT)); screen.slamRect(Common::Rect(0, CONTROLS_Y1, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT)); } @@ -2167,7 +2253,7 @@ void ScalpelUserInterface::checkUseAction(const UseType *use, const Common::Stri if (scene._goToScene != 1 && !printed && !talk._talkToAbort) { _infoFlag = true; clearInfo(); - screen.print(Common::Point(0, INFO_LINE + 1), INFO_FOREGROUND, "Done..."); + screen.print(Common::Point(0, INFO_LINE + 1), INFO_FOREGROUND, "%s", FIXED(UserInterface_Done)); _menuCounter = 25; } } @@ -2177,9 +2263,9 @@ void ScalpelUserInterface::checkUseAction(const UseType *use, const Common::Stri clearInfo(); if (giveMode) { - screen.print(Common::Point(0, INFO_LINE + 1), INFO_FOREGROUND, "No, thank you."); + screen.print(Common::Point(0, INFO_LINE + 1), INFO_FOREGROUND, "%s", FIXED(UserInterface_NoThankYou)); } else if (fixedTextActionId == kFixedTextAction_Invalid) { - screen.print(Common::Point(0, INFO_LINE + 1), INFO_FOREGROUND, "You can't do that."); + screen.print(Common::Point(0, INFO_LINE + 1), INFO_FOREGROUND, "%s", FIXED(UserInterface_YouCantDoThat)); } else { Common::String errorMessage = fixedText.getActionMessage(fixedTextActionId, 0); screen.print(Common::Point(0, INFO_LINE + 1), INFO_FOREGROUND, "%s", errorMessage.c_str()); diff --git a/engines/sherlock/scalpel/scalpel_user_interface.h b/engines/sherlock/scalpel/scalpel_user_interface.h index d88e607c2a..cc3aafff65 100644 --- a/engines/sherlock/scalpel/scalpel_user_interface.h +++ b/engines/sherlock/scalpel/scalpel_user_interface.h @@ -33,26 +33,38 @@ class Talk; namespace Scalpel { -extern const char COMMANDS[13]; -extern const char COMMANDS_3DO[13]; extern const int MENU_POINTS[12][4]; extern const int INVENTORY_POINTS[8][3]; -extern const char INVENTORY_COMMANDS[9]; -extern const char *const PRESS_KEY_FOR_MORE; -extern const char *const PRESS_KEY_TO_CONTINUE; + +enum { + MAINBUTTON_LOOK = 0, + MAINBUTTON_MOVE, + MAINBUTTON_TALK, + MAINBUTTON_PICKUP, + MAINBUTTON_OPEN, + MAINBUTTON_CLOSE, + MAINBUTTON_INVENTORY, + MAINBUTTON_USE, + MAINBUTTON_GIVE, + MAINBUTTON_JOURNAL, + MAINBUTTON_FILES, + MAINBUTTON_SETUP, + MAINBUTTON_LOADGAME, + MAINBUTTON_SAVEGAME +}; class Settings; class ScalpelUserInterface: public UserInterface { friend class Settings; - friend class Talk; + friend class Sherlock::Talk; private: char _keyPress; int _lookHelp; int _help, _oldHelp; int _key, _oldKey; - int _temp, _oldTemp; + int _temp, _oldTemp; // button number (0-11) int _oldLook; bool _keyboardInput; bool _pause; @@ -77,7 +89,7 @@ private: * have already been drawn. This simply takes care of switching the mode around * accordingly */ - void toggleButton(int num); + void toggleButton(uint16 num); /** * Print the name of an object in the scene @@ -147,6 +159,24 @@ public: ImageFile *_controlPanel; ImageFile *_controls; int _oldUse; + + byte _hotkeyLook; + byte _hotkeyMove; + byte _hotkeyTalk; + byte _hotkeyPickUp; + byte _hotkeyOpen; + byte _hotkeyClose; + byte _hotkeyInventory; + byte _hotkeyUse; + byte _hotkeyGive; + byte _hotkeyJournal; // not used for 3DO + byte _hotkeyFiles; // not used for 3DO + byte _hotkeySetUp; // SetUp-button is in the spot of Journal for 3DO + byte _hotkeyLoadGame; // 3DO + byte _hotkeySaveGame; // 3DO + + byte _hotkeysIndexed[14]; + public: ScalpelUserInterface(SherlockEngine *vm); virtual ~ScalpelUserInterface(); diff --git a/engines/sherlock/scalpel/settings.cpp b/engines/sherlock/scalpel/settings.cpp index f6769a4b99..e039559982 100644 --- a/engines/sherlock/scalpel/settings.cpp +++ b/engines/sherlock/scalpel/settings.cpp @@ -24,6 +24,7 @@ #include "sherlock/scalpel/settings.h" #include "sherlock/scalpel/scalpel_screen.h" #include "sherlock/scalpel/scalpel_user_interface.h" +#include "sherlock/scalpel/scalpel_fixed_text.h" #include "sherlock/scalpel/scalpel.h" namespace Sherlock { @@ -45,18 +46,9 @@ static const int SETUP_POINTS[12][4] = { { 219, 187, 316, 268 } // _key Pad Accel. Toggle }; -static const char *const SETUP_STRS0[2] = { "off", "on" }; -static const char *const SETUP_STRS1[2] = { "Directly", "by Pixel" }; -static const char *const SETUP_STRS2[2] = { "Left", "Right" }; -static const char *const SETUP_STRS3[2] = { "Appear", "Slide" }; -static const char *const SETUP_STRS5[2] = { "Left", "Right" }; -static const char *const SETUP_NAMES[12] = { - "Exit", "M", "V", "S", "B", "New Font Style", "J", "Calibrate Joystick", "F", "W", "P", "K" -}; - /*----------------------------------------------------------------*/ -void Settings::drawInteface(bool flag) { +void Settings::drawInterface(bool flag) { People &people = *_vm->_people; ScalpelScreen &screen = *(ScalpelScreen *)_vm->_screen; Sound &sound = *_vm->_sound; @@ -74,55 +66,105 @@ void Settings::drawInteface(bool flag) { SHERLOCK_SCREEN_HEIGHT - 2), INV_BACKGROUND); } + tempStr = FIXED(Settings_Exit); + _hotkeyExit = toupper(tempStr.firstChar()); screen.makeButton(Common::Rect(SETUP_POINTS[0][0], SETUP_POINTS[0][1], SETUP_POINTS[0][2], SETUP_POINTS[0][1] + 10), - SETUP_POINTS[0][3] - screen.stringWidth("Exit") / 2, "Exit"); + SETUP_POINTS[0][3], tempStr); - tempStr = Common::String::format("Music %s", SETUP_STRS0[music._musicOn]); + if (music._musicOn) { + tempStr = FIXED(Settings_MusicOn); + } else { + tempStr = FIXED(Settings_MusicOff); + } + _hotkeyMusic = toupper(tempStr.firstChar()); screen.makeButton(Common::Rect(SETUP_POINTS[1][0], SETUP_POINTS[1][1], SETUP_POINTS[1][2], SETUP_POINTS[1][1] + 10), - SETUP_POINTS[1][3] - screen.stringWidth(tempStr) / 2, tempStr); + SETUP_POINTS[1][3], tempStr); - tempStr = Common::String::format("Voices %s", SETUP_STRS0[sound._voices]); - screen.makeButton(Common::Rect(SETUP_POINTS[2][0], SETUP_POINTS[2][1], SETUP_POINTS[2][2], SETUP_POINTS[2][1] + 10), - SETUP_POINTS[2][3] - screen.stringWidth(tempStr) / 2, tempStr); - - tempStr = Common::String::format("Sound Effects %s", SETUP_STRS0[sound._digitized]); - screen.makeButton(Common::Rect(SETUP_POINTS[3][0], SETUP_POINTS[3][1], SETUP_POINTS[3][2], SETUP_POINTS[3][1] + 10), - SETUP_POINTS[3][3] - screen.stringWidth(tempStr) / 2, tempStr); - - tempStr = Common::String::format("Auto Help %s", SETUP_STRS5[ui._helpStyle]); - screen.makeButton(Common::Rect(SETUP_POINTS[4][0], SETUP_POINTS[4][1], SETUP_POINTS[4][2], SETUP_POINTS[4][1] + 10), - SETUP_POINTS[4][3] - screen.stringWidth(tempStr) / 2, tempStr); - screen.makeButton(Common::Rect(SETUP_POINTS[5][0], SETUP_POINTS[5][1], SETUP_POINTS[5][2], SETUP_POINTS[5][1] + 10), - SETUP_POINTS[5][3] - screen.stringWidth("New Font Style") / 2, "New Font Style"); + if (people._portraitsOn) { + tempStr = FIXED(Settings_PortraitsOn); + } else { + tempStr = FIXED(Settings_PortraitsOff); + } + _hotkeyPortraits = toupper(tempStr.firstChar()); + screen.makeButton(Common::Rect(SETUP_POINTS[10][0], SETUP_POINTS[10][1], SETUP_POINTS[10][2], SETUP_POINTS[10][1] + 10), + SETUP_POINTS[10][3], tempStr); // WORKAROUND: We don't support the joystick in ScummVM, so draw the next two buttons as disabled - tempStr = "Joystick Off"; + tempStr = FIXED(Settings_JoystickOff); screen.makeButton(Common::Rect(SETUP_POINTS[6][0], SETUP_POINTS[6][1], SETUP_POINTS[6][2], SETUP_POINTS[6][1] + 10), - SETUP_POINTS[6][3] - screen.stringWidth(tempStr) / 2, tempStr); + SETUP_POINTS[6][3], tempStr); screen.buttonPrint(Common::Point(SETUP_POINTS[6][3], SETUP_POINTS[6][1]), COMMAND_NULL, false, tempStr); - tempStr = "Calibrate Joystick"; + tempStr = FIXED(Settings_NewFontStyle); + _hotkeyNewFontStyle = toupper(tempStr.firstChar()); + screen.makeButton(Common::Rect(SETUP_POINTS[5][0], SETUP_POINTS[5][1], SETUP_POINTS[5][2], SETUP_POINTS[5][1] + 10), + SETUP_POINTS[5][3], tempStr); + + if (sound._digitized) { + tempStr = FIXED(Settings_SoundEffectsOn); + } else { + tempStr = FIXED(Settings_SoundEffectsOff); + } + _hotkeySoundEffects = toupper(tempStr.firstChar()); + screen.makeButton(Common::Rect(SETUP_POINTS[3][0], SETUP_POINTS[3][1], SETUP_POINTS[3][2], SETUP_POINTS[3][1] + 10), + SETUP_POINTS[3][3], tempStr); + + if (ui._slideWindows) { + tempStr = FIXED(Settings_WindowsSlide); + } else { + tempStr = FIXED(Settings_WindowsAppear); + } + _hotkeyWindows = toupper(tempStr.firstChar()); + screen.makeButton(Common::Rect(SETUP_POINTS[9][0], SETUP_POINTS[9][1], SETUP_POINTS[9][2], SETUP_POINTS[9][1] + 10), + SETUP_POINTS[9][3], tempStr); + + tempStr = FIXED(Settings_CalibrateJoystick); screen.makeButton(Common::Rect(SETUP_POINTS[7][0], SETUP_POINTS[7][1], SETUP_POINTS[7][2], SETUP_POINTS[7][1] + 10), - SETUP_POINTS[7][3] - screen.stringWidth(tempStr) / 2, tempStr); + SETUP_POINTS[7][3], tempStr); screen.buttonPrint(Common::Point(SETUP_POINTS[7][3], SETUP_POINTS[7][1]), COMMAND_NULL, false, tempStr); - tempStr = Common::String::format("Fade %s", screen._fadeStyle ? "by Pixel" : "Directly"); - screen.makeButton(Common::Rect(SETUP_POINTS[8][0], SETUP_POINTS[8][1], SETUP_POINTS[8][2], SETUP_POINTS[8][1] + 10), - SETUP_POINTS[8][3] - screen.stringWidth(tempStr) / 2, tempStr); + if (ui._helpStyle) { + tempStr = FIXED(Settings_AutoHelpRight); + } else { + tempStr = FIXED(Settings_AutoHelpLeft); + } + _hotkeyAutoHelp = toupper(tempStr.firstChar()); + screen.makeButton(Common::Rect(SETUP_POINTS[4][0], SETUP_POINTS[4][1], SETUP_POINTS[4][2], SETUP_POINTS[4][1] + 10), + SETUP_POINTS[4][3], tempStr); - tempStr = Common::String::format("Windows %s", ui._slideWindows ? "Slide" : "Appear"); - screen.makeButton(Common::Rect(SETUP_POINTS[9][0], SETUP_POINTS[9][1], SETUP_POINTS[9][2], SETUP_POINTS[9][1] + 10), - SETUP_POINTS[9][3] - screen.stringWidth(tempStr) / 2, tempStr); + if (sound._voices) { + tempStr = FIXED(Settings_VoicesOn); + } else { + tempStr = FIXED(Settings_VoicesOff); + } + _hotkeyVoices = toupper(tempStr.firstChar()); + screen.makeButton(Common::Rect(SETUP_POINTS[2][0], SETUP_POINTS[2][1], SETUP_POINTS[2][2], SETUP_POINTS[2][1] + 10), + SETUP_POINTS[2][3], tempStr); - tempStr = Common::String::format("Portraits %s", SETUP_STRS0[people._portraitsOn]); - screen.makeButton(Common::Rect(SETUP_POINTS[10][0], SETUP_POINTS[10][1], SETUP_POINTS[10][2], SETUP_POINTS[10][1] + 10), - SETUP_POINTS[10][3] - screen.stringWidth(tempStr) / 2, tempStr); + if (screen._fadeStyle) { + tempStr = FIXED(Settings_FadeByPixel); + } else { + tempStr = FIXED(Settings_FadeDirectly); + } + _hotkeyFade = toupper(tempStr.firstChar()); + screen.makeButton(Common::Rect(SETUP_POINTS[8][0], SETUP_POINTS[8][1], SETUP_POINTS[8][2], SETUP_POINTS[8][1] + 10), + SETUP_POINTS[8][3], tempStr); - tempStr = "Key Pad Slow"; + tempStr = FIXED(Settings_KeyPadSlow); screen.makeButton(Common::Rect(SETUP_POINTS[11][0], SETUP_POINTS[11][1], SETUP_POINTS[11][2], SETUP_POINTS[11][1] + 10), - SETUP_POINTS[11][3] - screen.stringWidth(tempStr) / 2, tempStr); + SETUP_POINTS[11][3], tempStr); screen.buttonPrint(Common::Point(SETUP_POINTS[11][3], SETUP_POINTS[11][1]), COMMAND_NULL, false, tempStr); + _hotkeysIndexed[0] = _hotkeyExit; + _hotkeysIndexed[1] = _hotkeyMusic; + _hotkeysIndexed[2] = _hotkeyVoices; + _hotkeysIndexed[3] = _hotkeySoundEffects; + _hotkeysIndexed[4] = _hotkeyAutoHelp; + _hotkeysIndexed[5] = _hotkeyNewFontStyle; + _hotkeysIndexed[8] = _hotkeyFade; + _hotkeysIndexed[9] = _hotkeyWindows; + _hotkeysIndexed[10] = _hotkeyPortraits; + // Show the window immediately, or slide it on-screen if (!flag) { if (!ui._slideWindows) { @@ -151,7 +193,7 @@ int Settings::drawButtons(const Common::Point &pt, int _key) { for (int idx = 0; idx < 12; ++idx) { if ((pt.x > SETUP_POINTS[idx][0] && pt.x < SETUP_POINTS[idx][2] && pt.y > SETUP_POINTS[idx][1] && pt.y < (SETUP_POINTS[idx][1] + 10) && (events._pressed || events._released)) - || (_key == SETUP_NAMES[idx][0])) { + || (_key == toupper(_hotkeysIndexed[idx]))) { found = idx; color = COMMAND_HIGHLIGHTED; } else { @@ -160,50 +202,74 @@ int Settings::drawButtons(const Common::Point &pt, int _key) { // Print the button text switch (idx) { + case 0: + tempStr = FIXED(Settings_Exit); + break; case 1: - tempStr = Common::String::format("Music %s", SETUP_STRS0[music._musicOn]); - screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), color, true, tempStr); + if (music._musicOn) { + tempStr = FIXED(Settings_MusicOn); + } else { + tempStr = FIXED(Settings_MusicOff); + } break; case 2: - tempStr = Common::String::format("Voices %s", SETUP_STRS0[sound._voices]); - screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), color, true, tempStr); + if (sound._voices) { + tempStr = FIXED(Settings_VoicesOn); + } else { + tempStr = FIXED(Settings_VoicesOff); + } break; case 3: - tempStr = Common::String::format("Sound Effects %s", SETUP_STRS0[sound._digitized]); - screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), color, true, tempStr); + if (sound._digitized) { + tempStr = FIXED(Settings_SoundEffectsOn); + } else { + tempStr = FIXED(Settings_SoundEffectsOff); + } break; case 4: - tempStr = Common::String::format("Auto Help %s", SETUP_STRS2[ui._helpStyle]); - screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), color, true, tempStr); + if (ui._helpStyle) { + tempStr = FIXED(Settings_AutoHelpRight); + } else { + tempStr = FIXED(Settings_AutoHelpLeft); + } break; - case 6: - tempStr = "Joystick Off"; - screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), COMMAND_NULL, true, tempStr); + case 5: + tempStr = FIXED(Settings_NewFontStyle); break; + case 6: + // Joystick Off - disabled in ScummVM + continue; case 7: - tempStr = "Calibrate Joystick"; - screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), COMMAND_NULL, true, tempStr); - break; + // Calibrate Joystick - disabled in ScummVM + continue; case 8: - tempStr = Common::String::format("Fade %s", SETUP_STRS1[screen._fadeStyle]); - screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), color, true, tempStr); + if (screen._fadeStyle) { + tempStr = FIXED(Settings_FadeByPixel); + } else { + tempStr = FIXED(Settings_FadeDirectly); + } break; case 9: - tempStr = Common::String::format("Windows %s", SETUP_STRS3[ui._slideWindows]); - screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), color, true, tempStr); + if (ui._slideWindows) { + tempStr = FIXED(Settings_WindowsSlide); + } else { + tempStr = FIXED(Settings_WindowsAppear); + } break; case 10: - tempStr = Common::String::format("Portraits %s", SETUP_STRS0[people._portraitsOn]); - screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), color, true, tempStr); + if (people._portraitsOn) { + tempStr = FIXED(Settings_PortraitsOn); + } else { + tempStr = FIXED(Settings_PortraitsOff); + } break; case 11: - tempStr = "Key Pad Slow"; - screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), COMMAND_NULL, true, tempStr); - break; + // Key Pad Slow - disabled in ScummVM + continue; default: - screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), color, true, SETUP_NAMES[idx]); - break; + continue; } + screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), color, true, tempStr); } return found; @@ -222,7 +288,7 @@ void Settings::show(SherlockEngine *vm) { assert(vm->getGameID() == GType_SerratedScalpel); Settings settings(vm); - settings.drawInteface(false); + settings.drawInterface(false); do { if (ui._menuCounter) @@ -244,7 +310,7 @@ void Settings::show(SherlockEngine *vm) { if (events.kbHit()) { Common::KeyState keyState = events.getKey(); - ui._key = toupper(keyState.keycode); + ui._key = toupper(keyState.ascii); if (ui._key == Common::KEYCODE_RETURN || ui._key == Common::KEYCODE_SPACE) { events._pressed = false; @@ -258,11 +324,11 @@ void Settings::show(SherlockEngine *vm) { found = settings.drawButtons(pt, ui._key); } - if ((found == 0 && events._released) || (ui._key == 'E' || ui._key == Common::KEYCODE_ESCAPE)) + if ((found == 0 && events._released) || (ui._key == settings._hotkeyExit || ui._key == Common::KEYCODE_ESCAPE)) // Exit break; - if ((found == 1 && events._released) || ui._key == 'M') { + if ((found == 1 && events._released) || ui._key == settings._hotkeyMusic) { // Toggle music music._musicOn = !music._musicOn; if (!music._musicOn) @@ -271,30 +337,30 @@ void Settings::show(SherlockEngine *vm) { music.startSong(); updateConfig = true; - settings.drawInteface(true); + settings.drawInterface(true); } - if ((found == 2 && events._released) || ui._key == 'V') { + if ((found == 2 && events._released) || ui._key == settings._hotkeyVoices) { sound._voices = !sound._voices; updateConfig = true; - settings.drawInteface(true); + settings.drawInterface(true); } - if ((found == 3 && events._released) || ui._key == 'S') { + if ((found == 3 && events._released) || ui._key == settings._hotkeySoundEffects) { // Toggle sound effects sound._digitized = !sound._digitized; updateConfig = true; - settings.drawInteface(true); + settings.drawInterface(true); } - if ((found == 4 && events._released) || ui._key == 'A') { + if ((found == 4 && events._released) || ui._key == settings._hotkeyAutoHelp) { // Help button style ui._helpStyle = !ui._helpStyle; updateConfig = true; - settings.drawInteface(true); + settings.drawInterface(true); } - if ((found == 5 && events._released) || ui._key == 'N') { + if ((found == 5 && events._released) || ui._key == settings._hotkeyNewFontStyle) { // New font style int fontNum = screen.fontNumber() + 1; if (fontNum == 3) @@ -302,28 +368,28 @@ void Settings::show(SherlockEngine *vm) { screen.setFont(fontNum); updateConfig = true; - settings.drawInteface(true); + settings.drawInterface(true); } - if ((found == 8 && events._released) || ui._key == 'F') { + if ((found == 8 && events._released) || ui._key == settings._hotkeyFade) { // Toggle fade style screen._fadeStyle = !screen._fadeStyle; updateConfig = true; - settings.drawInteface(true); + settings.drawInterface(true); } - if ((found == 9 && events._released) || ui._key == 'W') { + if ((found == 9 && events._released) || ui._key == settings._hotkeyWindows) { // Window style ui._slideWindows = !ui._slideWindows; updateConfig = true; - settings.drawInteface(true); + settings.drawInterface(true); } - if ((found == 10 && events._released) || ui._key == 'P') { + if ((found == 10 && events._released) || ui._key == settings._hotkeyPortraits) { // Toggle portraits being shown people._portraitsOn = !people._portraitsOn; updateConfig = true; - settings.drawInteface(true); + settings.drawInterface(true); } } while (!vm->shouldQuit()); diff --git a/engines/sherlock/scalpel/settings.h b/engines/sherlock/scalpel/settings.h index ff2e647a62..9144e9d420 100644 --- a/engines/sherlock/scalpel/settings.h +++ b/engines/sherlock/scalpel/settings.h @@ -35,12 +35,36 @@ class Settings { private: SherlockEngine *_vm; - Settings(SherlockEngine *vm) : _vm(vm) {} + Settings(SherlockEngine *vm) : _vm(vm) { + _hotkeyExit = 0; + _hotkeyMusic = 0; + _hotkeyPortraits = 0; + _hotkeyNewFontStyle = 0; + _hotkeySoundEffects = 0; + _hotkeyWindows = 0; + _hotkeyAutoHelp = 0; + _hotkeyVoices = 0; + _hotkeyFade = 0; + + memset(_hotkeysIndexed, 0, sizeof(_hotkeysIndexed)); + } + + byte _hotkeyExit; + byte _hotkeyMusic; + byte _hotkeyPortraits; + byte _hotkeyNewFontStyle; + byte _hotkeySoundEffects; + byte _hotkeyWindows; + byte _hotkeyAutoHelp; + byte _hotkeyVoices; + byte _hotkeyFade; + + byte _hotkeysIndexed[12]; /** * Draws the interface for the settings window */ - void drawInteface(bool flag); + void drawInterface(bool flag); /** * Draws the buttons for the settings dialog diff --git a/engines/sherlock/scalpel/tsage/logo.cpp b/engines/sherlock/scalpel/tsage/logo.cpp index 014470dcc8..a885057f35 100644 --- a/engines/sherlock/scalpel/tsage/logo.cpp +++ b/engines/sherlock/scalpel/tsage/logo.cpp @@ -163,6 +163,7 @@ Object::Object() { _angle = _changeCtr = 0; _walkStartFrame = 0; _majorDiff = _minorDiff = 0; + _updateStartFrame = 0; } void Object::setVisage(int visage, int strip) { @@ -216,7 +217,7 @@ void Object::erase() { Screen &screen = *_vm->_screen; if (_visage.isLoaded() && !_oldBounds.isEmpty()) - screen.blitFrom(screen._backBuffer1, Common::Point(_oldBounds.left, _oldBounds.top), _oldBounds); + screen.SHblitFrom(screen._backBuffer1, Common::Point(_oldBounds.left, _oldBounds.top), _oldBounds); } void Object::update() { @@ -245,9 +246,9 @@ void Object::update() { _visage.getFrame(s, _frame); // Display the frame - _oldBounds = Common::Rect(_position.x, _position.y, _position.x + s.w(), _position.y + s.h()); + _oldBounds = Common::Rect(_position.x, _position.y, _position.x + s.width(), _position.y + s.height()); _oldBounds.translate(-s._centroid.x, -s._centroid.y); - screen.transBlitFrom(s, Common::Point(_oldBounds.left, _oldBounds.top)); + screen.SHtransBlitFrom(s, Common::Point(_oldBounds.left, _oldBounds.top)); } } @@ -651,7 +652,7 @@ void Logo::loadBackground() { screen.setPalette(palette); // Copy the surface to the screen - screen.blitFrom(screen._backBuffer1); + screen.SHblitFrom(screen._backBuffer1); } void Logo::fade(const byte palette[PALETTE_SIZE], int step) { |