SHERLOCK: Implemented initial RT palette loading

This commit is contained in:
Paul Gilbert 2015-05-24 07:46:25 -04:00
parent bcc31b2a66
commit 1e291b0b25
5 changed files with 30 additions and 4 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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();