aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWillem Jan Palenstijn2011-11-14 20:22:45 +0100
committerWillem Jan Palenstijn2011-11-14 21:43:36 +0100
commitae2c4bcaf0a0362e5eaba70c021e7a44a7a46b49 (patch)
treed9cb1e9798da987211a475dfc5763a6506b9909e
parentceb36fe0d634f38200dad4e18b5c74464d3a0a13 (diff)
downloadscummvm-rg350-ae2c4bcaf0a0362e5eaba70c021e7a44a7a46b49.tar.gz
scummvm-rg350-ae2c4bcaf0a0362e5eaba70c021e7a44a7a46b49.tar.bz2
scummvm-rg350-ae2c4bcaf0a0362e5eaba70c021e7a44a7a46b49.zip
DREAMWEB: Convert 'examineob'
-rw-r--r--engines/dreamweb/object.cpp130
-rw-r--r--engines/dreamweb/stubs.h2
2 files changed, 63 insertions, 69 deletions
diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp
index a1d6e1da7c..1c58559dcd 100644
--- a/engines/dreamweb/object.cpp
+++ b/engines/dreamweb/object.cpp
@@ -110,77 +110,71 @@ void DreamGenContext::obicons() {
}
}
-void DreamGenContext::examineob() {
- STACK_CHECK;
+void DreamGenContext::examineob(bool examineAgain) {
data.byte(kPointermode) = 0;
data.word(kTimecount) = 0;
-examineagain:
- data.byte(kInmaparea) = 0;
- data.byte(kExamagain) = 0;
- data.byte(kOpenedob) = 255;
- data.byte(kOpenedtype) = 255;
- data.byte(kInvopen) = 0;
- al = data.byte(kCommandtype);
- data.byte(kObjecttype) = al;
- data.byte(kItemframe) = 0;
- data.byte(kPointerframe) = 0;
- createpanel();
- showpanel();
- showman();
- showexit();
- obicons();
- obpicture();
- describeob();
- undertextline();
- data.byte(kCommandtype) = 255;
- readmouse();
- showpointer();
- worktoscreen();
- delpointer();
-waitexam:
- readmouse();
- showpointer();
- vsync();
- dumppointer();
- dumptextline();
- delpointer();
- data.byte(kGetback) = 0;
- bx = offset_examlist;
- _cmp(data.byte(kInvopen), 0);
- if (flags.z())
- goto notuseinv;
- bx = offset_invlist1;
- _cmp(data.byte(kInvopen), 1);
- if (flags.z())
- goto notuseinv;
- bx = offset_withlist1;
-notuseinv:
- checkcoords();
- _cmp(data.byte(kQuitrequested), 0);
- if (!flags.z())
- goto stopwaiting;
- _cmp(data.byte(kExamagain), 0);
- if (flags.z())
- goto norex;
- goto examineagain;
-norex:
- _cmp(data.byte(kGetback), 0);
- if (flags.z())
- goto waitexam;
-stopwaiting:
+ while (true) {
+ if (examineAgain) {
+ data.byte(kInmaparea) = 0;
+ data.byte(kExamagain) = 0;
+ data.byte(kOpenedob) = 255;
+ data.byte(kOpenedtype) = 255;
+ data.byte(kInvopen) = 0;
+ al = data.byte(kCommandtype);
+ data.byte(kObjecttype) = al;
+ data.byte(kItemframe) = 0;
+ data.byte(kPointerframe) = 0;
+ createpanel();
+ showpanel();
+ showman();
+ showexit();
+ obicons();
+ obpicture();
+ describeob();
+ undertextline();
+ data.byte(kCommandtype) = 255;
+ readmouse();
+ showpointer();
+ worktoscreen();
+ delpointer();
+ examineAgain = false;
+ }
+
+ readmouse();
+ showpointer();
+ vsync();
+ dumppointer();
+ dumptextline();
+ delpointer();
+ data.byte(kGetback) = 0;
+ switch (data.byte(kInvopen)) {
+ case 0:
+ bx = offset_examlist;
+ checkcoords();
+ break;
+ case 1:
+ bx = offset_invlist1;
+ checkcoords();
+ break;
+ default:
+ bx = offset_withlist1;
+ checkcoords();
+ break;
+ }
+ if (data.byte(kQuitrequested) != 0)
+ break;
+ if (data.byte(kExamagain) != 0)
+ examineAgain = true;
+ else if (data.byte(kGetback) != 0)
+ break;
+ }
+
data.byte(kPickup) = 0;
- _cmp(data.word(kWatchingtime), 0);
- if (!flags.z())
- goto iswatching;
- _cmp(data.byte(kNewlocation), 255);
- if (!flags.z())
- goto justgetback;
-iswatching:
- makemainscreen();
- data.byte(kInvopen) = 0;
- data.byte(kOpenedob) = 255;
- return;
-justgetback:
+ if (data.word(kWatchingtime) != 0 || data.byte(kNewlocation) == 255) {
+ // iswatching
+ makemainscreen();
+ }
+
data.byte(kInvopen) = 0;
data.byte(kOpenedob) = 255;
}
diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h
index 52e0e8516f..1ced8ea61a 100644
--- a/engines/dreamweb/stubs.h
+++ b/engines/dreamweb/stubs.h
@@ -249,5 +249,5 @@
void showcity();
uint16 getpersframe(uint8 index);
void convicons();
- void examineob();
+ void examineob(bool examineAgain = true);