MADS: Initial implementation of Adlib sound driver

This commit is contained in:
Paul Gilbert 2014-02-16 15:22:57 -05:00
parent a41db1939c
commit d4df315e87
10 changed files with 1949 additions and 0 deletions

74
engines/mads/mads.cpp Normal file
View file

@ -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