aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Bouclet2016-08-06 18:07:54 +0200
committerEugene Sandulenko2017-07-03 08:50:10 +0200
commit871516a9697db1914d703f0abb48a2f084452b0c (patch)
tree7fc231c0421ceeddcfd416e83710c0bec27ccb9c
parentc1e0b8684b5d89fc5c10088a3222a8760e3b4ade (diff)
downloadscummvm-rg350-871516a9697db1914d703f0abb48a2f084452b0c.tar.gz
scummvm-rg350-871516a9697db1914d703f0abb48a2f084452b0c.tar.bz2
scummvm-rg350-871516a9697db1914d703f0abb48a2f084452b0c.zip
MOHAWK: Move the effect list to RivenCard
-rw-r--r--engines/mohawk/riven_card.cpp33
-rw-r--r--engines/mohawk/riven_card.h11
-rw-r--r--engines/mohawk/riven_scripts.cpp18
3 files changed, 44 insertions, 18 deletions
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);
diff --git a/engines/mohawk/riven_card.h b/engines/mohawk/riven_card.h
index 6648d2640c..007a26d7b6 100644
--- a/engines/mohawk/riven_card.h
+++ b/engines/mohawk/riven_card.h
@@ -97,12 +97,16 @@ public:
/** Activate a hotspot using a hotspot enable list entry */
void activateHotspotEnableRecord(uint16 index);
+ /** Activate a water effect list entry */
+ void activateWaterEffect(uint16 index);
+
private:
void loadCardResource(uint16 id);
void loadHotspots(uint16 id);
void loadCardPictureList(uint16 id);
void loadCardSoundList(uint16 id);
void loadCardHotspotEnableList(uint16 id);
+ void loadCardWaterEffectList(uint16 id);
void defaultLoadScript();
@@ -112,6 +116,12 @@ private:
uint16 hotspotId;
};
+ struct WaterEffectRecord {
+ uint16 index;
+ uint16 sfxeId;
+ uint16 u0;
+ };
+
MohawkEngine_Riven *_vm;
// General card data
@@ -126,6 +136,7 @@ private:
Common::Array<Picture> _pictureList;
Common::Array<SLSTRecord> _soundList;
Common::Array<HotspotEnableRecord> _hotspotEnableList;
+ Common::Array<WaterEffectRecord> _waterEffectList;
};
/**
diff --git a/engines/mohawk/riven_scripts.cpp b/engines/mohawk/riven_scripts.cpp
index 2f3780d5c2..e951043aa5 100644
--- a/engines/mohawk/riven_scripts.cpp
+++ b/engines/mohawk/riven_scripts.cpp
@@ -596,23 +596,7 @@ void RivenSimpleCommand::activateBLST(uint16 op, uint16 argc, uint16 *argv) {
// Command 44: activate FLST record (information on which SFXE resource this card should use)
void RivenSimpleCommand::activateFLST(uint16 op, uint16 argc, uint16 *argv) {
- Common::SeekableReadStream* flst = _vm->getResource(ID_FLST, _vm->getCurCard()->getId());
- uint16 recordCount = flst->readUint16BE();
-
- for (uint16 i = 0; i < recordCount; i++) {
- uint16 index = flst->readUint16BE();
- uint16 sfxeID = flst->readUint16BE();
-
- if (flst->readUint16BE() != 0)
- warning("FLST u0 non-zero");
-
- if (index == argv[0]) {
- _vm->_gfx->scheduleWaterEffect(sfxeID);
- break;
- }
- }
-
- delete flst;
+ _vm->getCurCard()->activateWaterEffect(argv[0]);
}
// Command 45: do zip mode