From c1e0b8684b5d89fc5c10088a3222a8760e3b4ade Mon Sep 17 00:00:00 2001 From: Bastien Bouclet Date: Sat, 6 Aug 2016 17:54:45 +0200 Subject: MOHAWK: Move BLST list handling to RivenCard --- engines/mohawk/riven_card.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'engines/mohawk/riven_card.cpp') diff --git a/engines/mohawk/riven_card.cpp b/engines/mohawk/riven_card.cpp index 39a818c6a9..158c72f080 100644 --- a/engines/mohawk/riven_card.cpp +++ b/engines/mohawk/riven_card.cpp @@ -36,6 +36,7 @@ RivenCard::RivenCard(MohawkEngine_Riven *vm, uint16 id) : loadHotspots(id); loadCardPictureList(id); loadCardSoundList(id); + loadCardHotspotEnableList(id); } RivenCard::~RivenCard() { @@ -267,6 +268,33 @@ RivenHotspot *RivenCard::getHotspotByBlstId(const uint16 blstId) const { return nullptr; } +void RivenCard::loadCardHotspotEnableList(uint16 id) { + Common::SeekableReadStream* blst = _vm->getResource(ID_BLST, id); + + uint16 recordCount = blst->readUint16BE(); + _hotspotEnableList.resize(recordCount); + + for (uint16 i = 0; i < recordCount; i++) { + HotspotEnableRecord &record = _hotspotEnableList[i]; + record.index = blst->readUint16BE(); + record.enabled = blst->readUint16BE(); + record.hotspotId = blst->readUint16BE(); + } + + delete blst; +} + +void RivenCard::activateHotspotEnableRecord(uint16 index) { + for (uint16 i = 0; i < _hotspotEnableList.size(); i++) { + const HotspotEnableRecord &record = _hotspotEnableList[i]; + if (record.index == index) { + RivenHotspot *hotspot = getHotspotByBlstId(record.hotspotId); + hotspot->enable(record.enabled == 1); + break; + } + } +} + RivenHotspot::RivenHotspot(MohawkEngine_Riven *vm, Common::ReadStream *stream) : _vm(vm) { loadFromStream(stream); -- cgit v1.2.3