aboutsummaryrefslogtreecommitdiff
path: root/engines/dreamweb
diff options
context:
space:
mode:
authorBertrand Augereau2011-08-23 10:40:52 +0200
committerBertrand Augereau2011-08-23 13:22:15 +0200
commitf6670e9f1f0f86103e77293f14562ee2c93ecc40 (patch)
tree22cd47e4e1c4aa04df88336d621473c73504b22e /engines/dreamweb
parente04761549d1c4e02be306a2862cbcd6712f24a40 (diff)
downloadscummvm-rg350-f6670e9f1f0f86103e77293f14562ee2c93ecc40.tar.gz
scummvm-rg350-f6670e9f1f0f86103e77293f14562ee2c93ecc40.tar.bz2
scummvm-rg350-f6670e9f1f0f86103e77293f14562ee2c93ecc40.zip
DREAMWEB: 'walkandexamine' ported to C++
Diffstat (limited to 'engines/dreamweb')
-rw-r--r--engines/dreamweb/dreamgen.cpp85
-rw-r--r--engines/dreamweb/dreamgen.h7
-rw-r--r--engines/dreamweb/stubs.cpp10
-rw-r--r--engines/dreamweb/stubs.h1
4 files changed, 15 insertions, 88 deletions
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp
index 288a7a5ae8..596fbf154f 100644
--- a/engines/dreamweb/dreamgen.cpp
+++ b/engines/dreamweb/dreamgen.cpp
@@ -15109,88 +15109,6 @@ notzeronum:
ch = 1;
}
-void DreamGenContext::walkandexamine() {
- STACK_CHECK;
- finishedwalking();
- if (!flags.z())
- return /* (noobselect) */;
- al = data.byte(kWalkexamtype);
- data.byte(kCommandtype) = al;
- al = data.byte(kWalkexamnum);
- data.byte(kCommand) = al;
- data.byte(kWalkandexam) = 0;
- _cmp(data.byte(kCommandtype), 5);
- if (flags.z())
- return /* (noobselect) */;
- examineob();
- return;
-wantstowalk:
- setwalk();
- data.byte(kReasseschanges) = 1;
- return;
-diff:
- data.byte(kCommand) = al;
- data.byte(kCommandtype) = ah;
- _cmp(data.byte(kLinepointer), 254);
- if (!flags.z())
- goto middleofwalk;
- _cmp(data.word(kWatchingtime), 0);
- if (!flags.z())
- goto middleofwalk;
- al = data.byte(kFacing);
- _cmp(al, data.byte(kTurntoface));
- if (!flags.z())
- goto middleofwalk;
- _cmp(data.byte(kCommandtype), 3);
- if (!flags.z())
- goto notblock;
- bl = data.byte(kManspath);
- _cmp(bl, data.byte(kPointerspath));
- if (!flags.z())
- goto dontcheck;
- cl = data.byte(kRyanx);
- _add(cl, 12);
- ch = data.byte(kRyany);
- _add(ch, 12);
- checkone();
- _cmp(cl, 2);
- if (flags.c())
- goto isblock;
-dontcheck:
- getflagunderp();
- _cmp(data.byte(kLastflag), 2);
- if (flags.c())
- goto isblock;
- _cmp(data.byte(kLastflag), 128);
- if (!flags.c())
- goto isblock;
- goto toofaraway;
-notblock:
- bl = data.byte(kManspath);
- _cmp(bl, data.byte(kPointerspath));
- if (!flags.z())
- goto toofaraway;
- _cmp(data.byte(kCommandtype), 3);
- if (flags.z())
- goto isblock;
- _cmp(data.byte(kCommandtype), 5);
- if (flags.z())
- goto isaperson;
- examineobtext();
- return;
-middleofwalk:
- blocknametext();
- return;
-isblock:
- blocknametext();
- return;
-isaperson:
- personnametext();
- return;
-toofaraway:
- walktotext();
-}
-
void DreamGenContext::mainscreen() {
STACK_CHECK;
data.byte(kInmaparea) = 0;
@@ -15803,7 +15721,7 @@ notdiffob:
goto diff;
_cmp(data.byte(kWalkandexam), 1);
if (flags.z())
- goto walkandexamine;
+ { walkandexamine(); return; };
_cmp(data.word(kMousebutton), 0);
if (flags.z())
return /* (noobselect) */;
@@ -18646,7 +18564,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) {
case addr_setkeyboardint: setkeyboardint(); break;
case addr_resetkeyboard: resetkeyboard(); break;
case addr_keyboardread: keyboardread(); break;
- case addr_walkandexamine: walkandexamine(); break;
case addr_doload: doload(); break;
case addr_generalerror: generalerror(); break;
default: ::error("invalid call to %04x dispatched", (uint16)ax);
diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h
index eb15b18840..9f2774fb9c 100644
--- a/engines/dreamweb/dreamgen.h
+++ b/engines/dreamweb/dreamgen.h
@@ -137,7 +137,6 @@ public:
static const uint16 addr_checkcoords = 0xc9d0;
static const uint16 addr_madmanrun = 0xc9cc;
static const uint16 addr_mainscreen = 0xc9c8;
- static const uint16 addr_walkandexamine = 0xcbb8;
static const uint16 addr_convnum = 0xc9c4;
static const uint16 addr_showword = 0xc9c0;
static const uint16 addr_twodigitnum = 0xc9bc;
@@ -194,7 +193,7 @@ public:
static const uint16 addr_createname = 0xc8cc;
static const uint16 addr_loadspeech = 0xc8c8;
static const uint16 addr_loadold = 0xc8c4;
- static const uint16 addr_doload = 0xcbbc;
+ static const uint16 addr_doload = 0xcbb8;
static const uint16 addr_newgame = 0xc8c0;
static const uint16 addr_showdecisions = 0xc8bc;
static const uint16 addr_decide = 0xc8b8;
@@ -210,7 +209,7 @@ public:
static const uint16 addr_oldtonames = 0xc88c;
static const uint16 addr_namestoold = 0xc888;
static const uint16 addr_error = 0xc884;
- static const uint16 addr_generalerror = 0xcbc0;
+ static const uint16 addr_generalerror = 0xcbbc;
static const uint16 addr_dosreturn = 0xc880;
static const uint16 addr_shownames = 0xc87c;
static const uint16 addr_showslots = 0xc878;
@@ -1811,7 +1810,7 @@ public:
void usetrainer();
//void allocatework();
void addtopresslist();
- void walkandexamine();
+ //void walkandexamine();
void dmaend();
//void quickquit2();
void twodigitnum();
diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp
index 7cf1a307e3..82e66ba80f 100644
--- a/engines/dreamweb/stubs.cpp
+++ b/engines/dreamweb/stubs.cpp
@@ -1177,6 +1177,16 @@ void DreamGenContext::getflagunderp(uint8 *flag, uint8 *flagEx) {
ch = data.byte(kLastflagex) = *flagEx;
}
+void DreamGenContext::walkandexamine() {
+ if (! finishedwalkingCPP())
+ return;
+ data.byte(kCommandtype) = data.byte(kWalkexamtype);
+ data.byte(kCommand) = data.byte(kWalkexamnum);
+ data.byte(kWalkandexam) = 0;
+ if (data.byte(kCommandtype) != 5)
+ examineob();
+}
+
bool DreamGenContext::isCD() {
// The original sources has two codepaths depending if the game is 'if cd' or not
// This is a hack to guess which version to use with the assumption that if we have a cd version
diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h
index 80bee35e06..036e8120bb 100644
--- a/engines/dreamweb/stubs.h
+++ b/engines/dreamweb/stubs.h
@@ -173,4 +173,5 @@
void checkone(uint8 x, uint8 y, uint8 *flag, uint8 *flagEx, uint8 *type, uint8 *flagX, uint8 *flagY);
void getflagunderp();
void getflagunderp(uint8 *flag, uint8 *flagEx);
+ void walkandexamine();