aboutsummaryrefslogtreecommitdiff
path: root/engines/agos
diff options
context:
space:
mode:
authorMatthew Hoops2011-08-07 20:11:27 -0400
committerMatthew Hoops2011-08-07 20:11:27 -0400
commitc05c42ecc60c8f928628787272743f169a0d5903 (patch)
treef2b06be630676b7302a1fb62940099b2ec71442d /engines/agos
parente43a6671fc04f2c67b8efa2c0fdfdd6ec0ea1023 (diff)
parent45dc303159d5bbe77a351df31e6f2d2f97a3412d (diff)
downloadscummvm-rg350-c05c42ecc60c8f928628787272743f169a0d5903.tar.gz
scummvm-rg350-c05c42ecc60c8f928628787272743f169a0d5903.tar.bz2
scummvm-rg350-c05c42ecc60c8f928628787272743f169a0d5903.zip
Merge remote branch 'upstream/master' into soccer
Diffstat (limited to 'engines/agos')
-rw-r--r--engines/agos/agos.cpp36
-rw-r--r--engines/agos/agos.h15
-rw-r--r--engines/agos/charset-fontdata.cpp3
-rw-r--r--engines/agos/charset.cpp4
-rw-r--r--engines/agos/contain.cpp2
-rw-r--r--engines/agos/cursor.cpp4
-rw-r--r--engines/agos/debug.cpp1
-rw-r--r--engines/agos/debug.h1
-rw-r--r--engines/agos/debugger.cpp8
-rw-r--r--engines/agos/draw.cpp3
-rw-r--r--engines/agos/event.cpp2
-rw-r--r--engines/agos/gfx.cpp3
-rw-r--r--engines/agos/icons.cpp2
-rw-r--r--engines/agos/input.cpp11
-rw-r--r--engines/agos/input_pn.cpp2
-rw-r--r--engines/agos/items.cpp2
-rw-r--r--engines/agos/menus.cpp2
-rw-r--r--engines/agos/midi.cpp4
-rw-r--r--engines/agos/oracle.cpp1
-rw-r--r--engines/agos/res_ami.cpp2
-rw-r--r--engines/agos/res_snd.cpp42
-rw-r--r--engines/agos/saveload.cpp1
-rw-r--r--engines/agos/script.cpp3
-rw-r--r--engines/agos/script_dp.cpp2
-rw-r--r--engines/agos/script_pn.cpp1
-rw-r--r--engines/agos/script_s1.cpp1
-rw-r--r--engines/agos/script_s2.cpp5
-rw-r--r--engines/agos/script_ww.cpp2
-rw-r--r--engines/agos/sound.cpp14
-rw-r--r--engines/agos/sound.h4
-rw-r--r--engines/agos/verb.cpp1
-rw-r--r--engines/agos/vga.cpp1
-rw-r--r--engines/agos/vga_e2.cpp1
-rw-r--r--engines/agos/vga_s2.cpp17
-rw-r--r--engines/agos/window.cpp1
-rw-r--r--engines/agos/zones.cpp2
36 files changed, 93 insertions, 113 deletions
diff --git a/engines/agos/agos.cpp b/engines/agos/agos.cpp
index 4d879909c4..300cd28ee4 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);
@@ -640,14 +642,12 @@ Common::Error AGOSEngine::init() {
// TODO: Use special debug levels instead of the following hack.
_debugMode = (gDebugLevel >= 0);
- if (gDebugLevel == 2)
- _dumpOpcodes = true;
- if (gDebugLevel == 3)
- _dumpVgaOpcodes = true;
- if (gDebugLevel == 4)
- _dumpScripts = true;
- if (gDebugLevel == 5)
- _dumpVgaScripts = true;
+ switch (gDebugLevel) {
+ case 2: _dumpOpcodes = true; break;
+ case 3: _dumpVgaOpcodes = true; break;
+ case 4: _dumpScripts = true; break;
+ case 5: _dumpVgaScripts = true; break;
+ }
return Common::kNoError;
}
@@ -708,7 +708,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 +911,8 @@ AGOSEngine::~AGOSEngine() {
_window6BackScn->free();
delete _window6BackScn;
+ free(_midi);
+
free(_firstTimeStruct);
free(_pendingDeleteTimeEvent);
@@ -938,12 +940,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 +1029,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
diff --git a/engines/agos/agos.h b/engines/agos/agos.h
index aa68a05eee..b1d2e6d735 100644
--- a/engines/agos/agos.h
+++ b/engines/agos/agos.h
@@ -33,7 +33,6 @@
#include "common/stack.h"
#include "common/util.h"
-#include "agos/midi.h"
#include "agos/sound.h"
#include "agos/vga.h"
@@ -50,6 +49,16 @@
* - Simon the Sorcerer 2
* - Simon the Sorcerer Puzzle Pack
*/
+
+namespace Common {
+class File;
+class SeekableReadStream;
+}
+
+namespace Graphics {
+class Surface;
+}
+
namespace AGOS {
uint fileReadItemID(Common::SeekableReadStream *in);
@@ -60,6 +69,8 @@ uint fileReadItemID(Common::SeekableReadStream *in);
class MoviePlayer;
#endif
+class MidiPlayer;
+
struct Child;
struct SubObject;
@@ -548,7 +559,7 @@ protected:
byte _lettersToPrintBuf[80];
- MidiPlayer _midi;
+ MidiPlayer *_midi;
bool _midiEnabled;
int _vgaTickCounter;
diff --git a/engines/agos/charset-fontdata.cpp b/engines/agos/charset-fontdata.cpp
index b708b4890b..e6b81f54ee 100644
--- a/engines/agos/charset-fontdata.cpp
+++ b/engines/agos/charset-fontdata.cpp
@@ -20,8 +20,6 @@
*
*/
-
-
#include "common/system.h"
#include "common/textconsole.h"
@@ -2454,4 +2452,3 @@ void AGOSEngine::windowDrawChar(WindowBlock *window, uint x, uint y, byte chr) {
}
} // End of namespace AGOS
-
diff --git a/engines/agos/charset.cpp b/engines/agos/charset.cpp
index 9d27afaa27..54aef99a47 100644
--- a/engines/agos/charset.cpp
+++ b/engines/agos/charset.cpp
@@ -20,8 +20,7 @@
*
*/
-
-
+#include "common/endian.h"
#include "common/system.h"
#include "agos/agos.h"
@@ -655,4 +654,3 @@ void AGOSEngine::windowScroll(WindowBlock *window) {
_videoLockOut &= ~0x8000;
}
} // End of namespace AGOS
-
diff --git a/engines/agos/contain.cpp b/engines/agos/contain.cpp
index ba60c65ff3..173194d45e 100644
--- a/engines/agos/contain.cpp
+++ b/engines/agos/contain.cpp
@@ -20,8 +20,6 @@
*
*/
-
-
#include "agos/agos.h"
#include "agos/intern.h"
diff --git a/engines/agos/cursor.cpp b/engines/agos/cursor.cpp
index ef4a1406c9..7c64d68048 100644
--- a/engines/agos/cursor.cpp
+++ b/engines/agos/cursor.cpp
@@ -20,10 +20,8 @@
*
*/
-
-
+#include "common/endian.h"
#include "common/events.h"
-#include "common/system.h"
#include "graphics/cursorman.h"
diff --git a/engines/agos/debug.cpp b/engines/agos/debug.cpp
index 9c44342975..18c4736031 100644
--- a/engines/agos/debug.cpp
+++ b/engines/agos/debug.cpp
@@ -22,7 +22,6 @@
// AGOS debug functions
-
#include "common/file.h"
#include "common/textconsole.h"
diff --git a/engines/agos/debug.h b/engines/agos/debug.h
index fd5908997f..fe14ae4860 100644
--- a/engines/agos/debug.h
+++ b/engines/agos/debug.h
@@ -2843,4 +2843,3 @@ const char *const feeblefiles_videoOpcodeNameTable[] = {
} // End of namespace AGOS
#endif
-
diff --git a/engines/agos/debugger.cpp b/engines/agos/debugger.cpp
index a313dbbd1e..fc24c6d363 100644
--- a/engines/agos/debugger.cpp
+++ b/engines/agos/debugger.cpp
@@ -20,12 +20,11 @@
*
*/
-
-
#include "common/config-manager.h"
#include "agos/debugger.h"
#include "agos/agos.h"
+#include "agos/midi.h"
namespace AGOS {
@@ -58,7 +57,7 @@ bool Debugger::Cmd_DebugLevel(int argc, const char **argv) {
DebugPrintf("Debugging is currently set at level %d\n", gDebugLevel);
} else { // set level
gDebugLevel = atoi(argv[1]);
- if (gDebugLevel >= 0 && gDebugLevel < 10) {
+ if (0 <= gDebugLevel && gDebugLevel < 11) {
_vm->_debugMode = true;
DebugPrintf("Debug level set to level %d\n", gDebugLevel);
} else if (gDebugLevel < 0) {
@@ -79,7 +78,7 @@ bool Debugger::Cmd_PlayMusic(int argc, const char **argv) {
// TODO
} else if (_vm->getGameType() == GType_SIMON2) {
_vm->loadMusic(music);
- _vm->_midi.startTrack(0);
+ _vm->_midi->startTrack(0);
} else {
_vm->playMusic(music, 0);
}
@@ -287,4 +286,3 @@ bool Debugger::Cmd_dumpScript(int argc, const char **argv) {
}
} // End of namespace AGOS
-
diff --git a/engines/agos/draw.cpp b/engines/agos/draw.cpp
index 4d66b56a96..9fc5cedbf9 100644
--- a/engines/agos/draw.cpp
+++ b/engines/agos/draw.cpp
@@ -20,8 +20,7 @@
*
*/
-
-
+#include "common/endian.h"
#include "common/system.h"
#include "graphics/surface.h"
diff --git a/engines/agos/event.cpp b/engines/agos/event.cpp
index 3411e6d632..ed26b96381 100644
--- a/engines/agos/event.cpp
+++ b/engines/agos/event.cpp
@@ -20,8 +20,6 @@
*
*/
-
-
#include "agos/agos.h"
#include "agos/animation.h"
#include "agos/debugger.h"
diff --git a/engines/agos/gfx.cpp b/engines/agos/gfx.cpp
index 0b045bae01..fbf7f416ed 100644
--- a/engines/agos/gfx.cpp
+++ b/engines/agos/gfx.cpp
@@ -20,8 +20,7 @@
*
*/
-
-
+#include "common/endian.h"
#include "common/system.h"
#include "common/textconsole.h"
diff --git a/engines/agos/icons.cpp b/engines/agos/icons.cpp
index ead4e49ebb..7db2d85f21 100644
--- a/engines/agos/icons.cpp
+++ b/engines/agos/icons.cpp
@@ -20,8 +20,6 @@
*
*/
-
-
#include "common/file.h"
#include "common/system.h"
#include "common/textconsole.h"
diff --git a/engines/agos/input.cpp b/engines/agos/input.cpp
index 2ab543a943..24e5339420 100644
--- a/engines/agos/input.cpp
+++ b/engines/agos/input.cpp
@@ -20,13 +20,12 @@
*
*/
-
-
#include "common/config-manager.h"
#include "common/file.h"
#include "agos/intern.h"
#include "agos/agos.h"
+#include "agos/midi.h"
#include "agos/vga.h"
namespace AGOS {
@@ -582,14 +581,14 @@ bool AGOSEngine::processSpecialKeys() {
break;
case '+':
if (_midiEnabled) {
- _midi.setVolume(_midi.getMusicVolume() + 16, _midi.getSFXVolume() + 16);
+ _midi->setVolume(_midi->getMusicVolume() + 16, _midi->getSFXVolume() + 16);
}
ConfMan.setInt("music_volume", _mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType) + 16);
syncSoundSettings();
break;
case '-':
if (_midiEnabled) {
- _midi.setVolume(_midi.getMusicVolume() - 16, _midi.getSFXVolume() - 16);
+ _midi->setVolume(_midi->getMusicVolume() - 16, _midi->getSFXVolume() - 16);
}
ConfMan.setInt("music_volume", _mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType) - 16);
syncSoundSettings();
@@ -597,13 +596,13 @@ bool AGOSEngine::processSpecialKeys() {
case 'm':
_musicPaused = !_musicPaused;
if (_midiEnabled) {
- _midi.pause(_musicPaused);
+ _midi->pause(_musicPaused);
}
syncSoundSettings();
break;
case 's':
if (getGameId() == GID_SIMON1DOS) {
- _midi._enable_sfx = !_midi._enable_sfx;
+ _midi->_enable_sfx = !_midi->_enable_sfx;
} else {
_effectsPaused = !_effectsPaused;
_sound->effectsPause(_effectsPaused);
diff --git a/engines/agos/input_pn.cpp b/engines/agos/input_pn.cpp
index 9cc97ff10f..b3a44f2b2f 100644
--- a/engines/agos/input_pn.cpp
+++ b/engines/agos/input_pn.cpp
@@ -20,8 +20,6 @@
*
*/
-
-
#include "agos/agos.h"
#include "agos/intern.h"
diff --git a/engines/agos/items.cpp b/engines/agos/items.cpp
index 0fb873a733..3bb5a132ef 100644
--- a/engines/agos/items.cpp
+++ b/engines/agos/items.cpp
@@ -20,8 +20,6 @@
*
*/
-
-
#include "common/file.h"
#include "common/textconsole.h"
diff --git a/engines/agos/menus.cpp b/engines/agos/menus.cpp
index 4d62e34820..a0d2bdcaa0 100644
--- a/engines/agos/menus.cpp
+++ b/engines/agos/menus.cpp
@@ -20,8 +20,6 @@
*
*/
-
-
#include "common/file.h"
#include "common/system.h"
#include "common/textconsole.h"
diff --git a/engines/agos/midi.cpp b/engines/agos/midi.cpp
index 88f6dd80d1..9a93e0a273 100644
--- a/engines/agos/midi.cpp
+++ b/engines/agos/midi.cpp
@@ -20,14 +20,12 @@
*
*/
-
-
#include "common/config-manager.h"
#include "common/file.h"
-#include "common/system.h"
#include "common/textconsole.h"
#include "agos/agos.h"
+#include "agos/midi.h"
namespace AGOS {
diff --git a/engines/agos/oracle.cpp b/engines/agos/oracle.cpp
index 2a3c668c08..025a833b77 100644
--- a/engines/agos/oracle.cpp
+++ b/engines/agos/oracle.cpp
@@ -25,7 +25,6 @@
#ifdef ENABLE_AGOS2
#include "common/savefile.h"
-#include "common/system.h"
#include "graphics/surface.h"
diff --git a/engines/agos/res_ami.cpp b/engines/agos/res_ami.cpp
index b83d10364a..32adfa29e6 100644
--- a/engines/agos/res_ami.cpp
+++ b/engines/agos/res_ami.cpp
@@ -26,6 +26,8 @@
#include "agos/agos.h"
#include "agos/intern.h"
+#include "common/endian.h"
+
namespace AGOS {
enum {
diff --git a/engines/agos/res_snd.cpp b/engines/agos/res_snd.cpp
index 819af4fa40..9a04ce2d26 100644
--- a/engines/agos/res_snd.cpp
+++ b/engines/agos/res_snd.cpp
@@ -27,12 +27,12 @@
#include "agos/intern.h"
#include "agos/agos.h"
+#include "agos/midi.h"
#include "agos/vga.h"
#include "backends/audiocd/audiocd.h"
#include "audio/audiostream.h"
-#include "audio/mididrv.h"
#include "audio/mods/protracker.h"
namespace AGOS {
@@ -125,10 +125,10 @@ void AGOSEngine::loadMusic(uint16 music) {
_gameFile->read(buf, 4);
if (!memcmp(buf, "FORM", 4)) {
_gameFile->seek(_gameOffsetsPtr[_musicIndexBase + music - 1], SEEK_SET);
- _midi.loadXMIDI(_gameFile);
+ _midi->loadXMIDI(_gameFile);
} else {
_gameFile->seek(_gameOffsetsPtr[_musicIndexBase + music - 1], SEEK_SET);
- _midi.loadMultipleSMF(_gameFile);
+ _midi->loadMultipleSMF(_gameFile);
}
_lastMusicPlayed = music;
@@ -242,20 +242,20 @@ void AGOSEngine_Simon1::playMusic(uint16 music, uint16 track) {
if (music == 35)
return;
- _midi.setLoop(true); // Must do this BEFORE loading music. (GMF may have its own override.)
+ _midi->setLoop(true); // Must do this BEFORE loading music. (GMF may have its own override.)
_gameFile->seek(_gameOffsetsPtr[_musicIndexBase + music], SEEK_SET);
_gameFile->read(buf, 4);
if (!memcmp(buf, "GMF\x1", 4)) {
_gameFile->seek(_gameOffsetsPtr[_musicIndexBase + music], SEEK_SET);
- _midi.loadSMF(_gameFile, music);
+ _midi->loadSMF(_gameFile, music);
} else {
_gameFile->seek(_gameOffsetsPtr[_musicIndexBase + music], SEEK_SET);
- _midi.loadMultipleSMF(_gameFile);
+ _midi->loadMultipleSMF(_gameFile);
}
- _midi.startTrack(0);
- _midi.startTrack(track);
+ _midi->startTrack(0);
+ _midi->startTrack(track);
} else if (getPlatform() == Common::kPlatformAcorn) {
// TODO: Add support for Desktop Tracker format in Acorn disk version
} else {
@@ -266,15 +266,15 @@ void AGOSEngine_Simon1::playMusic(uint16 music, uint16 track) {
if (f.isOpen() == false)
error("playMusic: Can't load music from '%s'", filename);
- _midi.setLoop(true); // Must do this BEFORE loading music. (GMF may have its own override.)
+ _midi->setLoop(true); // Must do this BEFORE loading music. (GMF may have its own override.)
if (getFeatures() & GF_DEMO)
- _midi.loadS1D(&f);
+ _midi->loadS1D(&f);
else
- _midi.loadSMF(&f, music);
+ _midi->loadSMF(&f, music);
- _midi.startTrack(0);
- _midi.startTrack(track);
+ _midi->startTrack(0);
+ _midi->startTrack(track);
}
}
@@ -286,7 +286,7 @@ void AGOSEngine::playMusic(uint16 music, uint16 track) {
} else if (getPlatform() == Common::kPlatformAtariST) {
// TODO: Add support for music formats used
} else {
- _midi.setLoop(true); // Must do this BEFORE loading music.
+ _midi->setLoop(true); // Must do this BEFORE loading music.
char filename[15];
Common::File f;
@@ -295,21 +295,21 @@ void AGOSEngine::playMusic(uint16 music, uint16 track) {
if (f.isOpen() == false)
error("playMusic: Can't load music from '%s'", filename);
- _midi.loadS1D(&f);
- _midi.startTrack(0);
- _midi.startTrack(track);
+ _midi->loadS1D(&f);
+ _midi->startTrack(0);
+ _midi->startTrack(track);
}
}
void AGOSEngine::stopMusic() {
if (_midiEnabled) {
- _midi.stop();
+ _midi->stop();
}
_mixer->stopHandle(_modHandle);
}
void AGOSEngine::playSting(uint16 soundId) {
- if (!_midi._enable_sfx)
+ if (!_midi->_enable_sfx)
return;
char filename[15];
@@ -328,8 +328,8 @@ void AGOSEngine::playSting(uint16 soundId) {
error("playSting: Can't read sting %d offset", soundId);
mus_file.seek(mus_offset, SEEK_SET);
- _midi.loadSMF(&mus_file, soundId, true);
- _midi.startTrack(0);
+ _midi->loadSMF(&mus_file, soundId, true);
+ _midi->startTrack(0);
}
static const byte elvira1_soundTable[100] = {
diff --git a/engines/agos/saveload.cpp b/engines/agos/saveload.cpp
index e6cce36b22..10830db002 100644
--- a/engines/agos/saveload.cpp
+++ b/engines/agos/saveload.cpp
@@ -22,7 +22,6 @@
#include "common/file.h"
#include "common/savefile.h"
-#include "common/system.h"
#include "common/textconsole.h"
#include "common/translation.h"
diff --git a/engines/agos/script.cpp b/engines/agos/script.cpp
index 68a90e405b..1c36454278 100644
--- a/engines/agos/script.cpp
+++ b/engines/agos/script.cpp
@@ -22,8 +22,7 @@
// Item script opcodes for Simon1/Simon2
-
-
+#include "common/endian.h"
#include "common/system.h"
#include "common/textconsole.h"
diff --git a/engines/agos/script_dp.cpp b/engines/agos/script_dp.cpp
index a4ee249f47..f51e15dc67 100644
--- a/engines/agos/script_dp.cpp
+++ b/engines/agos/script_dp.cpp
@@ -24,8 +24,6 @@
#ifdef ENABLE_AGOS2
-#include "common/system.h"
-
#include "agos/agos.h"
namespace AGOS {
diff --git a/engines/agos/script_pn.cpp b/engines/agos/script_pn.cpp
index 3bd8ce19a3..196350b9bf 100644
--- a/engines/agos/script_pn.cpp
+++ b/engines/agos/script_pn.cpp
@@ -23,6 +23,7 @@
#include "agos/agos.h"
#include "agos/vga.h"
+#include "common/endian.h"
#include "common/textconsole.h"
namespace AGOS {
diff --git a/engines/agos/script_s1.cpp b/engines/agos/script_s1.cpp
index 0e7e66778e..350ed31068 100644
--- a/engines/agos/script_s1.cpp
+++ b/engines/agos/script_s1.cpp
@@ -20,7 +20,6 @@
*
*/
-
#include "common/system.h"
#include "graphics/palette.h"
diff --git a/engines/agos/script_s2.cpp b/engines/agos/script_s2.cpp
index c646397ac3..c35771f8ec 100644
--- a/engines/agos/script_s2.cpp
+++ b/engines/agos/script_s2.cpp
@@ -23,6 +23,7 @@
#include "agos/agos.h"
+#include "agos/midi.h"
#include "common/textconsole.h"
@@ -342,11 +343,11 @@ void AGOSEngine_Simon2::os2_playTune() {
// effectively preloaded so there's no latency when
// starting playback).
- _midi.setLoop(loop != 0);
+ _midi->setLoop(loop != 0);
if (_lastMusicPlayed != music)
_nextMusicToPlay = music;
else
- _midi.startTrack(track);
+ _midi->startTrack(track);
}
void AGOSEngine_Simon2::os2_screenTextPObj() {
diff --git a/engines/agos/script_ww.cpp b/engines/agos/script_ww.cpp
index 29a91a15aa..873f258743 100644
--- a/engines/agos/script_ww.cpp
+++ b/engines/agos/script_ww.cpp
@@ -22,8 +22,6 @@
-#include "common/system.h"
-
#include "agos/agos.h"
namespace AGOS {
diff --git a/engines/agos/sound.cpp b/engines/agos/sound.cpp
index 03932aa4de..11a1cd792e 100644
--- a/engines/agos/sound.cpp
+++ b/engines/agos/sound.cpp
@@ -22,6 +22,7 @@
#include "common/file.h"
#include "common/memstream.h"
+#include "common/ptr.h"
#include "common/textconsole.h"
#include "common/util.h"
@@ -43,11 +44,10 @@ namespace AGOS {
class BaseSound : Common::NonCopyable {
protected:
- Common::File *_file;
+ Common::DisposablePtr<Common::File> _file;
uint32 *_offsets;
Audio::Mixer *_mixer;
bool _freeOffsets;
- DisposeAfterUse::Flag _disposeFile;
public:
BaseSound(Audio::Mixer *mixer, Common::File *file, uint32 base, bool bigEndian, DisposeAfterUse::Flag disposeFileAfterUse = DisposeAfterUse::YES);
@@ -62,7 +62,7 @@ public:
};
BaseSound::BaseSound(Audio::Mixer *mixer, Common::File *file, uint32 base, bool bigEndian, DisposeAfterUse::Flag disposeFileAfterUse)
- : _mixer(mixer), _file(file), _disposeFile(disposeFileAfterUse) {
+ : _mixer(mixer), _file(file, disposeFileAfterUse) {
uint res = 0;
uint32 size;
@@ -96,7 +96,7 @@ BaseSound::BaseSound(Audio::Mixer *mixer, Common::File *file, uint32 base, bool
}
BaseSound::BaseSound(Audio::Mixer *mixer, Common::File *file, uint32 *offsets, DisposeAfterUse::Flag disposeFileAfterUse)
- : _mixer(mixer), _file(file), _disposeFile(disposeFileAfterUse) {
+ : _mixer(mixer), _file(file, disposeFileAfterUse) {
_offsets = offsets;
_freeOffsets = false;
@@ -105,8 +105,6 @@ BaseSound::BaseSound(Audio::Mixer *mixer, Common::File *file, uint32 *offsets, D
BaseSound::~BaseSound() {
if (_freeOffsets)
free(_offsets);
- if (_disposeFile == DisposeAfterUse::YES)
- delete _file;
}
///////////////////////////////////////////////////////////////////////////////
@@ -234,7 +232,7 @@ Audio::AudioStream *WavSound::makeAudioStream(uint sound) {
return NULL;
_file->seek(_offsets[sound], SEEK_SET);
- return Audio::makeWAVStream(_file, DisposeAfterUse::NO);
+ return Audio::makeWAVStream(_file.get(), DisposeAfterUse::NO);
}
void WavSound::playSound(uint sound, uint loopSound, Audio::Mixer::SoundType type, Audio::SoundHandle *handle, bool loop, int vol) {
@@ -257,7 +255,7 @@ public:
Audio::AudioStream *VocSound::makeAudioStream(uint sound) {
assert(_offsets);
_file->seek(_offsets[sound], SEEK_SET);
- return Audio::makeVOCStream(_file, _flags);
+ return Audio::makeVOCStream(_file.get(), _flags);
}
void VocSound::playSound(uint sound, uint loopSound, Audio::Mixer::SoundType type, Audio::SoundHandle *handle, bool loop, int vol) {
diff --git a/engines/agos/sound.h b/engines/agos/sound.h
index a7c4cd73db..ab4a3a963d 100644
--- a/engines/agos/sound.h
+++ b/engines/agos/sound.h
@@ -28,6 +28,10 @@
#include "agos/intern.h"
#include "common/str.h"
+namespace Common {
+class File;
+}
+
namespace AGOS {
class BaseSound;
diff --git a/engines/agos/verb.cpp b/engines/agos/verb.cpp
index abc45c1ace..dec05f6703 100644
--- a/engines/agos/verb.cpp
+++ b/engines/agos/verb.cpp
@@ -22,7 +22,6 @@
// Verb and hitarea handling
-
#include "common/system.h"
#include "graphics/surface.h"
diff --git a/engines/agos/vga.cpp b/engines/agos/vga.cpp
index de6a6976e5..8541f579d6 100644
--- a/engines/agos/vga.cpp
+++ b/engines/agos/vga.cpp
@@ -27,6 +27,7 @@
#include "agos/intern.h"
#include "agos/vga.h"
+#include "common/endian.h"
#include "common/system.h"
#include "common/textconsole.h"
diff --git a/engines/agos/vga_e2.cpp b/engines/agos/vga_e2.cpp
index 1bde6945f0..d4aafd3d7b 100644
--- a/engines/agos/vga_e2.cpp
+++ b/engines/agos/vga_e2.cpp
@@ -26,6 +26,7 @@
#include "agos/agos.h"
#include "agos/intern.h"
+#include "common/endian.h"
#include "common/system.h"
#include "graphics/surface.h"
diff --git a/engines/agos/vga_s2.cpp b/engines/agos/vga_s2.cpp
index 1021ea8f94..9b9ed4e297 100644
--- a/engines/agos/vga_s2.cpp
+++ b/engines/agos/vga_s2.cpp
@@ -20,10 +20,9 @@
*
*/
-
-
#include "agos/agos.h"
#include "agos/intern.h"
+#include "agos/midi.h"
#include "graphics/surface.h"
@@ -146,8 +145,8 @@ void AGOSEngine::vc69_playSeq() {
// specifying a non-valid track number (999 or -1)
// as a means of stopping what music is currently
// playing.
- _midi.setLoop(loop != 0);
- _midi.startTrack(track);
+ _midi->setLoop(loop != 0);
+ _midi->startTrack(track);
}
void AGOSEngine::vc70_joinSeq() {
@@ -161,9 +160,9 @@ void AGOSEngine::vc70_joinSeq() {
// track and, if not, whether to switch to
// a different track upon completion.
if (track != 0xFFFF && track != 999)
- _midi.queueTrack(track, loop != 0);
+ _midi->queueTrack(track, loop != 0);
else
- _midi.setLoop(loop != 0);
+ _midi->setLoop(loop != 0);
}
void AGOSEngine::vc71_ifSeqWaiting() {
@@ -171,7 +170,7 @@ void AGOSEngine::vc71_ifSeqWaiting() {
// This command skips the next instruction
// unless (1) there is a track playing, AND
// (2) there is a track queued to play after it.
- if (!_midi.isPlaying(true))
+ if (!_midi->isPlaying(true))
vcSkipNextInstruction();
}
@@ -195,8 +194,8 @@ void AGOSEngine::vc72_segue() {
if (track == -1 || track == 999) {
stopMusic();
} else {
- _midi.setLoop(loop != 0);
- _midi.startTrack(track);
+ _midi->setLoop(loop != 0);
+ _midi->startTrack(track);
}
}
diff --git a/engines/agos/window.cpp b/engines/agos/window.cpp
index c55e3dcdda..0365c736d8 100644
--- a/engines/agos/window.cpp
+++ b/engines/agos/window.cpp
@@ -21,7 +21,6 @@
*/
-
#include "common/system.h"
#include "common/textconsole.h"
diff --git a/engines/agos/zones.cpp b/engines/agos/zones.cpp
index 61efbcb89a..483b9949eb 100644
--- a/engines/agos/zones.cpp
+++ b/engines/agos/zones.cpp
@@ -214,5 +214,3 @@ void AGOSEngine::checkZonePtrs() {
}
} // End of namespace AGOS
-
-