aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorjohndoe1232018-05-18 05:05:54 +1000
committerEugene Sandulenko2018-07-20 06:43:33 +0000
commit54dd3814414d7ef5de09cda197b1065655ee9242 (patch)
tree837f181b107a244fe7060ac8f9ff34d908d67222 /engines
parenta76612ec5a91847e7e23652614d5e572af2c4aab (diff)
downloadscummvm-rg350-54dd3814414d7ef5de09cda197b1065655ee9242.tar.gz
scummvm-rg350-54dd3814414d7ef5de09cda197b1065655ee9242.tar.bz2
scummvm-rg350-54dd3814414d7ef5de09cda197b1065655ee9242.zip
ILLUSIONS: BBDOU: Play sound in BbdouSpecialCode::playSoundEffect
(cherry picked from commit 1e822f0)
Diffstat (limited to 'engines')
-rw-r--r--engines/illusions/bbdou/bbdou_specialcode.cpp3
-rw-r--r--engines/illusions/bbdou/illusions_bbdou.cpp18
-rw-r--r--engines/illusions/bbdou/illusions_bbdou.h3
-rw-r--r--engines/illusions/bbdou/scriptopcodes_bbdou.cpp46
-rw-r--r--engines/illusions/bbdou/scriptopcodes_bbdou.h5
5 files changed, 67 insertions, 8 deletions
diff --git a/engines/illusions/bbdou/bbdou_specialcode.cpp b/engines/illusions/bbdou/bbdou_specialcode.cpp
index c7e79a722b..0f3a264b85 100644
--- a/engines/illusions/bbdou/bbdou_specialcode.cpp
+++ b/engines/illusions/bbdou/bbdou_specialcode.cpp
@@ -34,6 +34,7 @@
#include "illusions/input.h"
#include "illusions/scriptstack.h"
#include "illusions/scriptopcodes.h"
+#include "illusions/sound.h"
namespace Illusions {
@@ -501,7 +502,7 @@ void BbdouSpecialCode::playSoundEffect(int soundIndex) {
};
uint32 soundEffectId = kSoundEffectIds[2 * soundIndex];
if (soundEffectId) {
- // TODO _vm->startSound(soundEffectId, 255, 0);
+ _vm->_soundMan->playSound(soundEffectId, 255, 0);
}
}
diff --git a/engines/illusions/bbdou/illusions_bbdou.cpp b/engines/illusions/bbdou/illusions_bbdou.cpp
index 52e41daede..247a00fbed 100644
--- a/engines/illusions/bbdou/illusions_bbdou.cpp
+++ b/engines/illusions/bbdou/illusions_bbdou.cpp
@@ -589,6 +589,24 @@ void IllusionsEngine_BBDOU::dumpActiveScenes(uint32 sceneId, uint32 threadId) {
_camera->clearCameraModeStack();
}
+void IllusionsEngine_BBDOU::pause(uint32 callerThreadId) {
+ if (++_pauseCtr == 1) {
+ _threads->pauseThreads(callerThreadId);
+ _camera->pause();
+ pauseFader();
+ _controls->pauseActors(0x40004);
+ }
+}
+
+void IllusionsEngine_BBDOU::unpause(uint32 callerThreadId) {
+ if (--_pauseCtr == 0) {
+ _controls->unpauseActors(0x40004);
+ unpauseFader();
+ _camera->unpause();
+ _threads->unpauseThreads(callerThreadId);
+ }
+}
+
void IllusionsEngine_BBDOU::enterMenuPause() {
// TODO suspendAudio();
_screenText->clearText();
diff --git a/engines/illusions/bbdou/illusions_bbdou.h b/engines/illusions/bbdou/illusions_bbdou.h
index f1843f716f..9bdfc6d2b1 100644
--- a/engines/illusions/bbdou/illusions_bbdou.h
+++ b/engines/illusions/bbdou/illusions_bbdou.h
@@ -136,6 +136,9 @@ public:
void leavePause(uint32 threadId);
void dumpActiveScenes(uint32 sceneId, uint32 threadId);
+ void pause(uint32 callerThreadId);
+ void unpause(uint32 callerThreadId);
+
void enterMenuPause();
void leaveMenuPause();
diff --git a/engines/illusions/bbdou/scriptopcodes_bbdou.cpp b/engines/illusions/bbdou/scriptopcodes_bbdou.cpp
index 3a1b2486c4..f0e406ed19 100644
--- a/engines/illusions/bbdou/scriptopcodes_bbdou.cpp
+++ b/engines/illusions/bbdou/scriptopcodes_bbdou.cpp
@@ -122,11 +122,11 @@ void ScriptOpcodes_BBDOU::initOpcodes() {
OPCODE(66, opSetAdjustUpSfx);
OPCODE(67, opSetAdjustDnSfx);
// 68 unused
- // TODO OPCODE(69, opPause);
- // TODO OPCODE(70, opResume);
+ OPCODE(69, opPause);
+ OPCODE(70, opResume);
OPCODE(71, opStartSound);
- // TODO OPCODE(72, opStartSoundAtNamedPoint);
- // TODO OPCODE(73, opStartSoundAtActor);
+ OPCODE(72, opStartSoundAtPosition);
+ OPCODE(73, opStartSoundAtActor);
OPCODE(74, opStopSound);
OPCODE(75, opStartMusic);
OPCODE(76, opStopMusic);
@@ -142,9 +142,9 @@ void ScriptOpcodes_BBDOU::initOpcodes() {
// TODO OPCODE(86, opRestoreGame);
OPCODE(87, opDeactivateButton);
OPCODE(88, opActivateButton);
- // TODO 89 NOP
+ OPCODE(89, opNop);
// 90 unused
- // TODO 91 NOP
+ OPCODE(91, opNop);
// 92-102 unused
OPCODE(103, opJumpIf);
OPCODE(104, opIsPrevSceneId);
@@ -614,6 +614,14 @@ void ScriptOpcodes_BBDOU::opSetAdjustDnSfx(ScriptThread *scriptThread, OpCall &o
// TODO _vm->setAdjustDnSfx(soundEffectId);
}
+void ScriptOpcodes_BBDOU::opPause(ScriptThread *scriptThread, OpCall &opCall) {
+ _vm->pause(opCall._callerThreadId);
+}
+
+void ScriptOpcodes_BBDOU::opResume(ScriptThread *scriptThread, OpCall &opCall) {
+ _vm->unpause(opCall._callerThreadId);
+}
+
void ScriptOpcodes_BBDOU::opStartSound(ScriptThread *scriptThread, OpCall &opCall) {
ARG_SKIP(2);
ARG_INT16(volume);
@@ -621,6 +629,26 @@ void ScriptOpcodes_BBDOU::opStartSound(ScriptThread *scriptThread, OpCall &opCal
ARG_UINT32(soundEffectId);
_vm->_soundMan->playSound(soundEffectId, volume, pan);
}
+
+void ScriptOpcodes_BBDOU::opStartSoundAtPosition(ScriptThread *scriptThread, OpCall &opCall) {
+ ARG_INT16(volume);
+ ARG_UINT32(soundEffectId);
+ ARG_UINT32(namedPointId);
+ Common::Point pos = _vm->getNamedPointPosition(namedPointId);
+ int16 pan = _vm->convertPanXCoord(pos.x);
+ _vm->_soundMan->playSound(soundEffectId, volume, pan);
+}
+
+void ScriptOpcodes_BBDOU::opStartSoundAtActor(ScriptThread *scriptThread, OpCall &opCall) {
+ ARG_INT16(volume);
+ ARG_UINT32(objectId);
+ ARG_UINT32(soundEffectId);
+ Control *control = _vm->_dict->getObjectControl(objectId);
+ Common::Point pos = control->getActorPosition();
+ int16 pan = _vm->convertPanXCoord(pos.x);
+ _vm->_soundMan->playSound(soundEffectId, volume, pan);
+}
+
void ScriptOpcodes_BBDOU::opStopSound(ScriptThread *scriptThread, OpCall &opCall) {
ARG_SKIP(2);
ARG_UINT32(soundEffectId);
@@ -699,6 +727,10 @@ void ScriptOpcodes_BBDOU::opActivateButton(ScriptThread *scriptThread, OpCall &o
_vm->_input->activateButton(button);
}
+void ScriptOpcodes_BBDOU::opNop(ScriptThread *scriptThread, OpCall &opCall) {
+ // Opcode empty but still called
+}
+
void ScriptOpcodes_BBDOU::opJumpIf(ScriptThread *scriptThread, OpCall &opCall) {
ARG_INT16(jumpOffs);
int16 value = _vm->_stack->pop();
@@ -792,7 +824,7 @@ void ScriptOpcodes_BBDOU::opPlayVideo(ScriptThread *scriptThread, OpCall &opCall
ARG_UINT32(objectId);
ARG_UINT32(videoId);
ARG_UINT32(priority);
-#if 1 // TODO DEBUG Set to 0 to skip videos
+#if 0 // TODO DEBUG Set to 0 to skip videos
_vm->playVideo(videoId, objectId, priority, opCall._threadId);
#else
//DEBUG Resume calling thread, later done by the video player
diff --git a/engines/illusions/bbdou/scriptopcodes_bbdou.h b/engines/illusions/bbdou/scriptopcodes_bbdou.h
index 5385103a3e..31713828ee 100644
--- a/engines/illusions/bbdou/scriptopcodes_bbdou.h
+++ b/engines/illusions/bbdou/scriptopcodes_bbdou.h
@@ -95,7 +95,11 @@ protected:
void opSetDenySfx(ScriptThread *scriptThread, OpCall &opCall);
void opSetAdjustUpSfx(ScriptThread *scriptThread, OpCall &opCall);
void opSetAdjustDnSfx(ScriptThread *scriptThread, OpCall &opCall);
+ void opPause(ScriptThread *scriptThread, OpCall &opCall);
+ void opResume(ScriptThread *scriptThread, OpCall &opCall);
void opStartSound(ScriptThread *scriptThread, OpCall &opCall);
+ void opStartSoundAtPosition(ScriptThread *scriptThread, OpCall &opCall);
+ void opStartSoundAtActor(ScriptThread *scriptThread, OpCall &opCall);
void opStopSound(ScriptThread *scriptThread, OpCall &opCall);
void opStartMusic(ScriptThread *scriptThread, OpCall &opCall);
void opStopMusic(ScriptThread *scriptThread, OpCall &opCall);
@@ -107,6 +111,7 @@ protected:
void opResetGame(ScriptThread *scriptThread, OpCall &opCall);
void opDeactivateButton(ScriptThread *scriptThread, OpCall &opCall);
void opActivateButton(ScriptThread *scriptThread, OpCall &opCall);
+ void opNop(ScriptThread *scriptThread, OpCall &opCall);
void opJumpIf(ScriptThread *scriptThread, OpCall &opCall);
void opIsPrevSceneId(ScriptThread *scriptThread, OpCall &opCall);
void opIsCurrentSceneId(ScriptThread *scriptThread, OpCall &opCall);