diff options
-rw-r--r-- | engines/agi/agi.h | 11 | ||||
-rw-r--r-- | engines/agi/global.cpp | 6 | ||||
-rw-r--r-- | engines/agi/preagi.cpp | 46 | ||||
-rw-r--r-- | engines/agi/preagi_mickey.cpp | 10 | ||||
-rw-r--r-- | engines/agi/sound.cpp | 2 | ||||
-rw-r--r-- | engines/agi/sound.h | 5 |
6 files changed, 30 insertions, 50 deletions
diff --git a/engines/agi/agi.h b/engines/agi/agi.h index 25516229e9..64220e6896 100644 --- a/engines/agi/agi.h +++ b/engines/agi/agi.h @@ -697,6 +697,12 @@ public: int16 p4, int16 p5, int16 p6, int16 p7) = 0; virtual void releaseImageStack() = 0; + int _soundemu; + + int getflag(int); + void setflag(int, int); + void flipflag(int); + const AGIGameDescription *_gameDescription; uint32 getGameID() const; uint32 getFeatures() const; @@ -773,8 +779,6 @@ public: int16 p4, int16 p5, int16 p6, int16 p7); void releaseImageStack(); - int _soundemu; - int _keyControl; int _keyAlt; @@ -799,9 +803,6 @@ public: void newInputMode(int); void oldInputMode(); - int getflag(int); - void setflag(int, int); - void flipflag(int); int getvar(int); void setvar(int, int); void decrypt(uint8 * mem, int len); diff --git a/engines/agi/global.cpp b/engines/agi/global.cpp index 0baf8c259c..36cc547a8d 100644 --- a/engines/agi/global.cpp +++ b/engines/agi/global.cpp @@ -29,14 +29,14 @@ namespace Agi { -int AgiEngine::getflag(int n) { +int AgiBase::getflag(int n) { uint8 *set = (uint8 *)&_game.flags; set += n >> 3; return (*set & (1 << (n & 0x07))) != 0; } -void AgiEngine::setflag(int n, int v) { +void AgiBase::setflag(int n, int v) { uint8 *set = (uint8 *)&_game.flags; set += n >> 3; @@ -46,7 +46,7 @@ void AgiEngine::setflag(int n, int v) { *set &= ~(1 << (n & 0x07)); /* clear bit */ } -void AgiEngine::flipflag(int n) { +void AgiBase::flipflag(int n) { uint8 *set = (uint8 *)&_game.flags; set += n >> 3; diff --git a/engines/agi/preagi.cpp b/engines/agi/preagi.cpp index 642fc6180d..97b504d83d 100644 --- a/engines/agi/preagi.cpp +++ b/engines/agi/preagi.cpp @@ -61,14 +61,14 @@ PreAgiEngine::PreAgiEngine(OSystem *syst) : AgiBase(syst) { _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume")); _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume")); -/* + /* const GameSettings *g; const char *gameid = ConfMan.get("gameid").c_str(); for (g = agiSettings; g->gameid; ++g) if (!scumm_stricmp(g->gameid, gameid)) _gameId = g->id; -*/ + */ _rnd = new Common::RandomSource(); @@ -107,8 +107,6 @@ PreAgiEngine::PreAgiEngine(OSystem *syst) : AgiBase(syst) { _imageStack = NULL; _imageStackPointer = 0; - _menu = NULL; - _lastSentence[0] = 0; memset(&_stringdata, 0, sizeof(struct StringData)); @@ -116,10 +114,6 @@ PreAgiEngine::PreAgiEngine(OSystem *syst) : AgiBase(syst) { _oldMode = -1; - _predictiveDialogRunning = false; - _predictiveDictText = NULL; - _predictiveDictLine = NULL; - _predictiveDictLineCount = 0; _firstSlot = 0; */ } @@ -129,23 +123,14 @@ void PreAgiEngine::initialize() { // drivers, and I'm not sure what they are. For now, they might // as well be called "PC Speaker" and "Not PC Speaker". - // If used platform is Apple IIGS then we must use Apple IIGS sound emulation - // because Apple IIGS AGI games use only Apple IIGS specific sound resources. - /* - if (ConfMan.hasKey("platform") && - Common::parsePlatform(ConfMan.get("platform")) == Common::kPlatformApple2GS) { - _soundemu = SOUND_EMU_APPLE2GS; - } else { - switch (MidiDriver::detectMusicDriver(MDT_PCSPK)) { - case MD_PCSPK: - _soundemu = SOUND_EMU_PC; - break; - default: - _soundemu = SOUND_EMU_NONE; - break; - } + switch (MidiDriver::detectMusicDriver(MDT_PCSPK)) { + case MD_PCSPK: + _soundemu = SOUND_EMU_PC; + break; + default: + _soundemu = SOUND_EMU_NONE; + break; } - */ if (ConfMan.hasKey("render_mode")) { _renderMode = Common::parseRenderMode(ConfMan.get("render_mode").c_str()); @@ -163,9 +148,8 @@ void PreAgiEngine::initialize() { } } - //_console = new Console(this); _gfx = new GfxMgr(this); - //_sound = new SoundMgr(this, _mixer); + _sound = new SoundMgr(this, _mixer); _picture = new PictureMgr(this, _gfx); //_sprites = new SpritesMgr(this, _gfx); @@ -185,7 +169,7 @@ void PreAgiEngine::initialize() { _game.lineMinPrint = 0; // hardcoded _gfx->initVideo(); - //_sound->initSound(); + _sound->initSound(); //_timer->installTimerProc(agiTimerFunctionLow, 10 * 1000, NULL); @@ -204,12 +188,10 @@ void PreAgiEngine::initialize() { /* clear all resources and events */ for (int i = 0; i < MAX_DIRS; i++) { - //memset(&_game.views[i], 0, sizeof(struct AgiView)); memset(&_game.pictures[i], 0, sizeof(struct AgiPicture)); - //memset(&_game.sounds[i], 0, sizeof(class AgiSound *)); // _game.sounds contains pointers now - //memset(&_game.dirView[i], 0, sizeof(struct AgiDir)); + memset(&_game.sounds[i], 0, sizeof(class AgiSound *)); // _game.sounds contains pointers now memset(&_game.dirPic[i], 0, sizeof(struct AgiDir)); - //memset(&_game.dirSound[i], 0, sizeof(struct AgiDir)); + memset(&_game.dirSound[i], 0, sizeof(struct AgiDir)); } // load resources @@ -244,6 +226,8 @@ int PreAgiEngine::init() { } int PreAgiEngine::go() { + setflag(fSoundOn, true); // enable sound + // run preagi engine main loop switch (getGameID()) { case GID_MICKEY: diff --git a/engines/agi/preagi_mickey.cpp b/engines/agi/preagi_mickey.cpp index b5d0471c7f..844235cbfa 100644 --- a/engines/agi/preagi_mickey.cpp +++ b/engines/agi/preagi_mickey.cpp @@ -362,10 +362,7 @@ bool Mickey::getMenuSelRow(MSA_MENU menu, int *sel0, int *sel1, int iRow) { case Common::KEYCODE_ESCAPE: *sel0 = 0; *sel1 = -1; return false; case Common::KEYCODE_s: -#if 0 - // TODO - flipSound(); -#endif + _vm->flipflag(fSoundOn); break; case Common::KEYCODE_c: inventory(); @@ -526,11 +523,8 @@ void Mickey::_playNote(MSA_SND_NOTE note) { #endif void Mickey::playSound(ENUM_MSA_SOUND iSound) { -#if 0 - // TODO - if (!getSound()) + if (!_vm->getflag(fSoundOn)) return; -#endif Common::Event event; MSA_SND_NOTE note; diff --git a/engines/agi/sound.cpp b/engines/agi/sound.cpp index e080616972..ef531840a8 100644 --- a/engines/agi/sound.cpp +++ b/engines/agi/sound.cpp @@ -1085,7 +1085,7 @@ static void fillAudio(void *udata, int16 *stream, uint len) { n -= s; } -SoundMgr::SoundMgr(AgiEngine *agi, Audio::Mixer *pMixer) { +SoundMgr::SoundMgr(AgiBase *agi, Audio::Mixer *pMixer) { _vm = agi; _mixer = pMixer; _sampleRate = pMixer->getOutputRate(); diff --git a/engines/agi/sound.h b/engines/agi/sound.h index d856b0cf5c..5d9bfda445 100644 --- a/engines/agi/sound.h +++ b/engines/agi/sound.h @@ -336,12 +336,13 @@ struct IIgsExeInfo { }; class AgiEngine; +class AgiBase; class SoundMgr : public Audio::AudioStream { - AgiEngine *_vm; + AgiBase *_vm; public: - SoundMgr(AgiEngine *agi, Audio::Mixer *pMixer); + SoundMgr(AgiBase *agi, Audio::Mixer *pMixer); ~SoundMgr(); virtual void setVolume(uint8 volume); |