From 871516a9697db1914d703f0abb48a2f084452b0c Mon Sep 17 00:00:00 2001 From: Bastien Bouclet Date: Sat, 6 Aug 2016 18:07:54 +0200 Subject: MOHAWK: Move the effect list to RivenCard --- engines/mohawk/riven_card.cpp | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) (limited to 'engines/mohawk/riven_card.cpp') diff --git a/engines/mohawk/riven_card.cpp b/engines/mohawk/riven_card.cpp index 158c72f080..cdf9cf1a3e 100644 --- a/engines/mohawk/riven_card.cpp +++ b/engines/mohawk/riven_card.cpp @@ -37,6 +37,7 @@ RivenCard::RivenCard(MohawkEngine_Riven *vm, uint16 id) : loadCardPictureList(id); loadCardSoundList(id); loadCardHotspotEnableList(id); + loadCardWaterEffectList(id); } RivenCard::~RivenCard() { @@ -269,7 +270,7 @@ RivenHotspot *RivenCard::getHotspotByBlstId(const uint16 blstId) const { } void RivenCard::loadCardHotspotEnableList(uint16 id) { - Common::SeekableReadStream* blst = _vm->getResource(ID_BLST, id); + Common::SeekableReadStream *blst = _vm->getResource(ID_BLST, id); uint16 recordCount = blst->readUint16BE(); _hotspotEnableList.resize(recordCount); @@ -295,6 +296,36 @@ void RivenCard::activateHotspotEnableRecord(uint16 index) { } } +void RivenCard::loadCardWaterEffectList(uint16 id) { + Common::SeekableReadStream *flst = _vm->getResource(ID_FLST, id); + + uint16 recordCount = flst->readUint16BE(); + _waterEffectList.resize(recordCount); + + for (uint16 i = 0; i < recordCount; i++) { + WaterEffectRecord &record = _waterEffectList[i]; + record.index = flst->readUint16BE(); + record.sfxeId = flst->readUint16BE(); + record.u0 = flst->readUint16BE(); + + if (record.u0 != 0) { + warning("FLST u0 non-zero"); + } + } + + delete flst; +} + +void RivenCard::activateWaterEffect(uint16 index) { + for (uint16 i = 0; i < _waterEffectList.size(); i++) { + const WaterEffectRecord &record = _waterEffectList[i]; + if (record.index == index) { + _vm->_gfx->scheduleWaterEffect(record.sfxeId); + break; + } + } +} + RivenHotspot::RivenHotspot(MohawkEngine_Riven *vm, Common::ReadStream *stream) : _vm(vm) { loadFromStream(stream); -- cgit v1.2.3