[Scummvm-cvs-logs] SF.net SVN: scummvm:[50484] scummvm/trunk/engines/sci
thebluegr at users.sourceforge.net
thebluegr at users.sourceforge.net
Tue Jun 29 11:00:08 CEST 2010
Revision: 50484
http://scummvm.svn.sourceforge.net/scummvm/?rev=50484&view=rev
Author: thebluegr
Date: 2010-06-29 09:00:08 +0000 (Tue, 29 Jun 2010)
Log Message:
-----------
SCI: Made the SoundCommandParser a member of the SciEngine class and removed it from the EngineState, since it's static throughout the course of a game
Modified Paths:
--------------
scummvm/trunk/engines/sci/console.cpp
scummvm/trunk/engines/sci/engine/kevent.cpp
scummvm/trunk/engines/sci/engine/ksound.cpp
scummvm/trunk/engines/sci/engine/savegame.cpp
scummvm/trunk/engines/sci/engine/state.cpp
scummvm/trunk/engines/sci/engine/state.h
scummvm/trunk/engines/sci/sci.cpp
scummvm/trunk/engines/sci/sci.h
Modified: scummvm/trunk/engines/sci/console.cpp
===================================================================
--- scummvm/trunk/engines/sci/console.cpp 2010-06-29 06:38:00 UTC (rev 50483)
+++ scummvm/trunk/engines/sci/console.cpp 2010-06-29 09:00:08 UTC (rev 50484)
@@ -219,8 +219,8 @@
if (_engine->_gamestate)
_engine->_gamestate->_sound.sfx_suspend(true);
#endif
- if (_engine->_gamestate && _engine->_gamestate->_soundCmd)
- _engine->_gamestate->_soundCmd->pauseAll(true);
+ if (g_sci && g_sci->_soundCmd)
+ g_sci->_soundCmd->pauseAll(true);
}
void Console::postEnter() {
@@ -228,8 +228,8 @@
if (_engine->_gamestate)
_engine->_gamestate->_sound.sfx_suspend(false);
#endif
- if (_engine->_gamestate && _engine->_gamestate->_soundCmd)
- _engine->_gamestate->_soundCmd->pauseAll(false);
+ if (g_sci && g_sci->_soundCmd)
+ g_sci->_soundCmd->pauseAll(false);
if (!_videoFile.empty()) {
_engine->_gfxCursor->kernelHide();
@@ -1662,7 +1662,7 @@
} while (seeker);
DebugPrintf("\n");
#else
- _engine->_gamestate->_soundCmd->printPlayList(this);
+ g_sci->_soundCmd->printPlayList(this);
#endif
return true;
@@ -1683,7 +1683,7 @@
return true;
}
- _engine->_gamestate->_soundCmd->printSongInfo(addr, this);
+ g_sci->_soundCmd->printSongInfo(addr, this);
return true;
}
@@ -1702,7 +1702,7 @@
return true;
}
- _engine->_gamestate->_soundCmd->startNewSound(number);
+ g_sci->_soundCmd->startNewSound(number);
return false;
}
@@ -1743,9 +1743,9 @@
newState.toLowercase();
if (newState == "play")
- _engine->_gamestate->_soundCmd->playSound(id);
+ g_sci->_soundCmd->playSound(id);
else if (newState == "stop")
- _engine->_gamestate->_soundCmd->stopSound(id);
+ g_sci->_soundCmd->stopSound(id);
else
DebugPrintf("New state can either be 'play' or 'stop'");
#endif
@@ -1755,7 +1755,7 @@
bool Console::cmdStopAllSounds(int argc, const char **argv) {
#ifndef USE_OLD_MUSIC_FUNCTIONS
- _engine->_gamestate->_soundCmd->stopAllSounds();
+ g_sci->_soundCmd->stopAllSounds();
#endif
DebugPrintf("All sounds have been stopped\n");
Modified: scummvm/trunk/engines/sci/engine/kevent.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kevent.cpp 2010-06-29 06:38:00 UTC (rev 50483)
+++ scummvm/trunk/engines/sci/engine/kevent.cpp 2010-06-29 09:00:08 UTC (rev 50484)
@@ -156,7 +156,7 @@
// like SCI01 and later do with cmdUpdateSoundCues. kGetEvent is called
// quite often, so emulate the SCI01 behavior of cmdUpdateSoundCues with
// this call
- s->_soundCmd->updateSci0Cues();
+ g_sci->_soundCmd->updateSci0Cues();
}
#endif
Modified: scummvm/trunk/engines/sci/engine/ksound.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/ksound.cpp 2010-06-29 06:38:00 UTC (rev 50483)
+++ scummvm/trunk/engines/sci/engine/ksound.cpp 2010-06-29 09:00:08 UTC (rev 50484)
@@ -39,7 +39,7 @@
* Used for synthesized music playback
*/
reg_t kDoSound(EngineState *s, int argc, reg_t *argv) {
- return s->_soundCmd->parseCommand(argc, argv, s->r_acc);
+ return g_sci->_soundCmd->parseCommand(argc, argv, s->r_acc);
}
reg_t kDoCdAudio(EngineState *s, int argc, reg_t *argv) {
Modified: scummvm/trunk/engines/sci/engine/savegame.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/savegame.cpp 2010-06-29 06:38:00 UTC (rev 50483)
+++ scummvm/trunk/engines/sci/engine/savegame.cpp 2010-06-29 09:00:08 UTC (rev 50484)
@@ -385,7 +385,7 @@
#ifdef USE_OLD_MUSIC_FUNCTIONS
sync_songlib(s, _sound._songlib);
#else
- _soundCmd->syncPlayList(s);
+ g_sci->_soundCmd->syncPlayList(s);
#endif
}
@@ -978,7 +978,7 @@
s->_sound._suspended = s->_sound._suspended;
reconstruct_sounds(s);
#else
- s->_soundCmd->reconstructPlayList(meta.savegame_version);
+ g_sci->_soundCmd->reconstructPlayList(meta.savegame_version);
#endif
// Message state:
Modified: scummvm/trunk/engines/sci/engine/state.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/state.cpp 2010-06-29 06:38:00 UTC (rev 50483)
+++ scummvm/trunk/engines/sci/engine/state.cpp 2010-06-29 09:00:08 UTC (rev 50484)
@@ -87,7 +87,6 @@
if (!isRestoring) {
_memorySegmentSize = 0;
- _soundCmd = 0;
_fileHandles.resize(5);
Modified: scummvm/trunk/engines/sci/engine/state.h
===================================================================
--- scummvm/trunk/engines/sci/engine/state.h 2010-06-29 06:38:00 UTC (rev 50483)
+++ scummvm/trunk/engines/sci/engine/state.h 2010-06-29 09:00:08 UTC (rev 50484)
@@ -109,7 +109,6 @@
SfxState _sound; /**< sound subsystem */
int sfx_init_flags; /**< flags the sfx subsystem was initialised with */
#endif
- SoundCommandParser *_soundCmd;
uint32 gameStartTime; /**< The time at which the interpreter was started */
uint32 lastWaitTime; /**< The last time the game invoked Wait() */
Modified: scummvm/trunk/engines/sci/sci.cpp
===================================================================
--- scummvm/trunk/engines/sci/sci.cpp 2010-06-29 06:38:00 UTC (rev 50483)
+++ scummvm/trunk/engines/sci/sci.cpp 2010-06-29 09:00:08 UTC (rev 50484)
@@ -154,6 +154,7 @@
delete _gfxScreen;
delete _audio;
+ delete _soundCmd;
delete _kernel;
delete _vocabulary;
delete _console;
@@ -161,7 +162,6 @@
delete _gfxMacIconBar;
delete _eventMan;
- delete _gamestate->_soundCmd;
delete _gamestate->_segMan;
delete _gamestate;
delete _resMan; // should be deleted last
@@ -216,16 +216,14 @@
return Common::kUnknownError;
}
- _kernel->loadKernelNames(_features); // Must be called after game_init()
-
script_adjust_opcode_formats();
- SciVersion soundVersion = _features->detectDoSoundType();
+ // Must be called after game_init(), as they use _features
+ _kernel->loadKernelNames(_features);
+ _soundCmd = new SoundCommandParser(_resMan, segMan, _kernel, _audio, _features->detectDoSoundType());
- _gamestate->_soundCmd = new SoundCommandParser(_resMan, segMan, _kernel, _audio, soundVersion);
-
#ifdef USE_OLD_MUSIC_FUNCTIONS
- initGameSound(0, soundVersion);
+ initGameSound(0, _features->detectDoSoundType());
#endif
syncSoundSettings();
@@ -463,7 +461,7 @@
initGameSound(SFX_STATE_FLAG_NOSOUND, _features->detectDoSoundType());
#else
_audio->stopAllAudio();
- _gamestate->_soundCmd->clearPlayList();
+ g_sci->_soundCmd->clearPlayList();
#endif
}
@@ -562,9 +560,9 @@
int soundVolumeMusic = (mute ? 0 : ConfMan.getInt("music_volume"));
- if (_gamestate && _gamestate->_soundCmd) {
+ if (_gamestate && g_sci->_soundCmd) {
int vol = (soundVolumeMusic + 1) * SoundCommandParser::kMaxSciVolume / Audio::Mixer::kMaxMixerVolume;
- _gamestate->_soundCmd->setMasterVolume(vol);
+ g_sci->_soundCmd->setMasterVolume(vol);
}
#endif
}
Modified: scummvm/trunk/engines/sci/sci.h
===================================================================
--- scummvm/trunk/engines/sci/sci.h 2010-06-29 06:38:00 UTC (rev 50483)
+++ scummvm/trunk/engines/sci/sci.h 2010-06-29 09:00:08 UTC (rev 50484)
@@ -52,6 +52,7 @@
class GameFeatures;
class Console;
class AudioPlayer;
+class SoundCommandParser;
class EventManager;
class GfxAnimate;
@@ -291,6 +292,7 @@
#endif
AudioPlayer *_audio;
+ SoundCommandParser *_soundCmd;
GameFeatures *_features;
private:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list