diff options
author | Paul Gilbert | 2014-02-16 15:22:57 -0500 |
---|---|---|
committer | Paul Gilbert | 2014-02-16 15:22:57 -0500 |
commit | d4df315e8787f6230aa55b6d8542e7adda89cd48 (patch) | |
tree | 95aea2f2f60c12231e4396a53c1d966cd3909274 /engines/mads/mads.cpp | |
parent | a41db1939cdff632d16aa3849e23b844c46bafef (diff) | |
download | scummvm-rg350-d4df315e8787f6230aa55b6d8542e7adda89cd48.tar.gz scummvm-rg350-d4df315e8787f6230aa55b6d8542e7adda89cd48.tar.bz2 scummvm-rg350-d4df315e8787f6230aa55b6d8542e7adda89cd48.zip |
MADS: Initial implementation of Adlib sound driver
Diffstat (limited to 'engines/mads/mads.cpp')
-rw-r--r-- | engines/mads/mads.cpp | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/engines/mads/mads.cpp b/engines/mads/mads.cpp new file mode 100644 index 0000000000..39ef195cd6 --- /dev/null +++ b/engines/mads/mads.cpp @@ -0,0 +1,74 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "mads/mads.h" +#include "mads/sound.h" +#include "common/scummsys.h" +#include "common/config-manager.h" +#include "common/debug-channels.h" +#include "engines/util.h" +#include "common/events.h" + +namespace MADS { + +MADSEngine *g_vm; + +MADSEngine::MADSEngine(OSystem *syst, const MADSGameDescription *gameDesc) : + Engine(syst), _randomSource("MADS") { + DebugMan.addDebugChannel(kDebugPath, "Path", "Pathfinding debug level"); + DebugMan.addDebugChannel(kDebugScripts, "scripts", "Game scripts"); +} + +MADSEngine::~MADSEngine() { +} + +void MADSEngine::initialise() { + _soundManager.setVm(this, _mixer); +} + +static uint32 lastSoundFrame = 0; + +Common::Error MADSEngine::run() { + initGraphics(320, 200, false); + initialise(); + _soundManager.test(); + + Common::Event e; + while (!shouldQuit()) { + g_system->getEventManager()->pollEvent(e); + g_system->delayMillis(10); + + uint32 milli = g_system->getMillis(); + if (milli > (lastSoundFrame + 50)) { + lastSoundFrame = milli; + _soundManager.poll(); + } + } + + return Common::kNoError; +} + +int MADSEngine::getRandomNumber(int maxNumber) { + return _randomSource.getRandomNumber(maxNumber); +} + +} // End of namespace MADS |