aboutsummaryrefslogtreecommitdiff
path: root/engines/agos/agos.cpp
diff options
context:
space:
mode:
authorEugene Sandulenko2011-08-05 11:16:03 +0100
committerEugene Sandulenko2011-08-06 11:28:40 +0100
commit6e795a89b0d45c79f99dcd9d50fda467e9a2466e (patch)
treec69ae1ebe1ef42b3f2c887a2e75dd85a788943ab /engines/agos/agos.cpp
parent43c7b10566ee0c9ad51ca611ff1fa21fde889c08 (diff)
downloadscummvm-rg350-6e795a89b0d45c79f99dcd9d50fda467e9a2466e.tar.gz
scummvm-rg350-6e795a89b0d45c79f99dcd9d50fda467e9a2466e.tar.bz2
scummvm-rg350-6e795a89b0d45c79f99dcd9d50fda467e9a2466e.zip
AGOS: Reduced header dependency
Diffstat (limited to 'engines/agos/agos.cpp')
-rw-r--r--engines/agos/agos.cpp22
1 files changed, 13 insertions, 9 deletions
diff --git a/engines/agos/agos.cpp b/engines/agos/agos.cpp
index 4d879909c4..530803cf69 100644
--- a/engines/agos/agos.cpp
+++ b/engines/agos/agos.cpp
@@ -24,13 +24,13 @@
#include "common/file.h"
#include "common/fs.h"
#include "common/textconsole.h"
-#include "common/system.h"
#include "engines/util.h"
#include "agos/debugger.h"
#include "agos/intern.h"
#include "agos/agos.h"
+#include "agos/midi.h"
#include "backends/audiocd/audiocd.h"
@@ -541,16 +541,18 @@ Common::Error AGOSEngine::init() {
initGraphics(_screenWidth, _screenHeight, getGameType() == GType_FF || getGameType() == GType_PP);
+ _midi = new MidiPlayer();
+
if ((getGameType() == GType_SIMON2 && getPlatform() == Common::kPlatformWindows) ||
(getGameType() == GType_SIMON1 && getPlatform() == Common::kPlatformWindows) ||
((getFeatures() & GF_TALKIE) && getPlatform() == Common::kPlatformAcorn) ||
(getPlatform() == Common::kPlatformPC)) {
- int ret = _midi.open(getGameType());
+ int ret = _midi->open(getGameType());
if (ret)
warning("MIDI Player init failed: \"%s\"", MidiDriver::getErrorName(ret));
- _midi.setVolume(ConfMan.getInt("music_volume"), ConfMan.getInt("sfx_volume"));
+ _midi->setVolume(ConfMan.getInt("music_volume"), ConfMan.getInt("sfx_volume"));
_midiEnabled = true;
}
@@ -597,14 +599,14 @@ Common::Error AGOSEngine::init() {
if (ConfMan.hasKey("music_mute") && ConfMan.getBool("music_mute") == 1) {
_musicPaused = true;
if (_midiEnabled) {
- _midi.pause(_musicPaused);
+ _midi->pause(_musicPaused);
}
_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, 0);
}
if (ConfMan.hasKey("sfx_mute") && ConfMan.getBool("sfx_mute") == 1) {
if (getGameId() == GID_SIMON1DOS)
- _midi._enable_sfx = !_midi._enable_sfx;
+ _midi->_enable_sfx = !_midi->_enable_sfx;
else {
_effectsPaused = !_effectsPaused;
_sound->effectsPause(_effectsPaused);
@@ -708,7 +710,7 @@ void AGOSEngine_Simon2::setupGame() {
_itemMemSize = 20000;
_tableMemSize = 100000;
// Check whether to use MT-32 MIDI tracks in Simon the Sorcerer 2
- if (getGameType() == GType_SIMON2 && _midi.hasNativeMT32())
+ if (getGameType() == GType_SIMON2 && _midi->hasNativeMT32())
_musicIndexBase = (1128 + 612) / 4;
else
_musicIndexBase = 1128 / 4;
@@ -911,6 +913,8 @@ AGOSEngine::~AGOSEngine() {
_window6BackScn->free();
delete _window6BackScn;
+ free(_midi);
+
free(_firstTimeStruct);
free(_pendingDeleteTimeEvent);
@@ -938,12 +942,12 @@ void AGOSEngine::pauseEngineIntern(bool pauseIt) {
_keyPressed.reset();
_pause = true;
- _midi.pause(true);
+ _midi->pause(true);
_mixer->pauseAll(true);
} else {
_pause = false;
- _midi.pause(_musicPaused);
+ _midi->pause(_musicPaused);
_mixer->pauseAll(false);
}
}
@@ -1027,7 +1031,7 @@ void AGOSEngine::syncSoundSettings() {
int soundVolumeSFX = ConfMan.getInt("sfx_volume");
if (_midiEnabled)
- _midi.setVolume((mute ? 0 : soundVolumeMusic), (mute ? 0 : soundVolumeSFX));
+ _midi->setVolume((mute ? 0 : soundVolumeMusic), (mute ? 0 : soundVolumeSFX));
}
} // End of namespace AGOS