aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorBertrand Augereau2011-08-16 01:25:59 +0200
committerBertrand Augereau2011-08-16 01:25:59 +0200
commit3971a0dbf51b52df0762e43cc90b214978484c1e (patch)
treef3282d8362d6a3a0f09dfac91d32bf2e040c0223 /engines
parent9d8e5c0df49a6a6d52f71c31f3ab0b406ad84ede (diff)
downloadscummvm-rg350-3971a0dbf51b52df0762e43cc90b214978484c1e.tar.gz
scummvm-rg350-3971a0dbf51b52df0762e43cc90b214978484c1e.tar.bz2
scummvm-rg350-3971a0dbf51b52df0762e43cc90b214978484c1e.zip
DREAMWEB: 'madmantext' ported to C++
There is a debatable hack to accomodate the two different builds of the game, cd or not.
Diffstat (limited to 'engines')
-rw-r--r--engines/dreamweb/dreamgen.cpp20
-rw-r--r--engines/dreamweb/dreamgen.h3
-rw-r--r--engines/dreamweb/sprite.cpp24
-rw-r--r--engines/dreamweb/stubs.h2
4 files changed, 27 insertions, 22 deletions
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp
index 8c3719b6d6..9306acda49 100644
--- a/engines/dreamweb/dreamgen.cpp
+++ b/engines/dreamweb/dreamgen.cpp
@@ -1772,25 +1772,6 @@ ryansded:
showgamereel();
}
-void DreamGenContext::madmantext() {
- STACK_CHECK;
- _cmp(data.byte(kSpeechcount), 63);
- if (!flags.c())
- return /* (nomadtext) */;
- _cmp(data.byte(kCh1playing), 255);
- if (!flags.z())
- return /* (nomadtext) */;
- al = data.byte(kSpeechcount);
- _inc(data.byte(kSpeechcount));
- _add(al, 47);
- bl = 72;
- bh = 80;
- cx = 90;
- dx = 1;
- ah = 82;
- setuptimedtemp();
-}
-
void DreamGenContext::madmode() {
STACK_CHECK;
data.word(kWatchingtime) = 2;
@@ -19166,7 +19147,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) {
case addr_priest: priest(); break;
case addr_madmanstelly: madmanstelly(); break;
case addr_madman: madman(); break;
- case addr_madmantext: madmantext(); break;
case addr_madmode: madmode(); break;
case addr_priesttext: priesttext(); break;
case addr_textforend: textforend(); break;
diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h
index 851c87d00c..be3c1221f6 100644
--- a/engines/dreamweb/dreamgen.h
+++ b/engines/dreamweb/dreamgen.h
@@ -655,7 +655,6 @@ public:
static const uint16 addr_textforend = 0xc0ec;
static const uint16 addr_priesttext = 0xc0e8;
static const uint16 addr_madmode = 0xc0e4;
- static const uint16 addr_madmantext = 0xc0e0;
static const uint16 addr_madman = 0xc0dc;
static const uint16 addr_madmanstelly = 0xc0d8;
static const uint16 addr_priest = 0xc0d4;
@@ -1802,7 +1801,7 @@ public:
void dmaend();
//void quickquit2();
void twodigitnum();
- void madmantext();
+ //void madmantext();
void dumpcurrent();
void textforend();
void showdiarykeys();
diff --git a/engines/dreamweb/sprite.cpp b/engines/dreamweb/sprite.cpp
index 59ca0cbc0b..da9d8c96f4 100644
--- a/engines/dreamweb/sprite.cpp
+++ b/engines/dreamweb/sprite.cpp
@@ -764,5 +764,29 @@ void DreamGenContext::updatepeople() {
}
}
+void DreamGenContext::madmantext() {
+ // 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
+ // we managed to load the speech.
+ if (data.byte(kSpeechloaded)) {
+ if (data.byte(kSpeechcount) >= 63)
+ return;
+ _cmp(data.byte(kCh1playing), 255);
+ if (!flags.z())
+ return /* (nomadtext) */;
+ al = data.byte(kSpeechcount);
+ ++data.byte(kSpeechcount);
+ } else {
+ if (data.byte(kCombatcount) >= 61)
+ return;
+ al = data.byte(kCombatcount);
+ _and(al, 3);
+ if (!flags.z())
+ return /* (nomadtext) */;
+ al = data.byte(kCombatcount) / 4;
+ }
+ setuptimedtemp(47 + al, 82, 72, 80, 90, 1);
+}
+
} /*namespace dreamgen */
diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h
index 94580b3a68..5b8839fad9 100644
--- a/engines/dreamweb/stubs.h
+++ b/engines/dreamweb/stubs.h
@@ -128,4 +128,6 @@
void commandwithob(uint8 command, uint8 type, uint8 index);
void showpanel();
void updatepeople();
+ void madmantext();
+