aboutsummaryrefslogtreecommitdiff
path: root/engines/illusions
diff options
context:
space:
mode:
authorjohndoe1232015-12-04 23:23:38 +0100
committerEugene Sandulenko2018-07-20 06:43:33 +0000
commit2de38e3469e85e56b6401a9c3cd97ead2249f67e (patch)
tree1e60e9d40657dee84438ae0d5f3b6116e27fc53c /engines/illusions
parentaed38527010e7b155af469d0521aa07e7fd7d12e (diff)
downloadscummvm-rg350-2de38e3469e85e56b6401a9c3cd97ead2249f67e.tar.gz
scummvm-rg350-2de38e3469e85e56b6401a9c3cd97ead2249f67e.tar.bz2
scummvm-rg350-2de38e3469e85e56b6401a9c3cd97ead2249f67e.zip
ILLUSIONS: DUCKMAN: Extract trigger cause sound playing to method
Diffstat (limited to 'engines/illusions')
-rw-r--r--engines/illusions/duckman/illusions_duckman.cpp22
-rw-r--r--engines/illusions/duckman/illusions_duckman.h1
2 files changed, 13 insertions, 10 deletions
diff --git a/engines/illusions/duckman/illusions_duckman.cpp b/engines/illusions/duckman/illusions_duckman.cpp
index c9233ae6d1..289a3d80b4 100644
--- a/engines/illusions/duckman/illusions_duckman.cpp
+++ b/engines/illusions/duckman/illusions_duckman.cpp
@@ -1086,8 +1086,19 @@ uint32 IllusionsEngine_Duckman::runTriggerCause(uint32 verbId, uint32 objectId2,
if (!getTriggerCause(verbId, objectId2, objectId, triggerThreadId))
return 0;
+
+ playTriggerCauseSound(verbId, objectId2, objectId);
- // TODO Extract sound effect playing to method
+ uint32 tempThreadId = newTempThreadId();
+ debug(1, "Starting cause thread %08X with triggerThreadId %08X", tempThreadId, triggerThreadId);
+ CauseThread_Duckman *causeThread = new CauseThread_Duckman(this, tempThreadId, 0, 0,
+ triggerThreadId);
+ _threads->startThread(causeThread);
+
+ return tempThreadId;
+}
+
+void IllusionsEngine_Duckman::playTriggerCauseSound(uint32 verbId, uint32 objectId2, uint32 objectId) {
bool soundWasPlayed = false;
if (_scriptResource->_properties.get(0x000E003C)) {
if (verbId == 7 && objectId == 0x40003) {
@@ -1103,7 +1114,6 @@ uint32 IllusionsEngine_Duckman::runTriggerCause(uint32 verbId, uint32 objectId2,
soundWasPlayed = true;
}
}
-
if (!soundWasPlayed) {
if (objectId == 0x40003) {
playSoundEffect(14);
@@ -1123,14 +1133,6 @@ uint32 IllusionsEngine_Duckman::runTriggerCause(uint32 verbId, uint32 objectId2,
playSoundEffect(5);
}
}
-
- uint32 tempThreadId = newTempThreadId();
- debug(1, "Starting cause thread %08X with triggerThreadId %08X", tempThreadId, triggerThreadId);
- CauseThread_Duckman *causeThread = new CauseThread_Duckman(this, tempThreadId, 0, 0,
- triggerThreadId);
- _threads->startThread(causeThread);
-
- return tempThreadId;
}
bool IllusionsEngine_Duckman::loadSavegameFromScript(int16 slotNum, uint32 callingThreadId) {
diff --git a/engines/illusions/duckman/illusions_duckman.h b/engines/illusions/duckman/illusions_duckman.h
index 1825123e5c..f19a659ac3 100644
--- a/engines/illusions/duckman/illusions_duckman.h
+++ b/engines/illusions/duckman/illusions_duckman.h
@@ -186,6 +186,7 @@ public:
void playSoundEffect(int index);
bool getTriggerCause(uint32 verbId, uint32 objectId2, uint32 objectId, uint32 &outThreadId);
uint32 runTriggerCause(uint32 verbId, uint32 objectId2, uint32 objectId);
+ void playTriggerCauseSound(uint32 verbId, uint32 objectId2, uint32 objectId);
bool loadSavegameFromScript(int16 slotNum, uint32 callingThreadId);
bool saveSavegameFromScript(int16 slotNum, uint32 callingThreadId);