diff options
Diffstat (limited to 'engines/parallaction')
-rw-r--r-- | engines/parallaction/parallaction.cpp | 18 | ||||
-rw-r--r-- | engines/parallaction/parser_ns.cpp | 2 | ||||
-rw-r--r-- | engines/parallaction/sound.h | 18 | ||||
-rw-r--r-- | engines/parallaction/sound_ns.cpp | 25 |
4 files changed, 36 insertions, 27 deletions
diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp index a295aa950e..69d5d7c6f5 100644 --- a/engines/parallaction/parallaction.cpp +++ b/engines/parallaction/parallaction.cpp @@ -142,7 +142,7 @@ Common::Error Parallaction::init() { void Parallaction::pauseEngineIntern(bool pause) { if (_soundMan) { - _soundMan->execute(SC_PAUSE, (SoundManCommandParameter)pause); + _soundMan->execute(SC_PAUSE, pause); } } @@ -635,10 +635,10 @@ void Parallaction::runZone(ZonePtr z) { break; case kZoneHear: - _soundMan->execute(SC_SETSFXCHANNEL, (SoundManCommandParameter)z->u.hear->_channel); - _soundMan->execute(SC_SETSFXLOOPING, (SoundManCommandParameter)((z->_flags & kFlagsLooping) == kFlagsLooping)); - _soundMan->execute(SC_SETSFXVOLUME, (SoundManCommandParameter)60); - _soundMan->execute(SC_PLAYSFX, (SoundManCommandParameter)z->u.hear->_name); + _soundMan->execute(SC_SETSFXCHANNEL, z->u.hear->_channel); + _soundMan->execute(SC_SETSFXLOOPING, ((z->_flags & kFlagsLooping) == kFlagsLooping)); + _soundMan->execute(SC_SETSFXVOLUME, 60); + _soundMan->execute(SC_PLAYSFX, z->u.hear->_name); break; case kZoneSpeak: @@ -984,10 +984,10 @@ bool CharacterName::dummy() const { } void Parallaction::beep() { - _soundMan->execute(SC_SETSFXCHANNEL, (SoundManCommandParameter)3); - _soundMan->execute(SC_SETSFXVOLUME, (SoundManCommandParameter)127); - _soundMan->execute(SC_SETSFXLOOPING, (SoundManCommandParameter)false); - _soundMan->execute(SC_PLAYSFX, (SoundManCommandParameter)"beep"); + _soundMan->execute(SC_SETSFXCHANNEL, 3); + _soundMan->execute(SC_SETSFXVOLUME, 127); + _soundMan->execute(SC_SETSFXLOOPING, 0); + _soundMan->execute(SC_PLAYSFX, "beep"); } void Parallaction::scheduleLocationSwitch(const char *location) { diff --git a/engines/parallaction/parser_ns.cpp b/engines/parallaction/parser_ns.cpp index b08de2e31a..e6db9bf17b 100644 --- a/engines/parallaction/parser_ns.cpp +++ b/engines/parallaction/parser_ns.cpp @@ -1089,7 +1089,7 @@ DECLARE_LOCATION_PARSER(music) { debugC(7, kDebugParser, "LOCATION_PARSER(music) "); if (_vm->getPlatform() == Common::kPlatformAmiga) - _vm->_soundMan->execute(SC_SETMUSICFILE, (SoundManCommandParameter)_tokens[1]); + _vm->_soundMan->execute(SC_SETMUSICFILE, _tokens[1]); } void LocationParser_ns::parse(Script *script) { diff --git a/engines/parallaction/sound.h b/engines/parallaction/sound.h index e3eac1ccff..72d22e02b4 100644 --- a/engines/parallaction/sound.h +++ b/engines/parallaction/sound.h @@ -43,11 +43,9 @@ namespace Parallaction { class Parallaction_ns; class MidiPlayer; -typedef void* SoundManCommandParameter; - class SoundManImpl { public: - virtual void execute(int command, SoundManCommandParameter parm) = 0; + virtual void execute(int command, const char *parm = 0) = 0; virtual ~SoundManImpl() { } }; @@ -56,7 +54,15 @@ class SoundMan { public: SoundMan(SoundManImpl *impl) : _impl(impl) { } virtual ~SoundMan() { delete _impl; } - void execute(int command, SoundManCommandParameter parm = 0) { + void execute(int command, bool parm) { + execute(command, parm ? "1" : "0"); + } + void execute(int command, int32 parm) { + char n[12]; + sprintf(n, "%i", parm); + execute(command, n); + } + void execute(int command, const char *parm = 0) { if (_impl) { _impl->execute(command, parm); } @@ -111,7 +117,7 @@ public: virtual void playCharacterMusic(const char *character) = 0; virtual void playLocationMusic(const char *location) = 0; virtual void pause(bool p) { } - virtual void execute(int command, SoundManCommandParameter parm = 0); + virtual void execute(int command, const char *parm); void setMusicVolume(int value); }; @@ -168,7 +174,7 @@ public: class DummySoundMan : public SoundManImpl { public: - void execute(int command, SoundManCommandParameter parm) { } + void execute(int command, const char *parm) { } }; } // namespace Parallaction diff --git a/engines/parallaction/sound_ns.cpp b/engines/parallaction/sound_ns.cpp index 20dc7dcd25..76f6811461 100644 --- a/engines/parallaction/sound_ns.cpp +++ b/engines/parallaction/sound_ns.cpp @@ -477,42 +477,45 @@ void SoundMan_ns::setMusicFile(const char *filename) { strcpy(_musicFile, filename); } -void SoundMan_ns::execute(int command, SoundManCommandParameter parm) { +void SoundMan_ns::execute(int command, const char *parm = 0) { + uint32 n = strtoul(parm, 0, 10); + bool b = (n == 1) ? true : false; + switch (command) { case SC_PLAYMUSIC: - if (_musicType == MUSIC_CHARACTER) playCharacterMusic((const char*)parm); - else if (_musicType == MUSIC_LOCATION) playLocationMusic((const char*)parm); + if (_musicType == MUSIC_CHARACTER) playCharacterMusic(parm); + else if (_musicType == MUSIC_LOCATION) playLocationMusic(parm); else playMusic(); break; case SC_STOPMUSIC: stopMusic(); break; case SC_SETMUSICTYPE: - _musicType = (int)parm; + _musicType = n; break; case SC_SETMUSICFILE: - setMusicFile((const char*)parm); + setMusicFile(parm); break; case SC_PLAYSFX: - playSfx((const char*)parm, _sfxChannel, _sfxLooping, _sfxVolume); + playSfx(parm, _sfxChannel, _sfxLooping, _sfxVolume); break; case SC_STOPSFX: - stopSfx((int)parm); + stopSfx(n); break; case SC_SETSFXCHANNEL: - _sfxChannel = (uint)parm; + _sfxChannel = n; break; case SC_SETSFXLOOPING: - _sfxLooping = (bool)parm; + _sfxLooping = b; break; case SC_SETSFXVOLUME: - _sfxVolume = (int)parm; + _sfxVolume = n; break; case SC_PAUSE: - pause((bool)parm); + pause(b); break; } } |