diff options
author | Paul Gilbert | 2013-06-07 22:07:57 -0400 |
---|---|---|
committer | Paul Gilbert | 2013-06-07 22:07:57 -0400 |
commit | 48c18a7c1448a169cc07e21e4f2e883642e9e42a (patch) | |
tree | 9b9f0f7a3c4d509815f1dde67dbc9cd8e0115101 /engines | |
parent | 8d6d3d8aa629c452daa27aa8cf49497d8cf02fce (diff) | |
download | scummvm-rg350-48c18a7c1448a169cc07e21e4f2e883642e9e42a.tar.gz scummvm-rg350-48c18a7c1448a169cc07e21e4f2e883642e9e42a.tar.bz2 scummvm-rg350-48c18a7c1448a169cc07e21e4f2e883642e9e42a.zip |
VOYEUR: Implemented decoding of viewport list palette data
Diffstat (limited to 'engines')
-rw-r--r-- | engines/voyeur/events.cpp | 29 | ||||
-rw-r--r-- | engines/voyeur/files.cpp | 22 | ||||
-rw-r--r-- | engines/voyeur/files.h | 12 |
3 files changed, 44 insertions, 19 deletions
diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp index 02b0f7f738..a59d11ca45 100644 --- a/engines/voyeur/events.cpp +++ b/engines/voyeur/events.cpp @@ -160,26 +160,23 @@ void EventsManager::startFade(CMapResource *cMap) { if (cMap->_steps > 0) { _vm->_graphicsManager._fadeStatus = cMap->_fadeStatus | 1; - uint16 *destP = (uint16 *)(_vm->_graphicsManager._viewPortListPtr->_palette + - (_fadeFirstCol * 16)); byte *vgaP = &_vm->_graphicsManager._VGAColors[_fadeFirstCol * 3]; int mapIndex = 0; for (int idx = _fadeFirstCol; idx <= _fadeLastCol; ++idx) { - destP[0] = vgaP[0] << 8; - uint32 rComp = (uint16)((cMap->_entries[mapIndex * 3] << 8) - destP[0]) | 0x80; - destP[3] = rComp / cMap->_steps; - - destP[1] = vgaP[1] << 8; - uint32 gComp = (uint16)((cMap->_entries[mapIndex * 3 + 1] << 8) - destP[1]) | 0x80; - destP[4] = gComp / cMap->_steps; - - destP[2] = vgaP[2] << 8; - uint32 bComp = (uint16)((cMap->_entries[mapIndex * 3 + 2] << 8) - destP[2]) | 0x80; - destP[5] = bComp / cMap->_steps; - destP[6] = bComp % cMap->_steps; - - destP += 8; + ViewPortPalEntry &palEntry = _vm->_graphicsManager._viewPortListPtr->_palette[idx]; + palEntry._rEntry = vgaP[0] << 8; + uint32 rComp = (uint16)((cMap->_entries[mapIndex * 3] << 8) - palEntry._rEntry) | 0x80; + palEntry.field6 = rComp / cMap->_steps; + + palEntry._gEntry = vgaP[1] << 8; + uint32 gComp = (uint16)((cMap->_entries[mapIndex * 3 + 1] << 8) - palEntry._gEntry) | 0x80; + palEntry.field8 = gComp / cMap->_steps; + + palEntry._bEntry = vgaP[2] << 8; + uint32 bComp = (uint16)((cMap->_entries[mapIndex * 3 + 2] << 8) -palEntry._bEntry) | 0x80; + palEntry.fieldA = bComp / cMap->_steps; + palEntry.fieldC = bComp % cMap->_steps; if (!(cMap->_fadeStatus & 1)) ++mapIndex; diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp index c335e8a485..3bf0d5174c 100644 --- a/engines/voyeur/files.cpp +++ b/engines/voyeur/files.cpp @@ -752,8 +752,13 @@ void ViewPortResource::setupViewPort() { ViewPortListResource::ViewPortListResource(BoltFilesState &state, const byte *src) { uint count = READ_LE_UINT16(src); - uint32 *idP = (uint32 *)&src[8]; + // Load palette map + byte *palData = state._curLibPtr->memberAddr(READ_LE_UINT32(src + 4)); + for (uint i = 0; i < 256; ++i, palData += 16) + _palette.push_back(ViewPortPalEntry(palData)); + // Load view port pointer list + uint32 *idP = (uint32 *)&src[8]; for (uint i = 0; i < count; ++i, ++idP) { uint32 id = READ_LE_UINT32(idP); BoltEntry &entry = state._curLibPtr->getBoltEntry(id); @@ -761,10 +766,23 @@ ViewPortListResource::ViewPortListResource(BoltFilesState &state, const byte *sr assert(entry._viewPortResource); _entries.push_back(entry._viewPortResource); } +} - state._curLibPtr->resolveIt(READ_LE_UINT32(src + 4), &_palette); +/*------------------------------------------------------------------------*/ + +ViewPortPalEntry::ViewPortPalEntry(const byte *src) { + uint16 *v = (uint16 *)src; + _rEntry = READ_LE_UINT16(v++); + _gEntry = READ_LE_UINT16(v++); + _bEntry = READ_LE_UINT16(v++); + field6 = READ_LE_UINT16(v++); + field8 = READ_LE_UINT16(v++); + fieldA = READ_LE_UINT16(v++); + fieldC = READ_LE_UINT16(v++); + fieldE = READ_LE_UINT16(v++); } + /*------------------------------------------------------------------------*/ FontResource::FontResource(BoltFilesState &state, const byte *src) { diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h index 49d6db1333..4edf1892a7 100644 --- a/engines/voyeur/files.h +++ b/engines/voyeur/files.h @@ -255,9 +255,19 @@ public: void setupViewPort(); }; +class ViewPortPalEntry { +public: + uint16 _rEntry, _gEntry, _bEntry; + uint16 field6, field8, fieldA; + uint16 fieldC; + uint16 fieldE; +public: + ViewPortPalEntry(const byte *src); +}; + class ViewPortListResource { public: - byte *_palette; + Common::Array<ViewPortPalEntry> _palette; Common::Array<ViewPortResource *> _entries; ViewPortListResource(BoltFilesState &state, const byte *src); |