DREAMWEB: Port 'usestereo' to C++

This commit is contained in:
Filippos Karapetis 2011-12-17 02:04:31 +02:00
parent b289533e4d
commit f9d4886e50
5 changed files with 32 additions and 63 deletions

View File

@ -869,6 +869,7 @@ generator = cpp(context, "DreamGen", blacklist = [
'useroutine',
'useshield',
'useslab',
'usestereo',
'usetempcharset',
'usetext',
'usetimedtext',

View File

@ -2736,68 +2736,6 @@ lookcolon:
goto lookcolon;
}
void DreamGenContext::useStereo() {
STACK_CHECK;
_cmp(data.byte(kLocation), 0);
if (flags.z())
goto stereook;
cx = 400;
al = 4;
showPuzText();
putBackObStuff();
return;
stereook:
_cmp(data.byte(kMapx), 11);
if (!flags.z())
goto stereonotok;
_cmp(data.byte(kMapy), 0);
if (flags.z())
goto stereook2;
stereonotok:
cx = 400;
al = 5;
showPuzText();
putBackObStuff();
return;
stereook2:
al = 'C';
ah = 'D';
cl = 'P';
ch = 'L';
findSetObject();
ah = 1;
checkInside();
_cmp(cl, (114));
if (!flags.z())
goto cdinside;
al = 6;
cx = 400;
showPuzText();
putBackObStuff();
getAnyAd();
al = 255;
es.byte(bx+10) = al;
return;
cdinside:
getAnyAd();
al = es.byte(bx+10);
_xor(al, 1);
es.byte(bx+10) = al;
_cmp(al, 255);
if (flags.z())
goto stereoon;
al = 7;
cx = 400;
showPuzText();
putBackObStuff();
return;
stereoon:
al = 8;
cx = 400;
showPuzText();
putBackObStuff();
}
void DreamGenContext::selectOb() {
STACK_CHECK;
findInvPos();

View File

@ -518,7 +518,6 @@ public:
void getEitherAd();
void setPickup();
void dropObject();
void useStereo();
void showDiaryKeys();
void useOpened();
void signOn();

View File

@ -395,6 +395,7 @@
void identifyOb();
void showSlots();
void useCashCard();
void useStereo();
void checkInside();
uint16 checkInside(uint16 command, uint16 type);

View File

@ -1634,4 +1634,34 @@ void DreamGenContext::useCashCard() {
putBackObStuff();
}
void DreamGenContext::useStereo() {
if (data.byte(kLocation) != 0) {
showPuzText(4, 400);
putBackObStuff();
} else if (data.byte(kMapx) != 11) {
showPuzText(5, 400);
putBackObStuff();
} else if (checkInside(findSetObject("CDPL"), 1) == kNumexobjects) {
// No CD inside
showPuzText(6, 400);
putBackObStuff();
// TODO: Use the C++ version of getAnyAd()
getAnyAd();
es.byte(bx + 10) = 255;
} else {
// CD inside
getAnyAd();
es.byte(bx + 10) ^= 1;
if (es.byte(bx + 10) != 255) {
// Stereo off
showPuzText(7, 400);
} else {
// Stereo on
showPuzText(8, 400);
}
putBackObStuff();
}
}
} // End of namespace DreamGen