Skip to content

Commit

Permalink
DREAMWEB: 'isitdescribed' ported to C++
Browse files Browse the repository at this point in the history
  • Loading branch information
tramboi committed Sep 2, 2011
1 parent cb410d5 commit 7eed29c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 27 deletions.
24 changes: 0 additions & 24 deletions engines/dreamweb/dreamgen.cpp
Expand Up @@ -14836,29 +14836,6 @@ void DreamGenContext::checkifset() {
goto identifyset;
}

void DreamGenContext::isitdescribed() {
STACK_CHECK;
push(ax);
push(cx);
push(es);
push(bx);
al = es.byte(bx+4);
ah = 0;
_add(ax, ax);
bx = ax;
es = data.word(kSetdesc);
_add(bx, (0));
ax = es.word(bx);
_add(ax, (0+(130*2)));
bx = ax;
dl = es.byte(bx);
bx = pop();
es = pop();
cx = pop();
ax = pop();
_cmp(dl, 0);
}

void DreamGenContext::findpathofpoint() {
STACK_CHECK;
push(ax);
Expand Down Expand Up @@ -17915,7 +17892,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) {
case addr_madmanrun: madmanrun(); break;
case addr_identifyob: identifyob(); break;
case addr_checkifset: checkifset(); break;
case addr_isitdescribed: isitdescribed(); break;
case addr_findpathofpoint: findpathofpoint(); break;
case addr_findfirstpath: findfirstpath(); break;
case addr_checkifpathison: checkifpathison(); break;
Expand Down
3 changes: 1 addition & 2 deletions engines/dreamweb/dreamgen.h
Expand Up @@ -113,7 +113,6 @@ class DreamGenContext : public Context {
static const uint16 addr_checkifpathison = 0xca04;
static const uint16 addr_findfirstpath = 0xc9f0;
static const uint16 addr_findpathofpoint = 0xc9ec;
static const uint16 addr_isitdescribed = 0xc9e8;
static const uint16 addr_checkifset = 0xc9dc;
static const uint16 addr_identifyob = 0xc9d4;
static const uint16 addr_madmanrun = 0xc9cc;
Expand Down Expand Up @@ -1463,7 +1462,7 @@ class DreamGenContext : public Context {
void candles1();
void lookininterface();
void manasleep();
void isitdescribed();
//void isitdescribed();
void hotelbell();
void loadspeech();
void interupttest();
Expand Down
11 changes: 11 additions & 0 deletions engines/dreamweb/stubs.cpp
Expand Up @@ -1737,6 +1737,17 @@ bool DreamGenContext::compare(uint8 index, uint8 flag, const char id[4]) {
return true;
}

void DreamGenContext::isitdescribed() {
ObjPos *pos = (ObjPos *)es.ptr(bx, sizeof(ObjPos));
flags._z = !isitdescribed(pos);
}

bool DreamGenContext::isitdescribed(ObjPos *pos) {
uint16 offset = segRef(data.word(kSetdesc)).word(kSettextdat + pos->index * 2);
uint8 result = segRef(data.word(kSetdesc)).byte(kSettext + offset);
return result != 0;
}

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
Expand Down
3 changes: 2 additions & 1 deletion engines/dreamweb/stubs.h
Expand Up @@ -218,5 +218,6 @@
bool compare(uint8 index, uint8 flag, const char id[4]);
void pixelcheckset();
bool pixelcheckset(ObjPos *pos, uint8 x, uint8 y);

void isitdescribed();
bool isitdescribed(ObjPos *objPos);

0 comments on commit 7eed29c

Please sign in to comment.