aboutsummaryrefslogtreecommitdiff
path: root/engines/dreamweb/dreamweb.cpp
diff options
context:
space:
mode:
authorVladimir Menshakov2011-06-17 00:30:39 +0400
committerVladimir Menshakov2011-06-17 00:31:36 +0400
commit6fe3e63ed1dc190c9ef6cf21b0d1890b5ebea03a (patch)
tree2c0a91032b20c846ae5f258749cfbab179800fdc /engines/dreamweb/dreamweb.cpp
parent1a58262ca72fd09748755463299e54749d5c63ae (diff)
downloadscummvm-rg350-6fe3e63ed1dc190c9ef6cf21b0d1890b5ebea03a.tar.gz
scummvm-rg350-6fe3e63ed1dc190c9ef6cf21b0d1890b5ebea03a.tar.bz2
scummvm-rg350-6fe3e63ed1dc190c9ef6cf21b0d1890b5ebea03a.zip
DREAMWEB: replaced generated code with c++ style stubs
Diffstat (limited to 'engines/dreamweb/dreamweb.cpp')
-rw-r--r--engines/dreamweb/dreamweb.cpp52
1 files changed, 23 insertions, 29 deletions
diff --git a/engines/dreamweb/dreamweb.cpp b/engines/dreamweb/dreamweb.cpp
index 37d47b26c5..cb66dda26b 100644
--- a/engines/dreamweb/dreamweb.cpp
+++ b/engines/dreamweb/dreamweb.cpp
@@ -42,12 +42,6 @@
#include "dreamweb/dreamweb.h"
#include "dreamweb/dreamgen.h"
-namespace DreamGen {
- void doshake(DreamGen::Context &context);
- void dofade(DreamGen::Context &context);
- void volumeadjust(DreamGen::Context &context);
-}
-
namespace DreamWeb {
DreamWebEngine::DreamWebEngine(OSystem *syst, const DreamWebGameDescription *gameDesc) :
@@ -100,8 +94,8 @@ void DreamWebEngine::waitForVSync() {
setVSyncInterrupt(false);
}
- DreamGen::doshake(_context);
- DreamGen::dofade(_context);
+ _context.doshake();
+ _context.dofade();
_system->updateScreen();
}
@@ -139,8 +133,8 @@ void DreamWebEngine::processEvents() {
break;
case Common::KEYCODE_c: //skip statue puzzle
- _context.data.byte(DreamGen::kSymbolbotnum) = 3;
- _context.data.byte(DreamGen::kSymboltopnum) = 5;
+ _context.data.byte(DreamGen::DreamGenContext::kSymbolbotnum) = 3;
+ _context.data.byte(DreamGen::DreamGenContext::kSymboltopnum) = 5;
break;
default:
@@ -170,7 +164,7 @@ void DreamWebEngine::processEvents() {
break;
}
- _context.data.byte(DreamGen::kLasthardkey) = hardKey;
+ _context.data.byte(DreamGen::DreamGenContext::kLasthardkey) = hardKey;
// The rest of the keys are converted to ASCII. This
// is fairly restrictive, and eventually we may want
@@ -213,7 +207,7 @@ Common::Error DreamWebEngine::run() {
getTimerManager()->installTimerProc(vSyncInterrupt, 1000000 / 70, this);
//http://martin.hinner.info/vga/timing.html
- DreamGen::__start(_context);
+ _context.__start();
getTimerManager()->removeTimerProc(vSyncInterrupt);
@@ -294,13 +288,13 @@ uint DreamWebEngine::readFromSaveFile(uint8 *data, uint size) {
void DreamWebEngine::keyPressed(uint16 ascii) {
debug(2, "key pressed = %04x", ascii);
uint8* keybuf = _context.data.ptr(5912, 16); //fixme: some hardcoded offsets are not added as consts
- uint16 in = (_context.data.word(DreamGen::kBufferin) + 1) & 0x0f;
- uint16 out = _context.data.word(DreamGen::kBufferout);
+ uint16 in = (_context.data.word(DreamGen::DreamGenContext::kBufferin) + 1) & 0x0f;
+ uint16 out = _context.data.word(DreamGen::DreamGenContext::kBufferout);
if (in == out) {
warning("keyboard buffer is full");
return;
}
- _context.data.word(DreamGen::kBufferin) = in;
+ _context.data.word(DreamGen::DreamGenContext::kBufferin) = in;
keybuf[in] = ascii;
}
@@ -326,11 +320,11 @@ void DreamWebEngine::mouseCall() {
}
void DreamWebEngine::fadeDos() {
- _context.ds = _context.es = _context.data.word(DreamGen::kBuffers);
+ _context.ds = _context.es = _context.data.word(DreamGen::DreamGenContext::kBuffers);
return; //fixme later
waitForVSync();
//processEvents will be called from vsync
- uint8 *dst = _context.es.ptr(DreamGen::kStartpal, 768);
+ uint8 *dst = _context.es.ptr(DreamGen::DreamGenContext::kStartpal, 768);
getPalette(dst, 0, 64);
for(int fade = 0; fade < 64; ++fade) {
for(int c = 0; c < 768; ++c) { //original sources decrement 768 values -> 256 colors
@@ -379,9 +373,9 @@ void DreamWebEngine::blit(const uint8 *src, int pitch, int x, int y, int w, int
}
void DreamWebEngine::printUnderMonitor() {
- _context.es = _context.data.word(DreamGen::kWorkspace);
- _context.di = DreamGen::kScreenwidth * 43 + 76;
- _context.si = _context.di + 8 * DreamGen::kScreenwidth;
+ _context.es = _context.data.word(DreamGen::DreamGenContext::kWorkspace);
+ _context.di = DreamGen::DreamGenContext::kScreenwidth * 43 + 76;
+ _context.si = _context.di + 8 * DreamGen::DreamGenContext::kScreenwidth;
Graphics::Surface *s = _system->lockScreen();
if (!s)
@@ -397,8 +391,8 @@ void DreamWebEngine::printUnderMonitor() {
++dst; ++src;
}
}
- _context._add(_context.di, DreamGen::kScreenwidth);
- _context._add(_context.si, DreamGen::kScreenwidth);
+ _context._add(_context.di, DreamGen::DreamGenContext::kScreenwidth);
+ _context._add(_context.si, DreamGen::DreamGenContext::kScreenwidth);
}
_context.cx = 0;
_system->unlockScreen();
@@ -477,10 +471,10 @@ bool DreamWebEngine::loadSpeech(const Common::String &filename) {
void DreamWebEngine::soundHandler() {
_context.push(_context.ax);
- volumeadjust(_context);
+ _context.volumeadjust();
_context.ax = _context.pop();
- uint volume = _context.data.byte(DreamGen::kVolume);
+ uint volume = _context.data.byte(DreamGen::DreamGenContext::kVolume);
//.vol file loaded into soundbuf:0x4000
//volume table at (volume * 0x100 + 0x3f00)
//volume value could be from 1 to 7
@@ -496,13 +490,13 @@ void DreamWebEngine::soundHandler() {
volume = (8 - volume) * Audio::Mixer::kMaxChannelVolume / 8;
_mixer->setChannelVolume(_channelHandle[0], volume);
- uint8 ch0 = _context.data.byte(DreamGen::kCh0playing);
+ uint8 ch0 = _context.data.byte(DreamGen::DreamGenContext::kCh0playing);
if (ch0 == 255)
ch0 = 0;
- uint8 ch1 = _context.data.byte(DreamGen::kCh1playing);
+ uint8 ch1 = _context.data.byte(DreamGen::DreamGenContext::kCh1playing);
if (ch1 == 255)
ch1 = 0;
- uint8 ch0loop = _context.data.byte(DreamGen::kCh0repeat);
+ uint8 ch0loop = _context.data.byte(DreamGen::DreamGenContext::kCh0repeat);
if (_channel0 != ch0) {
_channel0 = ch0;
@@ -517,11 +511,11 @@ void DreamWebEngine::soundHandler() {
}
}
if (!_mixer->isSoundHandleActive(_channelHandle[0])) {
- _context.data.byte(DreamGen::kCh0playing) = 255;
+ _context.data.byte(DreamGen::DreamGenContext::kCh0playing) = 255;
_channel0 = 0;
}
if (!_mixer->isSoundHandleActive(_channelHandle[1])) {
- _context.data.byte(DreamGen::kCh1playing) = 255;
+ _context.data.byte(DreamGen::DreamGenContext::kCh1playing) = 255;
_channel1 = 0;
}