From 8b61fb168d03e045c0fec85e8ce4fbb93dd535b8 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 8 Dec 2011 22:05:32 +0200 Subject: DREAMWEB: Port 'madmanrun' to C++ --- engines/dreamweb/dreamgen.cpp | 31 ------------------------------- engines/dreamweb/dreamgen.h | 1 - engines/dreamweb/stubs.cpp | 19 +++++++++++++++++++ engines/dreamweb/stubs.h | 1 + 4 files changed, 20 insertions(+), 32 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 65d8d4a33d..b29e04b2dc 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -6600,37 +6600,6 @@ void DreamGenContext::clearChanges() { _stosw(cx, true); } -void DreamGenContext::madmanRun() { - STACK_CHECK; - _cmp(data.byte(kLocation), 14); - if (!flags.z()) - { identifyOb(); return; }; - _cmp(data.byte(kMapx), 22); - if (!flags.z()) - { identifyOb(); return; }; - _cmp(data.byte(kPointermode), 2); - if (!flags.z()) - { identifyOb(); return; }; - _cmp(data.byte(kMadmanflag), 0); - if (!flags.z()) - { identifyOb(); return; }; - _cmp(data.byte(kCommandtype), 211); - if (flags.z()) - goto alreadyrun; - data.byte(kCommandtype) = 211; - al = 52; - commandOnly(); -alreadyrun: - _cmp(data.word(kMousebutton), 1); - if (!flags.z()) - return /* (norun) */; - ax = data.word(kMousebutton); - _cmp(ax, data.word(kOldbutton)); - if (flags.z()) - return /* (norun) */; - data.byte(kLastweapon) = 8; -} - void DreamGenContext::identifyOb() { STACK_CHECK; _cmp(data.word(kWatchingtime), 0); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 5e0523d2a3..0f4dcdb01e 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -679,7 +679,6 @@ public: void clearChanges(); void searchForFiles(); void monkSpeaking(); - void madmanRun(); void getExAd(); void initialMonCols(); void useButtonA(); diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 674ea212fa..35b0ae3ac4 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -3899,4 +3899,23 @@ void DreamGenContext::afterNewRoom() { atmospheres(); } +void DreamGenContext::madmanRun() { + if (data.byte(kLocation) != 14 || + data.byte(kMapx) != 22 || + data.byte(kPointermode) != 2 || + data.byte(kMadmanflag) != 0) { + identifyOb(); + return; + } + + if (data.byte(kCommandtype) != 211) { + data.byte(kCommandtype) = 211; + commandOnly(52); + } + + if (data.word(kMousebutton) == 1 && + data.word(kMousebutton) != data.word(kOldbutton)) + data.byte(kLastweapon) = 8; +} + } // End of namespace DreamGen diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 582109f400..f4bb1ec13b 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -549,5 +549,6 @@ DreamBase::removeFreeObject(index); } void afterNewRoom(); + void madmanRun(); #endif -- cgit v1.2.3