aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorFilippos Karapetis2009-12-20 13:38:13 +0000
committerFilippos Karapetis2009-12-20 13:38:13 +0000
commit980b8bb89937952529d0bc39ba04e9f306b1e792 (patch)
tree5d22143688e50606dca0184f19ea67aa3761159d /engines
parentc388e891816878d14bc3c17c82bb191a27b16726 (diff)
downloadscummvm-rg350-980b8bb89937952529d0bc39ba04e9f306b1e792.tar.gz
scummvm-rg350-980b8bb89937952529d0bc39ba04e9f306b1e792.tar.bz2
scummvm-rg350-980b8bb89937952529d0bc39ba04e9f306b1e792.zip
Moved all of the sound iterator code in its own directory, and added a slight hack to the SoundCommandParser constructor
svn-id: r46430
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/console.cpp4
-rw-r--r--engines/sci/engine/savegame.cpp4
-rw-r--r--engines/sci/engine/state.h2
-rw-r--r--engines/sci/module.mk6
-rw-r--r--engines/sci/sci.cpp4
-rw-r--r--engines/sci/sfx/iterator/core.cpp (renamed from engines/sci/sfx/core.cpp)8
-rw-r--r--engines/sci/sfx/iterator/core.h (renamed from engines/sci/sfx/core.h)8
-rw-r--r--engines/sci/sfx/iterator/iterator.cpp (renamed from engines/sci/sfx/iterator.cpp)8
-rw-r--r--engines/sci/sfx/iterator/iterator.h (renamed from engines/sci/sfx/iterator.h)5
-rw-r--r--engines/sci/sfx/iterator/iterator_internal.h (renamed from engines/sci/sfx/iterator_internal.h)7
-rw-r--r--engines/sci/sfx/iterator/songlib.cpp (renamed from engines/sci/sfx/songlib.cpp)9
-rw-r--r--engines/sci/sfx/iterator/songlib.h (renamed from engines/sci/sfx/songlib.h)5
-rw-r--r--engines/sci/sfx/iterator/test-iterator.cpp (renamed from engines/sci/sfx/test-iterator.cpp)0
-rw-r--r--engines/sci/sfx/soundcmd.cpp9
-rw-r--r--engines/sci/sfx/soundcmd.h2
15 files changed, 60 insertions, 21 deletions
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp
index bf452e8ca9..00aebd23e3 100644
--- a/engines/sci/console.cpp
+++ b/engines/sci/console.cpp
@@ -41,8 +41,8 @@
#include "sci/gfx/gfx_widgets.h" // for getPort
#endif
#ifdef USE_OLD_MUSIC_FUNCTIONS
-#include "sci/sfx/songlib.h" // for SongLibrary
-#include "sci/sfx/iterator.h" // for SCI_SONG_ITERATOR_TYPE_SCI0
+#include "sci/sfx/iterator/songlib.h" // for SongLibrary
+#include "sci/sfx/iterator/iterator.h" // for SCI_SONG_ITERATOR_TYPE_SCI0
#endif
#include "sci/sfx/softseq/mididriver.h"
#include "sci/vocabulary.h"
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index 67fcb8d7be..0946641320 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -43,8 +43,8 @@
#include "sci/gui/gui.h"
#include "sci/sfx/audio.h"
#ifdef USE_OLD_MUSIC_FUNCTIONS
-#include "sci/sfx/core.h"
-#include "sci/sfx/iterator.h"
+#include "sci/sfx/iterator/core.h"
+#include "sci/sfx/iterator/iterator.h"
#endif
namespace Sci {
diff --git a/engines/sci/engine/state.h b/engines/sci/engine/state.h
index ce304e98d8..053fc51f18 100644
--- a/engines/sci/engine/state.h
+++ b/engines/sci/engine/state.h
@@ -44,7 +44,7 @@ namespace Common {
#include "sci/gfx/gfx_system.h"
#include "sci/sfx/audio.h"
#ifdef USE_OLD_MUSIC_FUNCTIONS
-#include "sci/sfx/core.h"
+#include "sci/sfx/iterator/core.h"
#endif
#include "sci/sfx/soundcmd.h"
diff --git a/engines/sci/module.mk b/engines/sci/module.mk
index 6a273eacf6..556c4ecdbf 100644
--- a/engines/sci/module.mk
+++ b/engines/sci/module.mk
@@ -69,11 +69,11 @@ MODULE_OBJS := \
gui32/res_pic.o \
gui32/res_view.o \
sfx/audio.o \
- sfx/core.o \
- sfx/iterator.o \
sfx/music.o \
- sfx/songlib.o \
sfx/soundcmd.o \
+ sfx/iterator/core.o \
+ sfx/iterator/iterator.o \
+ sfx/iterator/songlib.o \
sfx/seq/gm.o \
sfx/seq/instrument-map.o \
sfx/seq/map-mt32-to-gm.o \
diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp
index f2f2c6e218..5daa8e2e23 100644
--- a/engines/sci/sci.cpp
+++ b/engines/sci/sci.cpp
@@ -166,7 +166,7 @@ Common::Error SciEngine::run() {
// since we cannot let the game control where saves are stored)
strcpy(_gamestate->sys_strings->_strings[SYS_STRING_SAVEDIR]._value, "/");
- _gamestate->_soundCmd = new SoundCommandParser(_resMan, segMan, &_gamestate->_sound, _audio, _gamestate->detectDoSoundType());
+ _gamestate->_soundCmd = new SoundCommandParser(_resMan, segMan, _audio, _gamestate->detectDoSoundType());
GfxState gfx_state;
_gamestate->gfx_state = &gfx_state;
@@ -269,7 +269,9 @@ Common::String SciEngine::unwrapFilename(const Common::String &name) const {
}
void SciEngine::pauseEngineIntern(bool pause) {
+#ifdef USE_OLD_MUSIC_FUNCTIONS
_gamestate->_sound.sfx_suspend(pause);
+#endif
_mixer->pauseAll(pause);
}
diff --git a/engines/sci/sfx/core.cpp b/engines/sci/sfx/iterator/core.cpp
index 8da2c7cda5..0d11344b9f 100644
--- a/engines/sci/sfx/core.cpp
+++ b/engines/sci/sfx/iterator/core.cpp
@@ -26,8 +26,10 @@
/* Sound subsystem core: Event handler, sound player dispatching */
#include "sci/sci.h"
-#include "sci/sfx/core.h"
-#include "sci/sfx/iterator.h"
+#ifdef USE_OLD_MUSIC_FUNCTIONS
+
+#include "sci/sfx/iterator/core.h"
+#include "sci/sfx/iterator/iterator.h"
#include "sci/sfx/softseq/mididriver.h"
#include "sci/sfx/softseq/pcjr.h"
@@ -1007,3 +1009,5 @@ void SfxState::sfx_all_stop() {
}
} // End of namespace Sci
+
+#endif // USE_OLD_MUSIC_FUNCTIONS
diff --git a/engines/sci/sfx/core.h b/engines/sci/sfx/iterator/core.h
index 60696583b7..0d3bbfb6a2 100644
--- a/engines/sci/sfx/core.h
+++ b/engines/sci/sfx/iterator/core.h
@@ -28,7 +28,11 @@
#define SCI_SFX_CORE_H
#include "common/error.h"
-#include "sci/sfx/songlib.h"
+
+#include "sci/sci.h" // for USE_OLD_MUSIC_FUNCTIONS
+
+#ifdef USE_OLD_MUSIC_FUNCTIONS
+#include "sci/sfx/iterator/songlib.h"
#include "sci/resource.h"
namespace Sci {
@@ -200,4 +204,6 @@ protected:
} // End of namespace Sci
+#endif // USE_OLD_MUSIC_FUNCTIONS
+
#endif // SCI_SFX_CORE_H
diff --git a/engines/sci/sfx/iterator.cpp b/engines/sci/sfx/iterator/iterator.cpp
index ba82211ada..924e1de0bc 100644
--- a/engines/sci/sfx/iterator.cpp
+++ b/engines/sci/sfx/iterator/iterator.cpp
@@ -28,9 +28,11 @@
#include "common/util.h"
#include "sci/sci.h"
-#include "sci/sfx/iterator_internal.h"
+#ifdef USE_OLD_MUSIC_FUNCTIONS
+
+#include "sci/sfx/iterator/iterator_internal.h"
#include "sci/engine/state.h" // for sfx_player_tell_synth :/
-#include "sci/sfx/core.h" // for sfx_player_tell_synth
+#include "sci/sfx/iterator/core.h" // for sfx_player_tell_synth
#include "sound/audiostream.h"
#include "sound/mixer.h"
@@ -1701,3 +1703,5 @@ SongIterator *sfx_iterator_combine(SongIterator *it1, SongIterator *it2) {
}
} // End of namespace Sci
+
+#endif // USE_OLD_MUSIC_FUNCTIONS
diff --git a/engines/sci/sfx/iterator.h b/engines/sci/sfx/iterator/iterator.h
index f4e87d5b7f..ffd0679213 100644
--- a/engines/sci/sfx/iterator.h
+++ b/engines/sci/sfx/iterator/iterator.h
@@ -28,6 +28,9 @@
#ifndef SCI_SFX_SFX_ITERATOR_H
#define SCI_SFX_SFX_ITERATOR_H
+#include "sci/sci.h" // for USE_OLD_MUSIC_FUNCTIONS
+
+#ifdef USE_OLD_MUSIC_FUNCTIONS
#include "sci/sfx/softseq/mididriver.h"
namespace Audio {
@@ -318,4 +321,6 @@ SongIterator *sfx_iterator_combine(SongIterator *it1, SongIterator *it2);
} // End of namespace Sci
+#endif // USE_OLD_MUSIC_FUNCTIONS
+
#endif // SCI_SFX_SFX_ITERATOR_H
diff --git a/engines/sci/sfx/iterator_internal.h b/engines/sci/sfx/iterator/iterator_internal.h
index 1b5d856d33..f41b388008 100644
--- a/engines/sci/sfx/iterator_internal.h
+++ b/engines/sci/sfx/iterator/iterator_internal.h
@@ -26,7 +26,10 @@
#ifndef SCI_SFX_SFX_ITERATOR_INTERNAL
#define SCI_SFX_SFX_ITERATOR_INTERNAL
-#include "sci/sfx/iterator.h"
+#include "sci/sci.h" // for USE_OLD_MUSIC_FUNCTIONS
+
+#ifdef USE_OLD_MUSIC_FUNCTIONS
+#include "sci/sfx/iterator/iterator.h"
#include "sci/sfx/softseq/mididriver.h"
#include "common/array.h"
@@ -268,4 +271,6 @@ public:
} // End of namespace Sci
+#endif // USE_OLD_MUSIC_FUNCTIONS
+
#endif // SCI_SFX_SFX_ITERATOR_INTERNAL
diff --git a/engines/sci/sfx/songlib.cpp b/engines/sci/sfx/iterator/songlib.cpp
index c30478d50d..657e52017d 100644
--- a/engines/sci/sfx/songlib.cpp
+++ b/engines/sci/sfx/iterator/songlib.cpp
@@ -23,8 +23,11 @@
*
*/
-#include "sci/sfx/core.h"
-#include "sci/sfx/iterator.h"
+#include "sci/sci.h" // for USE_OLD_MUSIC_FUNCTIONS
+
+#ifdef USE_OLD_MUSIC_FUNCTIONS
+#include "sci/sfx/iterator/core.h"
+#include "sci/sfx/iterator/iterator.h"
namespace Sci {
@@ -182,3 +185,5 @@ void SongLibrary::setSongRestoreBehavior(SongHandle handle, RESTORE_BEHAVIOR act
}
} // End of namespace Sci
+
+#endif // USE_OLD_MUSIC_FUNCTIONS
diff --git a/engines/sci/sfx/songlib.h b/engines/sci/sfx/iterator/songlib.h
index 97c8ec8cc2..acb704edaa 100644
--- a/engines/sci/sfx/songlib.h
+++ b/engines/sci/sfx/iterator/songlib.h
@@ -31,6 +31,9 @@
#include "common/scummsys.h"
#include "sound/timestamp.h"
+#include "sci/sci.h" // for USE_OLD_MUSIC_FUNCTIONS
+#ifdef USE_OLD_MUSIC_FUNCTIONS
+
namespace Sci {
class SongIterator;
@@ -163,4 +166,6 @@ public:
} // End of namespace Sci
+#endif // USE_OLD_MUSIC_FUNCTIONS
+
#endif // SCI_SSFX_SFX_SONGLIB_H
diff --git a/engines/sci/sfx/test-iterator.cpp b/engines/sci/sfx/iterator/test-iterator.cpp
index 0d603a89fd..0d603a89fd 100644
--- a/engines/sci/sfx/test-iterator.cpp
+++ b/engines/sci/sfx/iterator/test-iterator.cpp
diff --git a/engines/sci/sfx/soundcmd.cpp b/engines/sci/sfx/soundcmd.cpp
index 3b95ba28e3..adc732a6c6 100644
--- a/engines/sci/sfx/soundcmd.cpp
+++ b/engines/sci/sfx/soundcmd.cpp
@@ -23,7 +23,7 @@
*
*/
-#include "sci/sfx/iterator.h" // for SongIteratorStatus
+#include "sci/sfx/iterator/iterator.h" // for SongIteratorStatus
#include "sci/sfx/music.h"
#include "sci/sfx/soundcmd.h"
@@ -126,8 +126,11 @@ void process_sound_events(EngineState *s) { /* Get all sound events, apply their
#define SOUNDCOMMAND(x) _soundCommands.push_back(new SciSoundCommand(#x, &SoundCommandParser::x))
-SoundCommandParser::SoundCommandParser(ResourceManager *resMan, SegManager *segMan, SfxState *state, AudioPlayer *audio, SciVersion doSoundVersion) :
- _resMan(resMan), _segMan(segMan), _state(state), _audio(audio), _doSoundVersion(doSoundVersion) {
+SoundCommandParser::SoundCommandParser(ResourceManager *resMan, SegManager *segMan, AudioPlayer *audio, SciVersion doSoundVersion) :
+ _resMan(resMan), _segMan(segMan), _audio(audio), _doSoundVersion(doSoundVersion) {
+
+ // The following hack is needed to ease the change from old to new sound code (because the new sound code does not use SfxState)
+ _state = &((SciEngine *)g_engine)->getEngineState()->_sound; // HACK
_hasNodePtr = (((SciEngine*)g_engine)->getKernel()->_selectorCache.nodePtr != -1);
diff --git a/engines/sci/sfx/soundcmd.h b/engines/sci/sfx/soundcmd.h
index ac5f615f5a..593c4f4a1e 100644
--- a/engines/sci/sfx/soundcmd.h
+++ b/engines/sci/sfx/soundcmd.h
@@ -43,7 +43,7 @@ struct SciSoundCommand {
class SoundCommandParser {
public:
- SoundCommandParser(ResourceManager *resMan, SegManager *segMan, SfxState *state, AudioPlayer *audio, SciVersion doSoundVersion);
+ SoundCommandParser(ResourceManager *resMan, SegManager *segMan, AudioPlayer *audio, SciVersion doSoundVersion);
~SoundCommandParser();
void updateSfxState(SfxState *newState) { _state = newState; }