aboutsummaryrefslogtreecommitdiff
path: root/engines/mohawk/riven_card.cpp
diff options
context:
space:
mode:
authorBastien Bouclet2016-08-06 17:54:45 +0200
committerEugene Sandulenko2017-07-03 08:50:10 +0200
commitc1e0b8684b5d89fc5c10088a3222a8760e3b4ade (patch)
tree063d1968a02035564818bcb3e17293ba4520f314 /engines/mohawk/riven_card.cpp
parent4bdf88496d959c88f975c7d5f4e2ca6f25b454f4 (diff)
downloadscummvm-rg350-c1e0b8684b5d89fc5c10088a3222a8760e3b4ade.tar.gz
scummvm-rg350-c1e0b8684b5d89fc5c10088a3222a8760e3b4ade.tar.bz2
scummvm-rg350-c1e0b8684b5d89fc5c10088a3222a8760e3b4ade.zip
MOHAWK: Move BLST list handling to RivenCard
Diffstat (limited to 'engines/mohawk/riven_card.cpp')
-rw-r--r--engines/mohawk/riven_card.cpp28
1 files changed, 28 insertions, 0 deletions
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);