From 1e291b0b25719f61f7173d9f8ae7e0da5164b526 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 24 May 2015 07:46:25 -0400 Subject: SHERLOCK: Implemented initial RT palette loading --- engines/sherlock/scene.cpp | 4 +--- engines/sherlock/screen.cpp | 7 ++++++- engines/sherlock/screen.h | 6 ++++++ engines/sherlock/tattoo/tattoo.cpp | 12 ++++++++++++ engines/sherlock/tattoo/tattoo.h | 5 +++++ 5 files changed, 30 insertions(+), 4 deletions(-) diff --git a/engines/sherlock/scene.cpp b/engines/sherlock/scene.cpp index 4672e3e7b1..e625dae7aa 100644 --- a/engines/sherlock/scene.cpp +++ b/engines/sherlock/scene.cpp @@ -514,9 +514,7 @@ bool Scene::loadScene(const Common::String &filename) { } else { // Read in palette rrmStream->read(screen._cMap, PALETTE_SIZE); - for (int idx = 0; idx < PALETTE_SIZE; ++idx) - screen._cMap[idx] = VGA_COLOR_TRANS(screen._cMap[idx]); - + screen.translatePalette(screen._cMap); Common::copy(screen._cMap, screen._cMap + PALETTE_SIZE, screen._sMap); // Read in the background diff --git a/engines/sherlock/screen.cpp b/engines/sherlock/screen.cpp index 24f7660743..bb9dbd7ec4 100644 --- a/engines/sherlock/screen.cpp +++ b/engines/sherlock/screen.cpp @@ -39,7 +39,7 @@ Screen::Screen(SherlockEngine *vm) : Surface(g_system->getWidth(), g_system->get Common::fill(&_cMap[0], &_cMap[PALETTE_SIZE], 0); Common::fill(&_sMap[0], &_sMap[PALETTE_SIZE], 0); Common::fill(&_tMap[0], &_tMap[PALETTE_SIZE], 0); - setFont(1); + setFont(IS_SERRATED_SCALPEL ? 1 : 4); // Rose Tattoo specific fields _fadeBytesRead = _fadeBytesToRead = 0; @@ -466,4 +466,9 @@ void Screen::initScrollVars() { _targetScroll = 0; } +void Screen::translatePalette(byte palette[PALETTE_SIZE]) { + for (int idx = 0; idx < PALETTE_SIZE; ++idx) + palette[idx] = VGA_COLOR_TRANS(palette[idx]); +} + } // End of namespace Sherlock diff --git a/engines/sherlock/screen.h b/engines/sherlock/screen.h index f4cd6fd955..58c7d8f152 100644 --- a/engines/sherlock/screen.h +++ b/engines/sherlock/screen.h @@ -251,6 +251,12 @@ public: void setupBGArea(const byte cMap[PALETTE_SIZE]); void initScrollVars(); + + /** + * Translate a palette from 6-bit RGB values to full 8-bit values suitable for passing + * to the underlying palette manager + */ + static void translatePalette(byte palette[PALETTE_SIZE]); }; } // End of namespace Sherlock diff --git a/engines/sherlock/tattoo/tattoo.cpp b/engines/sherlock/tattoo/tattoo.cpp index 9039e3f9d4..47a7c2a9ba 100644 --- a/engines/sherlock/tattoo/tattoo.cpp +++ b/engines/sherlock/tattoo/tattoo.cpp @@ -47,6 +47,9 @@ void TattooEngine::initialize() { // Starting scene _scene->_goToScene = 91; + + // Load an initial palette + loadInitialPalette(); } /** @@ -56,6 +59,15 @@ void TattooEngine::startScene() { // TODO } +void TattooEngine::loadInitialPalette() { + byte palette[768]; + Common::SeekableReadStream *stream = _res->load("room.pal"); + stream->read(palette, PALETTE_SIZE); + _screen->translatePalette(palette); + _screen->setPalette(palette); + + delete stream; +} } // End of namespace Tattoo diff --git a/engines/sherlock/tattoo/tattoo.h b/engines/sherlock/tattoo/tattoo.h index 7bdeec55d1..b9224e06ba 100644 --- a/engines/sherlock/tattoo/tattoo.h +++ b/engines/sherlock/tattoo/tattoo.h @@ -30,6 +30,11 @@ namespace Sherlock { namespace Tattoo { class TattooEngine : public SherlockEngine { +private: + /** + * Loads the initial palette for the game + */ + void loadInitialPalette(); protected: virtual void initialize(); -- cgit v1.2.3