aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippos Karapetis2009-11-17 06:39:28 +0000
committerFilippos Karapetis2009-11-17 06:39:28 +0000
commit4ce5d81a4d8fcd8a23e2db99f192887cb3922fa9 (patch)
tree9ce1b4b7eb66d62564d3b6cc0424d2b7bab0efb7
parent4f0dfb0d0965627eb0a01eecf5772da75ed7548a (diff)
downloadscummvm-rg350-4ce5d81a4d8fcd8a23e2db99f192887cb3922fa9.tar.gz
scummvm-rg350-4ce5d81a4d8fcd8a23e2db99f192887cb3922fa9.tar.bz2
scummvm-rg350-4ce5d81a4d8fcd8a23e2db99f192887cb3922fa9.zip
Some more work on the sound command parser
svn-id: r45944
-rw-r--r--engines/sci/sfx/soundcmd.cpp64
-rw-r--r--engines/sci/sfx/soundcmd.h2
2 files changed, 35 insertions, 31 deletions
diff --git a/engines/sci/sfx/soundcmd.cpp b/engines/sci/sfx/soundcmd.cpp
index 2e0629edc4..460f78b83c 100644
--- a/engines/sci/sfx/soundcmd.cpp
+++ b/engines/sci/sfx/soundcmd.cpp
@@ -207,6 +207,8 @@ reg_t SoundCommandParser::parseCommand(int argc, reg_t *argv, reg_t acc) {
SongHandle handle = FROBNICATE_HANDLE(obj);
int value = (argc > 2) ? argv[2].toSint16() : 0;
_acc = acc;
+ _argc = argc;
+ _argv = argv;
if (argc > 5) { // for cmdSendMidi
_midiCmd = argv[3].toUint16() == 0xff ?
@@ -243,7 +245,7 @@ void SoundCommandParser::cmdInitHandle(reg_t obj, SongHandle handle, int value)
// Some games try to init non-existing sounds (e.g. KQ6)
if (_doSoundVersion == SCI_VERSION_1_LATE) {
- if (!obj.segment || !_resMan->testResource(ResourceId(kResourceTypeSound, value)))
+ if (!_resMan->testResource(ResourceId(kResourceTypeSound, value)))
return;
}
@@ -286,12 +288,13 @@ void SoundCommandParser::cmdPlayHandle(reg_t obj, SongHandle handle, int value)
if (!obj.segment)
return;
- _state->sfx_song_set_status(handle, SOUND_STATUS_PLAYING);
- _state->sfx_song_set_loops(handle, GET_SEL32V(_segMan, obj, loop));
-
if (_doSoundVersion == SCI_VERSION_0_EARLY) {
+ _state->sfx_song_set_status(handle, SOUND_STATUS_PLAYING);
+ _state->sfx_song_set_loops(handle, GET_SEL32V(_segMan, obj, loop));
PUT_SEL32V(_segMan, obj, state, _K_SOUND_STATUS_PLAYING);
} else if (_doSoundVersion == SCI_VERSION_1_EARLY) {
+ _state->sfx_song_set_status(handle, SOUND_STATUS_PLAYING);
+ _state->sfx_song_set_loops(handle, GET_SEL32V(_segMan, obj, loop));
_state->sfx_song_renice(handle, GET_SEL32V(_segMan, obj, pri));
RESTORE_BEHAVIOR rb = (RESTORE_BEHAVIOR) value; /* Too lazy to look up a default value for this */
_state->_songlib.setSongRestoreBehavior(handle, rb);
@@ -417,39 +420,38 @@ void SoundCommandParser::cmdHandlePriority(reg_t obj, SongHandle handle, int val
}
void SoundCommandParser::cmdFadeHandle(reg_t obj, SongHandle handle, int value) {
+ if (!obj.segment)
+ return;
+
/*s->sound_server->command(s, SOUND_COMMAND_FADE_HANDLE, obj, 120);*/ /* Fade out in 2 secs */
/* FIXME: The next couple of lines actually STOP the handle, rather
** than fading it! */
- if (obj.segment) {
- _state->sfx_song_set_status(handle, SOUND_STATUS_STOPPED);
- if (!_hasNodePtr)
- PUT_SEL32V(_segMan, obj, state, SOUND_STATUS_STOPPED);
- PUT_SEL32V(_segMan, obj, signal, SIGNAL_OFFSET);
- }
+ _state->sfx_song_set_status(handle, SOUND_STATUS_STOPPED);
+ if (!_hasNodePtr)
+ PUT_SEL32V(_segMan, obj, state, SOUND_STATUS_STOPPED);
+ PUT_SEL32V(_segMan, obj, signal, SIGNAL_OFFSET);
-#if 0
+ if (_doSoundVersion == SCI_VERSION_1_LATE) {
fade_params_t fade;
- if (obj.segment) {
- fade.final_volume = argv[2].toUint16();
- fade.ticks_per_step = argv[3].toUint16();
- fade.step_size = argv[4].toUint16();
- fade.action = argv[5].toUint16() ?
- FADE_ACTION_FADE_AND_STOP :
- FADE_ACTION_FADE_AND_CONT;
-
- s->_sound.sfx_song_set_fade(handle, &fade);
-
- /* FIXME: The next couple of lines actually STOP the handle, rather
- ** than fading it! */
- if (argv[5].toUint16()) {
- PUT_SEL32V(segMan, obj, signal, SIGNAL_OFFSET);
- s->_sound.sfx_song_set_status(handle, SOUND_STATUS_STOPPED);
- } else {
- // FIXME: Support fade-and-continue. For now, send signal right away.
- PUT_SEL32V(segMan, obj, signal, SIGNAL_OFFSET);
- }
+ fade.final_volume = _argv[2].toUint16();
+ fade.ticks_per_step = _argv[3].toUint16();
+ fade.step_size = _argv[4].toUint16();
+ fade.action = _argv[5].toUint16() ?
+ FADE_ACTION_FADE_AND_STOP :
+ FADE_ACTION_FADE_AND_CONT;
+
+ _state->sfx_song_set_fade(handle, &fade);
+
+ /* FIXME: The next couple of lines actually STOP the handle, rather
+ ** than fading it! */
+ if (_argv[5].toUint16()) {
+ PUT_SEL32V(_segMan, obj, signal, SIGNAL_OFFSET);
+ _state->sfx_song_set_status(handle, SOUND_STATUS_STOPPED);
+ } else {
+ // FIXME: Support fade-and-continue. For now, send signal right away.
+ PUT_SEL32V(_segMan, obj, signal, SIGNAL_OFFSET);
}
-#endif
+ }
}
void SoundCommandParser::cmdGetPolyphony(reg_t obj, SongHandle handle, int value) {
diff --git a/engines/sci/sfx/soundcmd.h b/engines/sci/sfx/soundcmd.h
index 16700124cd..4f49a161eb 100644
--- a/engines/sci/sfx/soundcmd.h
+++ b/engines/sci/sfx/soundcmd.h
@@ -57,6 +57,8 @@ private:
AudioPlayer *_audio;
bool _hasNodePtr;
SciVersion _doSoundVersion;
+ int _argc;
+ reg_t *_argv;
reg_t _acc;
int _midiCmd, _controller, _param;