diff options
author | Filippos Karapetis | 2017-03-22 05:22:36 +0200 |
---|---|---|
committer | Filippos Karapetis | 2017-03-22 05:22:36 +0200 |
commit | abe1c65d626a8f3c9487f87ebbcaeef11721bf6b (patch) | |
tree | c1917047301e67915e5969e07425e2915d770ecc /engines | |
parent | 2649e2b1fc9d0ab0d5d648602f3d6b936e94dbdb (diff) | |
download | scummvm-rg350-abe1c65d626a8f3c9487f87ebbcaeef11721bf6b.tar.gz scummvm-rg350-abe1c65d626a8f3c9487f87ebbcaeef11721bf6b.tar.bz2 scummvm-rg350-abe1c65d626a8f3c9487f87ebbcaeef11721bf6b.zip |
FULLPIPE: Change the sound code to use Common::String
Diffstat (limited to 'engines')
-rw-r--r-- | engines/fullpipe/fullpipe.cpp | 4 | ||||
-rw-r--r-- | engines/fullpipe/fullpipe.h | 10 | ||||
-rw-r--r-- | engines/fullpipe/sound.cpp | 26 |
3 files changed, 19 insertions, 21 deletions
diff --git a/engines/fullpipe/fullpipe.cpp b/engines/fullpipe/fullpipe.cpp index 32e2ea2862..ea75af1a5a 100644 --- a/engines/fullpipe/fullpipe.cpp +++ b/engines/fullpipe/fullpipe.cpp @@ -131,10 +131,6 @@ FullpipeEngine::FullpipeEngine(OSystem *syst, const ADGameDescription *gameDesc) _stream2playing = false; - memset(_sceneTracks, 0, sizeof(_sceneTracks)); - memset(_trackName, 0, sizeof(_trackName)); - memset(_sceneTracksCurrentTrack, 0, sizeof(_sceneTracksCurrentTrack)); - _numSceneTracks = 0; _sceneTrackHasSequence = false; _sceneTrackIsPlaying = false; diff --git a/engines/fullpipe/fullpipe.h b/engines/fullpipe/fullpipe.h index 3c2df9fa0c..f58c63b73f 100644 --- a/engines/fullpipe/fullpipe.h +++ b/engines/fullpipe/fullpipe.h @@ -165,15 +165,15 @@ public: int _currSoundListCount; bool _soundEnabled; bool _flgSoundList; - char _sceneTracks[10][260]; + Common::String _sceneTracks[10]; int _numSceneTracks; bool _sceneTrackHasSequence; int _musicMinDelay; int _musicMaxDelay; int _musicLocal; - char _trackName[2600]; + Common::String _trackName; int _trackStartDelay; - char _sceneTracksCurrentTrack[260]; + Common::String _sceneTracksCurrentTrack; bool _sceneTrackIsPlaying; void stopAllSounds(); @@ -183,8 +183,8 @@ public: int getSceneTrack(); void updateTrackDelay(); void startSceneTrack(); - void startSoundStream1(const char *trackName); - void playOggSound(const char *trackName, Audio::SoundHandle *stream); + void startSoundStream1(Common::String trackName); + void playOggSound(Common::String trackName, Audio::SoundHandle *stream); void stopSoundStream2(); void stopAllSoundStreams(); void stopAllSoundInstances(int id); diff --git a/engines/fullpipe/sound.cpp b/engines/fullpipe/sound.cpp index 3be7b6e395..d4c944a695 100644 --- a/engines/fullpipe/sound.cpp +++ b/engines/fullpipe/sound.cpp @@ -257,7 +257,8 @@ void FullpipeEngine::setSceneMusicParameters(GameVar *gvar) { GameVar *var = gvar->getSubVarByName("MUSIC"); - memset(_sceneTracks, 0, sizeof(_sceneTracks)); + for (int i = 0; i < 10; i++) + _sceneTracks[i].clear(); _numSceneTracks = 0; _sceneTrackHasSequence = false; @@ -273,7 +274,7 @@ void FullpipeEngine::setSceneMusicParameters(GameVar *gvar) { while (sub) { if (_musicAllowed & sub->_value.intValue) { - Common::strlcpy(_sceneTracks[_numSceneTracks], sub->_varName.c_str(), 260); + _sceneTracks[_numSceneTracks] = sub->_varName; _numSceneTracks++; } @@ -291,7 +292,7 @@ void FullpipeEngine::setSceneMusicParameters(GameVar *gvar) { if (seq) { _sceneTrackHasSequence = true; - Common::strlcpy(_trackName, seq->_value.stringValue, 2600); + _trackName = seq->_value.stringValue; } if (_musicLocal) @@ -320,12 +321,12 @@ void FullpipeEngine::startSceneTrack() { int trackNum = getSceneTrack(); if (trackNum == -1) { - strcpy(_sceneTracksCurrentTrack, "silence"); + _sceneTracksCurrentTrack = "silence"; _trackStartDelay = 2880; _sceneTrackIsPlaying = 0; } else { - strcpy(_sceneTracksCurrentTrack, _sceneTracks[trackNum]); + _sceneTracksCurrentTrack = _sceneTracks[trackNum]; startSoundStream1(_sceneTracksCurrentTrack); @@ -363,20 +364,20 @@ int FullpipeEngine::getSceneTrack() { return res; } -void FullpipeEngine::startSoundStream1(const char *trackName) { +void FullpipeEngine::startSoundStream1(Common::String trackName) { stopAllSoundStreams(); playOggSound(trackName, _soundStream1); } -void FullpipeEngine::playOggSound(const char *trackName, Audio::SoundHandle *stream) { +void FullpipeEngine::playOggSound(Common::String trackName, Audio::SoundHandle *stream) { #ifdef USE_VORBIS if (_mixer->isSoundHandleActive(*stream)) return; Common::File *track = new Common::File(); if (!track->open(trackName)) { - warning("Could not open %s", trackName); + warning("Could not open %s", trackName.c_str()); delete track; return; } @@ -429,7 +430,8 @@ void FullpipeEngine::playTrack(GameVar *sceneVar, const char *name, bool delayed GameVar *var = sceneVar->getSubVarByName(name); - memset(_sceneTracks, 0, sizeof(_sceneTracks)); + for (int i = 0; i < 10; i++) + _sceneTracks[i].clear(); _numSceneTracks = 0; _sceneTrackHasSequence = false; @@ -445,7 +447,7 @@ void FullpipeEngine::playTrack(GameVar *sceneVar, const char *name, bool delayed while (sub) { if (_musicAllowed & sub->_value.intValue) { - Common::strlcpy(_sceneTracks[_numSceneTracks], sub->_varName.c_str(), 260); + _sceneTracks[_numSceneTracks] = sub->_varName; _numSceneTracks++; } @@ -463,12 +465,12 @@ void FullpipeEngine::playTrack(GameVar *sceneVar, const char *name, bool delayed if (seq) { _sceneTrackHasSequence = true; - Common::strlcpy(_trackName, seq->_value.stringValue, 2600); + _trackName = seq->_value.stringValue; } if (delayed) { if (_sceneTrackIsPlaying && _numSceneTracks == 1) { - if (strcmp(_sceneTracksCurrentTrack, _sceneTracks[0])) + if (_sceneTracksCurrentTrack != _sceneTracks[0]) stopAllSoundStreams(); } |