Skip to content

Commit

Permalink
DREAMWEB: 'madmantext' ported to C++
Browse files Browse the repository at this point in the history
There is a debatable hack to accomodate the two different builds of the game, cd or not.
  • Loading branch information
tramboi committed Aug 15, 2011
1 parent 9d8e5c0 commit 3971a0d
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 22 deletions.
1 change: 1 addition & 0 deletions devtools/tasmrecover/tasm-recover
Expand Up @@ -112,6 +112,7 @@ generator = cpp(context, "DreamGen", blacklist = [
'commandwithob',
'showpanel',
'updatepeople',
'madmantext',
], skip_output = [
# These functions are processed but not output
'dreamweb',
Expand Down
20 changes: 0 additions & 20 deletions engines/dreamweb/dreamgen.cpp
Expand Up @@ -1772,25 +1772,6 @@ void DreamGenContext::madman() {
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;
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions engines/dreamweb/dreamgen.h
Expand Up @@ -655,7 +655,6 @@ class DreamGenContext : public Context {
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;
Expand Down Expand Up @@ -1802,7 +1801,7 @@ class DreamGenContext : public Context {
void dmaend();
//void quickquit2();
void twodigitnum();
void madmantext();
//void madmantext();
void dumpcurrent();
void textforend();
void showdiarykeys();
Expand Down
24 changes: 24 additions & 0 deletions engines/dreamweb/sprite.cpp
Expand Up @@ -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 */

2 changes: 2 additions & 0 deletions engines/dreamweb/stubs.h
Expand Up @@ -128,4 +128,6 @@
void commandwithob(uint8 command, uint8 type, uint8 index);
void showpanel();
void updatepeople();
void madmantext();


2 comments on commit 3971a0d

@tramboi
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes Beckett's speech on my machine with my version with the current moon in the sky and so on :)
This is 'a priori' better than before but I'm not that sure about my test.
The game continues to the buggy end sequence...

@tramboi
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...which is probably buggy because of the same problem with two different Monkspeaking definitions depending on cd compile-time flag.

Please sign in to comment.