aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/dreamweb/dreamweb.cpp29
-rw-r--r--engines/dreamweb/dreamweb.h14
2 files changed, 30 insertions, 13 deletions
diff --git a/engines/dreamweb/dreamweb.cpp b/engines/dreamweb/dreamweb.cpp
index c25ee6a6ba..f2c86eb38d 100644
--- a/engines/dreamweb/dreamweb.cpp
+++ b/engines/dreamweb/dreamweb.cpp
@@ -44,25 +44,26 @@
namespace DreamWeb {
-DreamWebEngine::DreamWebEngine(OSystem *syst, const DreamWebGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc) {
+DreamWebEngine *DreamWebEngine::_instance;
+
+DreamWebEngine::DreamWebEngine(OSystem *syst, const DreamWebGameDescription *gameDesc) :
+ Engine(syst), _gameDescription(gameDesc), _rnd("dreamweb") {
// Setup mixer
_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume"));
_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume"));
_mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, ConfMan.getInt("speech_volume"));
- _rnd = new Common::RandomSource("dreamweb");
-
_vSyncInterrupt = false;
_console = 0;
DebugMan.addDebugChannel(kDebugAnimation, "Animation", "Animation Debug Flag");
DebugMan.addDebugChannel(kDebugSaveLoad, "SaveLoad", "Track Save/Load Function");
+ _instance = this;
}
DreamWebEngine::~DreamWebEngine() {
DebugMan.clearAllDebugChannels();
delete _console;
- delete _rnd;
}
// Let's see if it's a good idea to emulate VSYNC interrupts with a timer like
@@ -136,6 +137,11 @@ Common::Error DreamWebEngine::run() {
namespace dreamgen {
+
+static inline DreamWeb::DreamWebEngine *engine() {
+ return DreamWeb::DreamWebEngine::instance();
+}
+
void seecommandtail(Context &context) {
context.ds.word(kSoundbaseadd) = 0x220;
context.ds.byte(kSoundint) = 5;
@@ -145,7 +151,7 @@ void seecommandtail(Context &context) {
}
void randomnumber(Context &context) {
- ::error("randomnumber");
+ context.al = engine()->randomNumber();
}
void quickquit(Context &context) {
@@ -201,11 +207,18 @@ void mousecall(Context &context) {
}
void setmouse(Context &context) {
- ::error("setmouse");
+ context.ds.word(kOldpointerx) = 0xffff;
+ warning("setmouse: fixme: add range setting");
+ //set vertical range to 15-184
+ //set horizontal range to 15-298*2
}
void gettime(Context &context) {
- ::error("gettime");
+ warning("gettime: stub: ");
+ context.ch = 10;
+ context.cl = 15;
+ context.dh = 0;
+;
}
void allocatemem(Context &context) {
@@ -357,7 +370,7 @@ void showgroup(Context &context) {
}
void fadedos(Context &context) {
- ::error("fadedos");
+ warning("fadedos: STUB");
}
void doshake(Context &context) {
diff --git a/engines/dreamweb/dreamweb.h b/engines/dreamweb/dreamweb.h
index 2bff384f18..96aa61ab50 100644
--- a/engines/dreamweb/dreamweb.h
+++ b/engines/dreamweb/dreamweb.h
@@ -50,8 +50,9 @@ struct DreamWebGameDescription;
class DreamWebEngine : public Engine {
private:
- DreamWebConsole *_console;
- bool _vSyncInterrupt;
+ DreamWebConsole *_console;
+ bool _vSyncInterrupt;
+ static DreamWebEngine *_instance;
protected:
// Engine APIs
@@ -61,6 +62,7 @@ protected:
public:
DreamWebEngine(OSystem *syst, const DreamWebGameDescription *gameDesc);
virtual ~DreamWebEngine();
+ static DreamWebEngine* instance() { return _instance; }
void setVSyncInterrupt(bool flag);
void waitForVSync();
@@ -71,10 +73,12 @@ public:
bool canLoadGameStateCurrently();
bool canSaveGameStateCurrently();
- const DreamWebGameDescription *_gameDescription;
+//dreamgen public api:
+ uint8 randomNumber() { return _rnd.getRandomNumber(255); }
- Common::RandomSource *_rnd;
-
+private:
+ const DreamWebGameDescription *_gameDescription;
+ Common::RandomSource _rnd;
Common::Point _mouse;
};