From 1b27de3829024e25496145c0c29473f4921d85ac Mon Sep 17 00:00:00 2001 From: Alyssa Milburn Date: Wed, 1 Dec 2010 18:22:21 +0000 Subject: MOHAWK: fix LBPaletteItem svn-id: r54711 --- engines/mohawk/livingbooks.cpp | 34 ++++++++-------------------------- engines/mohawk/livingbooks.h | 6 +++--- 2 files changed, 11 insertions(+), 29 deletions(-) (limited to 'engines') diff --git a/engines/mohawk/livingbooks.cpp b/engines/mohawk/livingbooks.cpp index c00b22123c..062216fe5b 100644 --- a/engines/mohawk/livingbooks.cpp +++ b/engines/mohawk/livingbooks.cpp @@ -2085,45 +2085,27 @@ LBPaletteItem::LBPaletteItem(MohawkEngine_LivingBooks *vm, Common::Rect rect) : void LBPaletteItem::readData(uint16 type, uint16 size, Common::SeekableSubReadStreamEndian *stream) { switch (type) { - case 0x72: + case kLBPaletteXData: { - assert(size == 4 + 256 * 4); - // TODO + assert(size == 8 + 255 * 4); _start = stream->readUint16(); _count = stream->readUint16(); - stream->read(_palette, 256 * 4); + _drawStart = stream->readUint16(); + _drawCount = stream->readUint16(); + stream->read(_palette, 255 * 4); } break; - case 0x75: - assert(size == 0); - debug(2, "LBPaletteItem: 0x75"); - // TODO - break; - default: LBItem::readData(type, size, stream); } } -void LBPaletteItem::startPhase(uint phase) { - //if (_phase != phase) - // return; - - /*printf("palette: start %d, count %d\n", _start, _count); - byte *localpal = _palette; - for (unsigned int i = 0; i < 256 * 4; i++) { - printf("%02x ", *localpal++); - } - printf("\n");*/ - - // TODO: huh? - if (_start != 1) +void LBPaletteItem::draw() { + if (!_visible) return; - // TODO - //_vm->_system->setPalette(_start - 1, _count - (_start - 1), _palette + (_start * 4)); - _vm->_system->setPalette(_palette + _start * 4, 0, 256 - _start); + _vm->_system->setPalette(_palette + _drawStart * 4, _drawStart, _drawCount); } LBLiveTextItem::LBLiveTextItem(MohawkEngine_LivingBooks *vm, Common::Rect rect) : LBItem(vm, rect) { diff --git a/engines/mohawk/livingbooks.h b/engines/mohawk/livingbooks.h index 387853f64b..6421471496 100644 --- a/engines/mohawk/livingbooks.h +++ b/engines/mohawk/livingbooks.h @@ -324,11 +324,11 @@ public: void readData(uint16 type, uint16 size, Common::SeekableSubReadStreamEndian *stream); - void startPhase(uint phase); + void draw(); protected: - uint16 _start, _count; - byte _palette[256 * 4]; + uint16 _start, _count, _drawStart, _drawCount; + byte _palette[255 * 4]; }; struct LiveTextWord { -- cgit v1.2.3