aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2014-08-28 22:15:39 -0400
committerPaul Gilbert2014-08-28 22:15:39 -0400
commitd2cb9d4c4318e9c1895e492539c755fb6e3cf052 (patch)
treef8609d3c53711e4dd2818d454fa9dbc5e454db9c
parentd31a0f152ff0a80f382d0e868562867fcf7fe305 (diff)
downloadscummvm-rg350-d2cb9d4c4318e9c1895e492539c755fb6e3cf052.tar.gz
scummvm-rg350-d2cb9d4c4318e9c1895e492539c755fb6e3cf052.tar.bz2
scummvm-rg350-d2cb9d4c4318e9c1895e492539c755fb6e3cf052.zip
ACCESS: Implemented cmdFreeSound
-rw-r--r--engines/access/access.cpp4
-rw-r--r--engines/access/scripts.cpp40
-rw-r--r--engines/access/scripts.h3
-rw-r--r--engines/access/sound.cpp1
-rw-r--r--engines/access/sound.h1
5 files changed, 43 insertions, 6 deletions
diff --git a/engines/access/access.cpp b/engines/access/access.cpp
index e02b0c0da8..3e8eff3614 100644
--- a/engines/access/access.cpp
+++ b/engines/access/access.cpp
@@ -256,7 +256,7 @@ void AccessEngine::speakText(ASurface *s, Common::Array<Common::String> msgArr)
_sound->_soundTable[0] = _sound->loadSound(_narateFile + 99, _sndSubFile);
_sound->_soundPriority[0] = 1;
_sound->playSound(1);
- _scripts->CMDFREESOUND();
+ _scripts->cmdFreeSound();
_events->pollEvents();
@@ -291,7 +291,7 @@ void AccessEngine::speakText(ASurface *s, Common::Array<Common::String> msgArr)
_sound->_soundTable[0] = _sound->loadSound(_narateFile + 99, _sndSubFile);
_sound->_soundPriority[0] = 1;
_sound->playSound(1);
- _scripts->CMDFREESOUND();
+ _scripts->cmdFreeSound();
_events->pollEvents();
diff --git a/engines/access/scripts.cpp b/engines/access/scripts.cpp
index c5b7d952da..a1ede67708 100644
--- a/engines/access/scripts.cpp
+++ b/engines/access/scripts.cpp
@@ -67,6 +67,24 @@ void Scripts::searchForSequence() {
} while (sequenceId != _sequence);
}
+void Scripts::charLoop() {
+ bool endFlag = _endFlag;
+ int pos = _data->pos();
+
+ _sequence = 2000;
+ searchForSequence();
+ _vm->_images.clear();
+ _vm->_buffer2.copyFrom(_vm->_buffer1);
+ _vm->_newRects.clear();
+
+ executeScript();
+ _vm->plotList1();
+ _vm->copyBlocks();
+
+ _data->seek(pos);
+ _endFlag = endFlag;
+}
+
void Scripts::findNull() {
// No implementation required in ScummVM, the strings in the script files are already skipped by the use of readByte()
}
@@ -112,7 +130,7 @@ void Scripts::executeCommand(int commandIndex) {
&Scripts::cmdTexSpeak, &Scripts::cmdTexChoice, &Scripts::CMDWAIT,
&Scripts::cmdSetConPos, &Scripts::CMDCHECKVFRAME, &Scripts::cmdJumpChoice,
&Scripts::cmdReturnChoice, &Scripts::cmdClearBlock, &Scripts::cmdLoadSound,
- &Scripts::CMDFREESOUND, &Scripts::cmdSetVideoSound, &Scripts::cmdPlayVideoSound,
+ &Scripts::cmdFreeSound, &Scripts::cmdSetVideoSound, &Scripts::cmdPlayVideoSound,
&Scripts::CMDPUSHLOCATION, &Scripts::CMDPUSHLOCATION, &Scripts::CMDPUSHLOCATION,
&Scripts::CMDPUSHLOCATION, &Scripts::CMDPUSHLOCATION, &Scripts::cmdPlayerOff,
&Scripts::cmdPlayerOn, &Scripts::CMDDEAD, &Scripts::cmdFadeOut,
@@ -608,7 +626,7 @@ void Scripts::cmdTexChoice() {
int choice = -1;
do {
- warning("TODO CHARLOOP");
+ charLoop();
_vm->_bubbleBox->_bubblePtr = _vm->_bubbleBox->_bubbleTitle.c_str();
if (_vm->_events->_leftButton) {
if (_vm->_events->_mouseRow >= 22) {
@@ -669,7 +687,23 @@ void Scripts::cmdLoadSound() {
_vm->_sound->_soundPriority[0] = 1;
}
-void Scripts::CMDFREESOUND() { warning("TODO CMDFREESOUND"); }
+void Scripts::cmdFreeSound() {
+ SoundManager &sound = *_vm->_sound;
+
+ if (sound._soundTable.size() > 0 && sound._soundTable[0]) {
+ // Keep doing char display loop if playing sound for it
+ do {
+ if (_vm->_flags[236] == 1)
+ charLoop();
+
+ _vm->_events->pollEvents();
+ } while (!_vm->shouldQuit() && sound._playingSound);
+
+ // Free the sound
+ delete sound._soundTable[0];
+ sound._soundTable[0] = nullptr;
+ }
+}
void Scripts::cmdSetVideoSound() {
uint32 startPos = _data->pos();
diff --git a/engines/access/scripts.h b/engines/access/scripts.h
index 7568e033c0..733c7f9dd7 100644
--- a/engines/access/scripts.h
+++ b/engines/access/scripts.h
@@ -37,6 +37,7 @@ private:
Resource *_resource;
int _specialFunction;
+ void charLoop();
protected:
Common::SeekableReadStream *_data;
@@ -144,7 +145,7 @@ public:
void findNull();
- void CMDFREESOUND();
+ void cmdFreeSound();
};
} // End of namespace Access
diff --git a/engines/access/sound.cpp b/engines/access/sound.cpp
index d932cc6e44..52d9d00e08 100644
--- a/engines/access/sound.cpp
+++ b/engines/access/sound.cpp
@@ -31,6 +31,7 @@ SoundManager::SoundManager(AccessEngine *vm, Audio::Mixer *mixer) :
_vm(vm), _mixer(mixer) {
_music = nullptr;
_musicRepeat = false;
+ _playingSound = false;
}
SoundManager::~SoundManager() {
diff --git a/engines/access/sound.h b/engines/access/sound.h
index 8fef9e35fb..1a94c46773 100644
--- a/engines/access/sound.h
+++ b/engines/access/sound.h
@@ -47,6 +47,7 @@ public:
Common::Array<int> _soundPriority;
Resource *_music;
bool _musicRepeat;
+ bool _playingSound;
public:
SoundManager(AccessEngine *vm, Audio::Mixer *mixer);
~SoundManager();