From 9034191796702956e84067fd6cdfbc2bae1bf768 Mon Sep 17 00:00:00 2001 From: Vladimir Menshakov Date: Sat, 11 Jun 2011 16:08:30 +0400 Subject: [PATCH] DREAMWEB: removed dummy video segment, blacklisted video-related functions. --- devtools/tasmrecover/tasm-recover | 14 +++++- engines/dreamweb/dreamgen.cpp | 72 ------------------------------- engines/dreamweb/dreamgen.h | 3 ++ engines/dreamweb/dreamweb.cpp | 60 ++++++++++++++------------ engines/dreamweb/dreamweb.h | 2 + engines/dreamweb/runtime.h | 10 ++--- 6 files changed, 53 insertions(+), 108 deletions(-) diff --git a/devtools/tasmrecover/tasm-recover b/devtools/tasmrecover/tasm-recover index 1763a2524de..4c27cb59395 100755 --- a/devtools/tasmrecover/tasm-recover +++ b/devtools/tasmrecover/tasm-recover @@ -7,5 +7,17 @@ p = parser() p.strip_path = 3 context = p.parse('dreamweb/dreamweb.asm') p.link() -generator = cpp(context, "dreamgen", blacklist = ['randomnumber', 'quickquit', 'quickquit2', 'seecommandtail', 'multiget', 'multiput', 'multidump', 'frameoutnm']) +generator = cpp(context, "dreamgen", blacklist = [ + 'randomnumber', + 'quickquit', + 'quickquit2', + 'seecommandtail', + 'multiget', + 'multiput', + 'multidump', + 'frameoutnm', + 'cls', + 'printundermon', + 'worktoscreen', + ]) generator.generate('dreamweb') #start routine diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 81d76fe3a4c..2cb71e061ed 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -10,7 +10,6 @@ void readsetdata(Context &context); void loadpalfromiff(Context &context); void titles(Context &context); void credits(Context &context); -void cls(Context &context); void decide(Context &context); void clearchanges(Context &context); void loadroom(Context &context); @@ -60,7 +59,6 @@ void animpointer(Context &context); void showpointer(Context &context); void dumppointer(Context &context); void commandonly(Context &context); -void worktoscreen(Context &context); void showtime(Context &context); void showwatch(Context &context); void printmessage(Context &context); @@ -279,7 +277,6 @@ void modifychar(Context &context); void printchar(Context &context); void showcurrentfile(Context &context); void printlogo(Context &context); -void printundermon(Context &context); void randomaccess(Context &context); void locklighton(Context &context); void locklightoff(Context &context); @@ -430,7 +427,6 @@ void frameoutbh(Context &context); void frameoutv(Context &context); void putunderzoom(Context &context); void crosshair(Context &context); -void width160(Context &context); void maptopanel(Context &context); void movemap(Context &context); void dealwithspecial(Context &context); @@ -4034,71 +4030,6 @@ nought: return; } -void cls(Context & context) { - context.ax = 0x0a000; - context.es = context.ax; - context.di = 0; - context.cx = 0x7fff; - context.ax = 0; - while(context.cx--) context._stosw(); - return; -} - -void printundermon(Context & context) { - context.si = ((320)*43)+76; - context.di = context.si; - context.es = context.data.word(kWorkspace); - context._add(context.si, 8*(320)); - context.dx = 0x0a000; - context.ds = context.dx; - context.cx = 104; -scrollmonloop1: - context.push(context.cx); - context.push(context.di); - context.push(context.si); - context.cx = 170; -scrollmonloop2: - context._lodsb(); - context._cmp(context.al, 231); - if (!context.flags.c()) goto dontplace; -placeit: - context._stosb(); - if (--context.cx) goto scrollmonloop2; - goto finmonscroll; -dontplace: - context._add(context.di, 1); - if (--context.cx) goto scrollmonloop2; -finmonscroll: - context.si = context.pop(); - context.di = context.pop(); - context.cx = context.pop(); - context._add(context.si, (320)); - context._add(context.di, (320)); - if (--context.cx) goto scrollmonloop1; - return; -} - -void worktoscreen(Context & context) { - vsync(context); - context.si = 0; - context.di = 0; - context.cx = 25; - context.ds = context.data.word(kWorkspace); - context.dx = 0x0a000; - context.es = context.dx; -dumpallloop: - width160(context); - width160(context); - width160(context); - width160(context); - width160(context); - width160(context); - width160(context); - width160(context); - if (--context.cx) goto dumpallloop; - return; -} - void paneltomap(Context & context) { context.di = context.data.word(kMapxstart); context._add(context.di, context.data.word(kMapadx)); @@ -21321,9 +21252,6 @@ void __dispatch_call(Context &context, unsigned addr) { case 0xc1d4: readoneblock(context); break; case 0xc1d8: loadpalfromiff(context); break; case 0xc1dc: setmode(context); break; - case 0xc1e0: cls(context); break; - case 0xc1e4: printundermon(context); break; - case 0xc1e8: worktoscreen(context); break; case 0xc1ec: paneltomap(context); break; case 0xc1f0: maptopanel(context); break; case 0xc1f4: dumpmap(context); break; diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index fcbf738a00a..40e3539a0d0 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -16,6 +16,9 @@ namespace dreamgen { void multiput(Context &context); void multidump(Context &context); void frameoutnm(Context &context); + void cls(Context &context); + void printundermon(Context &context); + void worktoscreen(Context &context); void keyboardread(Context &context); void resetkeyboard(Context &context); void setkeyboardint(Context &context); diff --git a/engines/dreamweb/dreamweb.cpp b/engines/dreamweb/dreamweb.cpp index 556ed118391..4e24c4917ff 100644 --- a/engines/dreamweb/dreamweb.cpp +++ b/engines/dreamweb/dreamweb.cpp @@ -86,16 +86,6 @@ void DreamWebEngine::setVSyncInterrupt(bool flag) { void DreamWebEngine::waitForVSync() { processEvents(); - Graphics::Surface *s = _system->lockScreen(); - if (!s) - error("lockScreen failed"); - for(int y = 0; y < 200; ++y) { - uint8 *scanline = (uint8*)s->getBasePtr(0, y); - uint8 *src = _context.video.ptr(y * 320, 320); - memcpy(scanline, src, 320); - } - _system->unlockScreen(); - _system->updateScreen(); /* while (!_vSyncInterrupt) { _system->delayMillis(10); @@ -220,6 +210,7 @@ void DreamWebEngine::setGraphicsMode() { } void DreamWebEngine::fadeDos() { + waitForVSync(); //processEvents will be called from vsync PaletteManager *palette = _system->getPaletteManager(); _context.ds = _context.es = _context.data.word(dreamgen::kBuffers); @@ -231,9 +222,8 @@ void DreamWebEngine::fadeDos() { --dst[c]; } } - //Common::hexdump(dst, 64 * 3); - //palette->setPalette(dst, 0, 64); - //waitForVSync(); + palette->setPalette(dst, 0, 64); + waitForVSync(); } } void DreamWebEngine::setPalette() { @@ -242,7 +232,7 @@ void DreamWebEngine::setPalette() { PaletteManager *palette = _system->getPaletteManager(); unsigned n = (uint16)_context.cx; uint8 *src = _context.ds.ptr(_context.si, n * 3); - for(int i = 0; i < n * 3; ++i) + for(unsigned i = 0; i < n * 3; ++i) colors[i] = src[i] * 3; //Common::hexdump(colors, n * 3); palette->setPalette(colors, _context.al, n); @@ -250,6 +240,15 @@ void DreamWebEngine::setPalette() { _context.cx = 0; } +void DreamWebEngine::blit(uint8 *src, int pitch, int x, int y, int w, int h) { + _system->copyRectToScreen(src, pitch, x, y, w, h); +} + +void DreamWebEngine::cls() { + _system->fillScreen(0); +} + + } // End of namespace DreamWeb @@ -289,17 +288,25 @@ void multiput(Context &context) { } void multidump(Context &context) { - unsigned w = (uint8)context.cl, h = (uint8)context.ch; - context.es = 0xa000; - context.ds = context.data.word(kWorkspace); + int w = (uint8)context.cl, h = (uint8)context.ch; + int x = (int16)context.di, y = (int16)context.bx; + int pitch = (uint16)context.data.word(kScreenwidth); + unsigned offset = x + y * pitch; //debug(1, "multidump %ux%u -> segment: %04x->%04x", w, h, (uint16)context.ds, (uint16)context.es); - unsigned pitch = (uint16)context.data.word(kScreenwidth); - unsigned offset = (uint16)context.di + (uint16)context.bx * pitch; - for(unsigned y = 0; y < h; ++y, offset += pitch) { - uint8 *src_p = context.ds.ptr(offset, w); - uint8 *dst_p = context.es.ptr(offset, w); - memcpy(dst_p, src_p, w); - } + engine()->blit(context.ds.ptr(offset, w * h), pitch, x, y, w, h); +} + +void worktoscreen(Context &context) { + context.ds = context.data.word(kWorkspace); + engine()->blit(context.ds.ptr(0, 320 * 200), 320, 0, 0, 320, 200); +} + +void printundermon(Context &context) { + warning("printundermon: STUB"); +} + +void cls(Context &context) { + engine()->cls(); } void frameoutnm(Context &context) { @@ -579,12 +586,11 @@ void showgroup(Context &context) { } void fadedos(Context &context) { - vsync(context); engine()->fadeDos(); } void doshake(Context &context) { - ::error("doshake"); + warning("doshake: STUB"); } void vsync(Context &context) { @@ -683,8 +689,6 @@ normal: endline: context.di = context.pop(); context.push(context.si); - context.dx = 0xa000; - context.es = context.dx; context.si = 0+(228*13)+32+60; context.ds = context.data.word(kBuffers); diff --git a/engines/dreamweb/dreamweb.h b/engines/dreamweb/dreamweb.h index 5d2b71b23ad..3038de36526 100644 --- a/engines/dreamweb/dreamweb.h +++ b/engines/dreamweb/dreamweb.h @@ -87,6 +87,8 @@ public: void setGraphicsMode(); void setPalette(); void fadeDos(); + void blit(uint8 *src, int pitch, int x, int y, int w, int h); + void cls(); private: diff --git a/engines/dreamweb/runtime.h b/engines/dreamweb/runtime.h index 525a4df5b95..80ab8db384f 100644 --- a/engines/dreamweb/runtime.h +++ b/engines/dreamweb/runtime.h @@ -199,7 +199,7 @@ class Context { FreeSegmentList _freeSegments; public: - enum { kDefaultDataSegment = 0x1000, kVideoSegment = 0xa000 }; + enum { kDefaultDataSegment = 0x1000 }; Register ax, dx, bx, cx, si, di; LowPartOfRegister al; @@ -211,21 +211,17 @@ public: LowPartOfRegister dl; HighPartOfRegister dh; - SegmentRef cs, ds, es, data, video; + SegmentRef cs, ds, es, data; //data == fake segment register always pointing to data segment Flags flags; inline Context(): al(ax), ah(ax), bl(bx), bh(bx), cl(cx), ch(cx), dl(dx), dh(dx), - cs(this), ds(this), es(this), data(this), video(this) { + cs(this), ds(this), es(this), data(this) { _segments[kDefaultDataSegment] = SegmentPtr(new Segment()); - _segments[kVideoSegment] = SegmentPtr(new Segment()); - _segments[kVideoSegment]->data.resize(0x10000); - cs.reset(kDefaultDataSegment); ds.reset(kDefaultDataSegment); es.reset(kDefaultDataSegment); data.reset(kDefaultDataSegment); - video.reset(kVideoSegment); } SegmentRef getSegment(uint16 value) {