aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWillem Jan Palenstijn2011-11-20 19:54:19 +0100
committerWillem Jan Palenstijn2011-11-20 19:57:06 +0100
commitb7eb5eff3813cf2784c834e48f99d3192d72ea52 (patch)
treee4cbeedc5fe44b593ba78e57d88b2725a4c1c5e4
parent6cab17c832d01bb7963040b99fcb9c4e546dd582 (diff)
downloadscummvm-rg350-b7eb5eff3813cf2784c834e48f99d3192d72ea52.tar.gz
scummvm-rg350-b7eb5eff3813cf2784c834e48f99d3192d72ea52.tar.bz2
scummvm-rg350-b7eb5eff3813cf2784c834e48f99d3192d72ea52.zip
DREAMWEB: Reduce code duplication
-rw-r--r--engines/dreamweb/stubs.cpp76
-rw-r--r--engines/dreamweb/stubs.h5
2 files changed, 22 insertions, 59 deletions
diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp
index d520307e0d..2bfa3849c6 100644
--- a/engines/dreamweb/stubs.cpp
+++ b/engines/dreamweb/stubs.cpp
@@ -213,41 +213,52 @@ void DreamGenContext::screenupdate() {
if (quitRequested())
return;
animpointer();
+
showpointer();
if ((data.word(kWatchingtime) == 0) && (data.byte(kNewlocation) != 0xff))
return;
vsync();
- readmouse1();
+ uint16 mouseState = 0;
+ mouseState |= readMouseState();
dumppointer();
+
dumptextline();
delpointer();
autolook();
spriteupdate();
watchcount();
zoom();
+
showpointer();
if (data.byte(kWongame))
return;
vsync();
- readmouse2();
+ mouseState |= readMouseState();
dumppointer();
+
dumpzoom();
delpointer();
deleverything();
printsprites();
reelsonscreen();
afternewroom();
+
showpointer();
vsync();
- readmouse3();
+ mouseState |= readMouseState();
dumppointer();
+
dumpmap();
dumptimedtext();
delpointer();
+
showpointer();
vsync();
- readmouse4();
+ data.word(kOldbutton) = data.word(kMousebutton);
+ mouseState |= readMouseState();
+ data.word(kMousebutton) = mouseState;
dumppointer();
+
dumpwatch();
delpointer();
}
@@ -270,18 +281,9 @@ void DreamGenContext::startup() {
void DreamGenContext::startup1() {
clearpalette();
data.byte(kThroughdoor) = 0;
- data.byte(kCurrentkey) = '0';
- data.byte(kMainmode) = 0;
- createpanel();
- data.byte(kNewobs) = 1;
- drawfloor();
- showicon();
- getunderzoom();
- spriteupdate();
- printsprites();
- undertextline();
- reelsonscreen();
- atmospheres();
+
+ startup();
+
worktoscreen();
fadescreenup();
}
@@ -454,54 +456,18 @@ void DreamGenContext::mousecall() {
void DreamGenContext::readmouse() {
data.word(kOldbutton) = data.word(kMousebutton);
- data.word(kOldx) = data.word(kMousex);
- data.word(kOldy) = data.word(kMousey);
- uint16 x, y, state;
- engine->mouseCall(&x, &y, &state);
- data.word(kMousex) = x;
- data.word(kMousey) = y;
+ uint16 state = readMouseState();
data.word(kMousebutton) = state;
}
-void DreamGenContext::readmouse1() {
- data.word(kOldx) = data.word(kMousex);
- data.word(kOldy) = data.word(kMousey);
- uint16 x, y, state;
- engine->mouseCall(&x, &y, &state);
- data.word(kMousex) = x;
- data.word(kMousey) = y;
- data.word(kMousebutton1) = state;
-}
-
-void DreamGenContext::readmouse2() {
- data.word(kOldx) = data.word(kMousex);
- data.word(kOldy) = data.word(kMousey);
- uint16 x, y, state;
- engine->mouseCall(&x, &y, &state);
- data.word(kMousex) = x;
- data.word(kMousey) = y;
- data.word(kMousebutton2) = state;
-}
-
-void DreamGenContext::readmouse3() {
- data.word(kOldx) = data.word(kMousex);
- data.word(kOldy) = data.word(kMousey);
- uint16 x, y, state;
- engine->mouseCall(&x, &y, &state);
- data.word(kMousex) = x;
- data.word(kMousey) = y;
- data.word(kMousebutton3) = state;
-}
-
-void DreamGenContext::readmouse4() {
- data.word(kOldbutton) = data.word(kMousebutton);
+uint16 DreamGenContext::readMouseState() {
data.word(kOldx) = data.word(kMousex);
data.word(kOldy) = data.word(kMousey);
uint16 x, y, state;
engine->mouseCall(&x, &y, &state);
data.word(kMousex) = x;
data.word(kMousey) = y;
- data.word(kMousebutton) = state | data.word(kMousebutton1) | data.word(kMousebutton2) | data.word(kMousebutton3);
+ return state;
}
void DreamGenContext::setmouse() {
diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h
index 29f888cd2d..3aedb105d6 100644
--- a/engines/dreamweb/stubs.h
+++ b/engines/dreamweb/stubs.h
@@ -222,10 +222,7 @@
void checkcoords();
void checkcoords(const RectWithCallback *rectWithCallbacks);
void readmouse();
- void readmouse1();
- void readmouse2();
- void readmouse3();
- void readmouse4();
+ uint16 readMouseState();
uint16 waitframes();
void drawflags();
void addtopeoplelist();