diff --git a/engines/cge/cge.cpp b/engines/cge/cge.cpp index 87c3964563a..7eeb20bebba 100644 --- a/engines/cge/cge.cpp +++ b/engines/cge/cge.cpp @@ -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"); diff --git a/engines/cge/cge.h b/engines/cge/cge.h index 04f395559f1..a3adf43dde5 100644 --- a/engines/cge/cge.h +++ b/engines/cge/cge.h @@ -70,6 +70,7 @@ public: bool _music; int _pocref[POCKET_NX]; uint8 _volume[2]; + Common::RandomSource _randomSource; virtual Common::Error run(); GUI::Debugger *getDebugger() { diff --git a/engines/cge/general.cpp b/engines/cge/general.cpp index c4552e6f231..30b5f3186bb 100644 --- a/engines/cge/general.cpp +++ b/engines/cge/general.cpp @@ -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