From 4e39a41e6218c7206e706734eb608e9706e2678a Mon Sep 17 00:00:00 2001 From: Bertrand Augereau Date: Wed, 3 Aug 2011 12:24:06 +0200 Subject: DREAWMEB: Ported 'zoom' to C++ --- engines/dreamweb/dreamgen.cpp | 51 ------------------------------------------- engines/dreamweb/dreamgen.h | 3 +-- engines/dreamweb/stubs.h | 1 + engines/dreamweb/vgagrafx.cpp | 28 ++++++++++++++++++++++++ 4 files changed, 30 insertions(+), 53 deletions(-) (limited to 'engines/dreamweb') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index a43816153e..99ad3b36a9 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -3160,56 +3160,6 @@ void DreamGenContext::createpanel2() { showframe(); } -void DreamGenContext::zoom() { - STACK_CHECK; - _cmp(data.word(kWatchingtime), 0); - if (!flags.z()) - return /* (inwatching) */; - _cmp(data.byte(kZoomon), 1); - if (flags.z()) - goto zoomswitch; - return; -zoomswitch: - _cmp(data.byte(kCommandtype), 199); - if (flags.c()) - goto zoomit; - putunderzoom(); - return; -zoomit: - ax = data.word(kOldpointery); - _sub(ax, 9); - cx = (320); - _mul(cx); - _add(ax, data.word(kOldpointerx)); - _sub(ax, 11); - si = ax; - ax = (132)+4; - cx = (320); - _mul(cx); - _add(ax, (8)+5); - di = ax; - es = data.word(kWorkspace); - ds = data.word(kWorkspace); - cx = 20; -zoomloop: - push(cx); - cx = 23; -zoomloop2: - _lodsb(); - ah = al; - _stosw(); - es.word(di+(320)-2) = ax; - if (--cx) - goto zoomloop2; - _add(si, (320)-23); - _add(di, (320)-46+(320)); - cx = pop(); - if (--cx) - goto zoomloop; - crosshair(); - data.byte(kDidzoom) = 1; -} - void DreamGenContext::delthisone() { STACK_CHECK; push(ax); @@ -20227,7 +20177,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) { case addr_createpanel2: createpanel2(); break; case addr_vsync: vsync(); break; case addr_doshake: doshake(); break; - case addr_zoom: zoom(); break; case addr_delthisone: delthisone(); break; case addr_doblocks: doblocks(); break; case addr_transferinv: transferinv(); break; diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 026ba1c3aa..3e6a720a15 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -625,7 +625,6 @@ public: static const uint16 addr_transferinv = 0xc240; static const uint16 addr_doblocks = 0xc228; static const uint16 addr_delthisone = 0xc214; - static const uint16 addr_zoom = 0xc210; static const uint16 addr_doshake = 0xc20c; static const uint16 addr_vsync = 0xc208; static const uint16 addr_createpanel2 = 0xc200; @@ -1662,7 +1661,7 @@ public: void usedryer(); void dumpeverything(); void usehatch(); - void zoom(); + //void zoom(); void outofinv(); void viewfolder(); //void walking(); diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index ddcde72da6..0f2202d28b 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -109,4 +109,5 @@ void cancelch1(); void plotreel(); void dealwithspecial(); + void zoom(); diff --git a/engines/dreamweb/vgagrafx.cpp b/engines/dreamweb/vgagrafx.cpp index e61532fdb9..5acd2ec01f 100644 --- a/engines/dreamweb/vgagrafx.cpp +++ b/engines/dreamweb/vgagrafx.cpp @@ -387,5 +387,33 @@ void DreamGenContext::clearwork() { memset(workspace(), 0, 320*200); } +void DreamGenContext::zoom() { + if (data.word(kWatchingtime) != 0) + return; + if (data.byte(kZoomon) != 1) + return; + if (data.byte(kCommandtype) >= 199) { + putunderzoom(); + return; + } + uint16 srcOffset = (data.word(kOldpointery) - 9) * 320 + (data.word(kOldpointerx) - 11); + uint16 dstOffset = (kZoomy + 4) * 320 + (kZoomx + 5); + const uint8 *src = workspace() + srcOffset; + uint8 *dst = workspace() + dstOffset; + for(size_t i=0; i<20; ++i) { + for(size_t j=0; j<23; ++j) { + uint8 v = src[j]; + dst[2*j+0] = v; + dst[2*j+1] = v; + dst[2*j+320] = v; + dst[2*j+321] = v; + } + src += 320; + dst += 320*2; + } + crosshair(); + data.byte(kDidzoom) = 1; +} + } /*namespace dreamgen */ -- cgit v1.2.3