DREAMWEB: Port 'useaxe', 'usekey' to C++

This commit is contained in:
Filippos Karapetis 2011-12-13 00:11:05 +02:00
parent 9480b21840
commit 90c1793d47
5 changed files with 67 additions and 85 deletions

View File

@ -772,6 +772,7 @@ generator = cpp(context, "DreamGen", blacklist = [
'twodigitnum',
'undertextline',
'updatepeople',
'useaxe',
'usebalcony',
'usebuttona',
'usecardreader1',
@ -795,6 +796,7 @@ generator = cpp(context, "DreamGen", blacklist = [
'useelvdoor',
'usefullcart',
'usehole',
'usekey',
'useladder',
'useladderb',
'uselighter',

View File

@ -3830,58 +3830,6 @@ havecutwire:
data.byte(kGetback) = 1;
}
void DreamGenContext::useKey() {
STACK_CHECK;
_cmp(data.byte(kLocation), 5);
if (flags.z())
goto usekey1;
_cmp(data.byte(kLocation), 30);
if (flags.z())
goto usekey1;
_cmp(data.byte(kLocation), 21);
if (flags.z())
goto usekey2;
cx = 200;
al = 1;
showPuzText();
putBackObStuff();
return;
usekey1:
_cmp(data.byte(kMapx), 22);
if (!flags.z())
goto wrongroom1;
_cmp(data.byte(kMapy), 10);
if (!flags.z())
goto wrongroom1;
cx = 300;
al = 0;
showPuzText();
data.byte(kCounttoclose) = 100;
data.byte(kGetback) = 1;
return;
usekey2:
_cmp(data.byte(kMapx), 11);
if (!flags.z())
goto wrongroom1;
_cmp(data.byte(kMapy), 10);
if (!flags.z())
goto wrongroom1;
cx = 300;
al = 3;
showPuzText();
data.byte(kNewlocation) = 30;
al = 2;
fadeScreenDown();
showFirstUse();
putBackObStuff();
return;
wrongroom1:
cx = 200;
al = 2;
showPuzText();
putBackObStuff();
}
void DreamGenContext::useStereo() {
STACK_CHECK;
_cmp(data.byte(kLocation), 0);
@ -3944,37 +3892,6 @@ stereoon:
putBackObStuff();
}
void DreamGenContext::useAxe() {
STACK_CHECK;
_cmp(data.byte(kReallocation), 22);
if (!flags.z())
goto notinpool;
_cmp(data.byte(kMapy), 10);
if (flags.z())
goto axeondoor;
showSecondUse();
_inc(data.byte(kProgresspoints));
data.byte(kLastweapon) = 2;
data.byte(kGetback) = 1;
removeObFromInv();
return;
notinpool:
showFirstUse();
return;
/*continuing to unbounded code: axeondoor from useelvdoor:19-30*/
axeondoor:
al = 15;
cx = 300;
showPuzText();
_inc(data.byte(kProgresspoints));
data.word(kWatchingtime) = 46*2;
data.word(kReeltowatch) = 31;
data.word(kEndwatchreel) = 77;
data.byte(kWatchspeed) = 1;
data.byte(kSpeedcount) = 1;
data.byte(kGetback) = 1;
}
void DreamGenContext::withWhat() {
STACK_CHECK;
createPanel();

View File

@ -521,7 +521,6 @@ public:
void getFreeAd();
void removeObFromInv();
void heavy();
void useKey();
void dirFile();
void pickupConts();
void nextColon();
@ -549,7 +548,6 @@ public:
void rollEm();
void poolGuard();
void lookAtPlace();
void useAxe();
void findAllOpen();
void fillOpen();
void findSetObject();

View File

@ -334,6 +334,8 @@
void useSLab();
void usePipe();
void useOpenBox();
void useAxe();
void useKey();
void wheelSound();
void callHotelLift();
void useShield();

View File

@ -1376,4 +1376,67 @@ void DreamGenContext::useOpenBox() {
showFirstUse();
}
void DreamGenContext::useAxe() {
if (data.byte(kReallocation) != 22) {
// Not in pool
showFirstUse();
return;
}
if (data.byte(kMapy) == 10) {
// Axe on door
al = 15;
cx = 300;
showPuzText(15, 300);
data.byte(kProgresspoints)++;
data.word(kWatchingtime) = 46*2;
data.word(kReeltowatch) = 31;
data.word(kEndwatchreel) = 77;
data.byte(kWatchspeed) = 1;
data.byte(kSpeedcount) = 1;
data.byte(kGetback) = 1;
return;
}
showSecondUse();
data.byte(kProgresspoints)++;
data.byte(kLastweapon) = 2;
data.byte(kGetback) = 1;
removeObFromInv();
}
void DreamGenContext::useKey() {
switch(data.byte(kLocation)) {
case 5:
case 30:
if (data.byte(kMapx) == 22 && data.byte(kMapy) == 10) {
showPuzText(0, 300);
data.byte(kCounttoclose) = 100;
data.byte(kGetback) = 1;
} else {
// Wrong room
showPuzText(2, 200);
putBackObStuff();
}
break;
case 21:
if (data.byte(kMapx) == 11 && data.byte(kMapy) == 10) {
showPuzText(3, 300);
data.byte(kNewlocation) = 30;
al = 2;
fadeScreenDown();
showFirstUse();
putBackObStuff();
} else {
// Wrong room
showPuzText(2, 200);
putBackObStuff();
}
default:
showPuzText(1, 200);
putBackObStuff();
break;
}
}
} // End of namespace DreamGen