aboutsummaryrefslogtreecommitdiff
path: root/engines/dreamweb
diff options
context:
space:
mode:
authorBertrand Augereau2011-07-21 23:21:35 +0200
committerBertrand Augereau2011-07-23 18:23:40 +0200
commit402e41dd676dc33e147afa03a95e6aecb1c82bbe (patch)
treec0eb5248f0d632777c61c4cd8c6b16bd48c24ea6 /engines/dreamweb
parent60d4970fd091c618194684bc0030d70fc3808138 (diff)
downloadscummvm-rg350-402e41dd676dc33e147afa03a95e6aecb1c82bbe.tar.gz
scummvm-rg350-402e41dd676dc33e147afa03a95e6aecb1c82bbe.tar.bz2
scummvm-rg350-402e41dd676dc33e147afa03a95e6aecb1c82bbe.zip
DREAMWEB: Less register usage in 'getnumber'
Diffstat (limited to 'engines/dreamweb')
-rw-r--r--engines/dreamweb/stubs.cpp28
-rw-r--r--engines/dreamweb/stubs.h2
2 files changed, 9 insertions, 21 deletions
diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp
index 3bf26c28fd..1a14319e7a 100644
--- a/engines/dreamweb/stubs.cpp
+++ b/engines/dreamweb/stubs.cpp
@@ -336,7 +336,7 @@ uint8 DreamGenContext::printslow(uint16 x, uint16 y, uint8 maxWidth, bool center
do {
push(di);
uint16 offset = x;
- uint16 charCount = getnumber(maxWidth, centered, &offset);
+ uint16 charCount = getnumber(si, maxWidth, centered, &offset);
do {
push(si);
push(es);
@@ -400,7 +400,7 @@ void DreamGenContext::printdirect() {
push(di);
push(dx);
uint16 offset;
- uint8 charCount = getnumber(dl, (bool)(dl & 1), &offset);
+ uint8 charCount = getnumber(si, dl, (bool)(dl & 1), &offset);
di = offset;
uint16 x = di;
do {
@@ -429,20 +429,16 @@ void DreamGenContext::printdirect() {
void DreamGenContext::getnumber() {
uint16 offset = di;
- cl = getnumber(dl, (bool)(dl & 1), &offset);
+ cl = getnumber(si, dl, (bool)(dl & 1), &offset);
di = offset;
}
-uint8 DreamGenContext::getnumber(uint16 maxWidth, bool centered, uint16* offset) {
+uint8 DreamGenContext::getnumber(uint16 index, uint16 maxWidth, bool centered, uint16* offset) {
uint8 totalWidth = 0;
uint8 charCount = 0;
- push(si);
- push(bx);
push(di);
- push(ds);
- push(es);
- di = si;
- *offset = di;
+ di = index;
+ *offset = index;
while (true) {
uint8 wordTotalWidth, wordCharCount;
uint8 done = getnextword(es.ptr(di, 0), &wordTotalWidth, &wordCharCount);
@@ -461,12 +457,8 @@ uint8 DreamGenContext::getnumber(uint16 maxWidth, bool centered, uint16* offset)
} else {
ax = 0;
}
- es = pop();
- ds = pop();
di = pop();
- bx = pop();
- si = pop();
- _add(di, ax);
+ di += ax;
*offset = di;
return charCount;
}
@@ -478,12 +470,8 @@ uint8 DreamGenContext::getnumber(uint16 maxWidth, bool centered, uint16* offset)
} else {
ax = 0;
}
- es = pop();
- ds = pop();
di = pop();
- bx = pop();
- si = pop();
- _add(di, ax);
+ di += ax;
*offset = di;
return charCount;
}
diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h
index 690ae5003a..9cbd3f33a6 100644
--- a/engines/dreamweb/stubs.h
+++ b/engines/dreamweb/stubs.h
@@ -48,7 +48,7 @@
void printslow();
void dumptextline();
void getnumber();
- uint8 getnumber(uint16 maxWidth, bool centered, uint16* offset);
+ uint8 getnumber(uint16 index, uint16 maxWidth, bool centered, uint16* offset);
void kernchars();
uint8 kernchars(uint8 firstChar, uint8 secondChar, uint8 width);
Sprite *spritetable();