DREAMWEB: Port 'isryanholding' to C++

This commit is contained in:
Filippos Karapetis 2011-12-16 22:04:47 +02:00
parent 70fd1b6043
commit 12cac260c9
6 changed files with 24 additions and 46 deletions

View file

@ -500,6 +500,7 @@ generator = cpp(context, "DreamGen", blacklist = [
'isitdescribed',
'isitright',
'isitworn',
'isryanholding',
'issetobonmap',
'keeper',
'kernchars',

View file

@ -2937,44 +2937,6 @@ doselob:
useRoutine();
}
void DreamGenContext::isRyanHolding() {
STACK_CHECK;
_sub(al, 'A');
_sub(ah, 'A');
_sub(cl, 'A');
_sub(ch, 'A');
es = data.word(kExtras);
bx = (0+2080+30000);
dl = 0;
searchinv:
_cmp(es.byte(bx+2), 4);
if (!flags.z())
goto nofindininv;
_cmp(al, es.byte(bx+12));
if (!flags.z())
goto nofindininv;
_cmp(ah, es.byte(bx+13));
if (!flags.z())
goto nofindininv;
_cmp(cl, es.byte(bx+14));
if (!flags.z())
goto nofindininv;
_cmp(ch, es.byte(bx+15));
if (!flags.z())
goto nofindininv;
al = dl;
_cmp(al, (114));
return;
nofindininv:
_add(bx, 16);
_inc(dl);
_cmp(dl, (114));
if (!flags.z())
goto searchinv;
al = dl;
_cmp(al, (114));
}
void DreamGenContext::checkInside() {
STACK_CHECK;
es = data.word(kExtras);

View file

@ -480,7 +480,6 @@ public:
void clearBuffers();
void getObTextStart();
void checkObjectSize();
void isRyanHolding();
void fillOpen();
void useCashCard();
void moneyPoke();

View file

@ -1774,6 +1774,26 @@ uint16 DreamGenContext::findExObject(const char *id) {
return kNumexobjects;
}
void DreamGenContext::isRyanHolding() {
char id[5];
id[0] = al;
id[1] = ah;
id[2] = cl;
id[3] = ch;
id[4] = '\0';
flags._z = isRyanHolding(id);
}
bool DreamGenContext::isRyanHolding(const char *id) {
for (uint16 index = 0; index < kNumexobjects; index++) {
DynObject *object = getExAd(index);
if (object->mapad[0] == 4 && objectMatches(object, id))
return (index == kNumexobjects);
}
return false;
}
bool DreamBase::isItDescribed(const ObjPos *pos) {
uint16 offset = getSegment(data.word(kSetdesc)).word(kSettextdat + pos->index * 2);
uint8 result = getSegment(data.word(kSetdesc)).byte(kSettext + offset);

View file

@ -383,6 +383,8 @@
uint16 findSetObject(const char *id);
void findExObject();
uint16 findExObject(const char *id);
void isRyanHolding();
bool isRyanHolding(const char *id);
void describeOb();
void getOpenedSize();
byte getOpenedSizeCPP();

View file

@ -625,13 +625,7 @@ void DreamGenContext::sLabDoorB() {
data.byte(kWatchspeed) = 1;
data.byte(kSpeedcount) = 1;
} else {
al = 'S';
ah = 'H';
cl = 'L';
ch = 'D';
isRyanHolding();
if (flags.z()) {
if (isRyanHolding("SHLD")) {
// No crystal
showPuzText(44, 200);
putBackObStuff();