CGE: Implement random number source

This commit is contained in:
Paul Gilbert 2011-07-05 20:51:29 +10:00
parent a1f177317c
commit 41c7482a52
3 changed files with 4 additions and 3 deletions

View File

@ -41,7 +41,7 @@
namespace CGE {
CGEEngine::CGEEngine(OSystem *syst, const ADGameDescription *gameDescription)
: Engine(syst), _gameDescription(gameDescription) {
: Engine(syst), _gameDescription(gameDescription), _randomSource("cge") {
// Debug/console setup
DebugMan.addDebugChannel(kCGEDebug, "general", "CGE general debug channel");

View File

@ -70,6 +70,7 @@ public:
bool _music;
int _pocref[POCKET_NX];
uint8 _volume[2];
Common::RandomSource _randomSource;
virtual Common::Error run();
GUI::Debugger *getDebugger() {

View File

@ -25,6 +25,7 @@
* Copyright (c) 1994-1995 Janus B. Wisniewski and L.K. Avalon
*/
#include "cge/cge.h"
#include "cge/general.h"
#include "cge/snddrv.h"
#include "cge/wav.h"
@ -356,8 +357,7 @@ long timer(void) {
}
int new_random(int range) {
warning("STUB: new_random(a)");
return 0;
return ((CGEEngine *)g_engine)->_randomSource.getRandomNumber(range - 1);
}
#define TIMER_INT 0x08