DREAMWEB: 'dealwithspecial' ported to C++

This commit is contained in:
Bertrand Augereau 2011-07-30 23:21:43 +02:00
parent 5d13e2f837
commit 7c40d798de
5 changed files with 35 additions and 61 deletions

View File

@ -85,6 +85,7 @@ generator = cpp(context, "DreamGen", blacklist = [
'cancelch1',
'getroomspaths',
'makebackob',
'dealwithspecial',
'facerightway',
], skip_output = [
# These functions are processed but not output

View File

@ -2923,64 +2923,6 @@ notfudge:
data.byte(kHavedoneobs) = 0;
}
void DreamGenContext::dealwithspecial() {
STACK_CHECK;
_sub(al, 220);
_cmp(al, 0);
if (!flags.z())
goto notplset;
al = ah;
placesetobject();
data.byte(kHavedoneobs) = 1;
return;
notplset:
_cmp(al, 1);
if (!flags.z())
goto notremset;
al = ah;
removesetobject();
data.byte(kHavedoneobs) = 1;
return;
notremset:
_cmp(al, 2);
if (!flags.z())
goto notplfree;
al = ah;
placefreeobject();
data.byte(kHavedoneobs) = 1;
return;
notplfree:
_cmp(al, 3);
if (!flags.z())
goto notremfree;
al = ah;
removefreeobject();
data.byte(kHavedoneobs) = 1;
return;
notremfree:
_cmp(al, 4);
if (!flags.z())
goto notryanoff;
switchryanoff();
return;
notryanoff:
_cmp(al, 5);
if (!flags.z())
goto notryanon;
data.byte(kTurntoface) = ah;
data.byte(kFacing) = ah;
switchryanon();
return;
notryanon:
_cmp(al, 6);
if (!flags.z())
goto notchangeloc;
data.byte(kNewlocation) = ah;
return;
notchangeloc:
movemap();
}
void DreamGenContext::movemap() {
STACK_CHECK;
_cmp(ah, 32);
@ -20320,7 +20262,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) {
case addr_plotreel: plotreel(); break;
case addr_soundonreels: soundonreels(); break;
case addr_reconstruct: reconstruct(); break;
case addr_dealwithspecial: dealwithspecial(); break;
case addr_movemap: movemap(); break;
case addr_getreelstart: getreelstart(); break;
case addr_deleverything: deleverything(); break;

View File

@ -642,7 +642,6 @@ public:
static const uint16 addr_deleverything = 0xc1c0;
static const uint16 addr_getreelstart = 0xc1b8;
static const uint16 addr_movemap = 0xc1b4;
static const uint16 addr_dealwithspecial = 0xc1b0;
static const uint16 addr_reconstruct = 0xc1ac;
static const uint16 addr_soundonreels = 0xc1a8;
static const uint16 addr_plotreel = 0xc1a4;
@ -1449,7 +1448,7 @@ public:
void printcurs();
//void convertkey();
void outofopen();
void dealwithspecial();
//void dealwithspecial();
//void eraseoldobs();
void dircom();
//void liftsprite();

View File

@ -802,5 +802,36 @@ void DreamGenContext::fillspace() {
memset(ds.ptr(dx, cx), al, cx);
}
void DreamGenContext::dealwithspecial() {
uint8 type = al - 220;
if (type == 0) {
al = ah;
placesetobject();
data.byte(kHavedoneobs) = 1;
} else if (type == 1) {
al = ah;
removesetobject();
data.byte(kHavedoneobs) = 1;
} else if (type == 2) {
al = ah;
placefreeobject();
data.byte(kHavedoneobs) = 1;
} else if (type == 3) {
al = ah;
removefreeobject();
data.byte(kHavedoneobs) = 1;
} else if (type == 4) {
switchryanoff();
} else if (type == 5) {
data.byte(kTurntoface) = ah;
data.byte(kFacing) = ah;
switchryanon();
} else if (type == 6) {
data.byte(kNewlocation) = ah;
} else {
movemap();
}
}
} /*namespace dreamgen */

View File

@ -106,3 +106,5 @@
void lockmon();
void cancelch0();
void cancelch1();
void dealwithspecial();