aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBertrand Augereau2011-08-03 16:44:29 +0200
committerBertrand Augereau2011-08-03 16:44:29 +0200
commit135efa50a1f96632dae985b593888eb706006d75 (patch)
tree17e8b38a675ad04adad83d8bbeb925f54bae92ef
parent2b03076149535d29c83b5ab5f165456a6238e57c (diff)
downloadscummvm-rg350-135efa50a1f96632dae985b593888eb706006d75.tar.gz
scummvm-rg350-135efa50a1f96632dae985b593888eb706006d75.tar.bz2
scummvm-rg350-135efa50a1f96632dae985b593888eb706006d75.zip
DREAMWEB: Less register interaction in 'multiput' and 'multiget'
-rw-r--r--engines/dreamweb/stubs.cpp6
-rw-r--r--engines/dreamweb/stubs.h4
-rw-r--r--engines/dreamweb/vgagrafx.cpp29
3 files changed, 18 insertions, 21 deletions
diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp
index be75abaf0d..12e3905657 100644
--- a/engines/dreamweb/stubs.cpp
+++ b/engines/dreamweb/stubs.cpp
@@ -291,7 +291,7 @@ void DreamGenContext::getundertimed() {
y -= 3;
ds = data.word(kBuffers);
si = kUndertimedtext;
- multiget(data.byte(kTimedx), y, 240, kUndertimedysize);
+ multiget(ds.ptr(si, 0), data.byte(kTimedx), y, 240, kUndertimedysize);
}
void DreamGenContext::putundertimed() {
@@ -300,7 +300,7 @@ void DreamGenContext::putundertimed() {
y -= 3;
ds = data.word(kBuffers);
si = kUndertimedtext;
- multiput(data.byte(kTimedx), y, 240, kUndertimedysize);
+ multiput(ds.ptr(si, 0), data.byte(kTimedx), y, 240, kUndertimedysize);
}
void DreamGenContext::usetimedtext() {
@@ -889,7 +889,7 @@ void DreamGenContext::deltextline() {
y -= 3;
ds = data.word(kBuffers);
si = kTextunder;
- multiput(x, y, kUndertextsizex, kUndertextsizey);
+ multiput(ds.ptr(si, 0), x, y, kUndertextsizex, kUndertextsizey);
}
} /*namespace dreamgen */
diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h
index 61761a4c8c..d7f71aed5f 100644
--- a/engines/dreamweb/stubs.h
+++ b/engines/dreamweb/stubs.h
@@ -31,7 +31,7 @@
void frameoutfx(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y);
void worktoscreen();
void multiget();
- void multiget(uint16 x, uint16 y, uint8 width, uint8 height);
+ void multiget(uint8 *dst, uint16 x, uint16 y, uint8 width, uint8 height);
void convertkey();
void cls();
void printsprites();
@@ -70,7 +70,7 @@
void showframe(const void *frameData, uint16 x, uint16 y, uint16 frameNumber, uint8 effectsFlag, uint8 *width, uint8 *height);
void printasprite(const Sprite *sprite);
void width160();
- void multiput(uint16 x, uint16 y, uint8 width, uint8 height);
+ void multiput(const uint8 *src, uint16 x, uint16 y, uint8 width, uint8 height);
void multiput();
void eraseoldobs();
void clearsprites();
diff --git a/engines/dreamweb/vgagrafx.cpp b/engines/dreamweb/vgagrafx.cpp
index 5acd2ec01f..a4f8d83117 100644
--- a/engines/dreamweb/vgagrafx.cpp
+++ b/engines/dreamweb/vgagrafx.cpp
@@ -39,13 +39,14 @@ void DreamGenContext::allocatework() {
}
void DreamGenContext::multiget() {
- multiget(di, bx, cl, ch);
+ multiget(ds.ptr(si, 0), di, bx, cl, ch);
+ si += cl * ch;
+ di += bx * kScreenwidth + kScreenwidth * ch;
+ cx = 0;
}
-void DreamGenContext::multiget(uint16 x, uint16 y, uint8 w, uint8 h) {
+void DreamGenContext::multiget(uint8 *dst, uint16 x, uint16 y, uint8 w, uint8 h) {
unsigned src = x + y * kScreenwidth;
- unsigned dst = (uint16)si;
- es = ds;
ds = data.word(kWorkspace);
if (y + h > 200)
h = 200 - y;
@@ -53,21 +54,20 @@ void DreamGenContext::multiget(uint16 x, uint16 y, uint8 w, uint8 h) {
w = 320 - x;
//debug(1, "multiget %u,%u %ux%u -> segment: %04x->%04x", x, y, w, h, (uint16)ds, (uint16)es);
for(unsigned l = 0; l < h; ++l) {
- uint8 *src_p = ds.ptr(src + kScreenwidth * l, w);
- uint8 *dst_p = es.ptr(dst + w * l, w);
+ const uint8 *src_p = ds.ptr(src + kScreenwidth * l, w);
+ uint8 *dst_p = dst + w * l;
memcpy(dst_p, src_p, w);
}
- si += w * h;
- di = src + kScreenwidth * h;
- cx = 0;
}
void DreamGenContext::multiput() {
- multiput(di, bx, cl, ch);
+ multiput(ds.ptr(si, 0), di, bx, cl, ch);
+ si += cl * ch;
+ di += bx * kScreenwidth + kScreenwidth * ch;
+ cx = 0;
}
-void DreamGenContext::multiput(uint16 x, uint16 y, uint8 w, uint8 h) {
- unsigned src = (uint16)si;
+void DreamGenContext::multiput(const uint8 *src, uint16 x, uint16 y, uint8 w, uint8 h) {
unsigned dst = x + y * kScreenwidth;
es = data.word(kWorkspace);
if (y + h > 200)
@@ -76,13 +76,10 @@ void DreamGenContext::multiput(uint16 x, uint16 y, uint8 w, uint8 h) {
w = 320 - x;
//debug(1, "multiput %ux%u -> segment: %04x->%04x", w, h, (uint16)ds, (uint16)es);
for(unsigned l = 0; l < h; ++l) {
- uint8 *src_p = ds.ptr(src + w * l, w);
+ const uint8 *src_p = src + w * l;
uint8 *dst_p = es.ptr(dst + kScreenwidth * l, w);
memcpy(dst_p, src_p, w);
}
- si += w * h;
- di = dst + kScreenwidth * h;
- cx = 0;
}
void DreamGenContext::multidump(uint16 x, uint16 y, uint8 width, uint8 height) {