DREAMWEB: 'getblockofpixel' ported to C++

This commit is contained in:
Bertrand Augereau 2011-09-03 00:00:44 +02:00
parent bd4bc2215f
commit c346bf79b4
5 changed files with 18 additions and 28 deletions

View File

@ -148,6 +148,7 @@ generator = cpp(context, "DreamGen", blacklist = [
'adjustlen',
'finishedwalking',
'checkone',
'getblockofpixel',
'getflagunderp',
'walkandexamine',
'obname',

View File

@ -2385,30 +2385,6 @@ foundlineend:
goto lookforlinestart;
}
void DreamGenContext::getblockofpixel() {
STACK_CHECK;
push(cx);
push(es);
push(di);
ax = data.word(kMapxstart);
_add(cl, al);
ax = data.word(kMapystart);
_add(ch, al);
checkone();
_and(cl, 1);
if (!flags.z())
goto failrain;
di = pop();
es = pop();
cx = pop();
return;
failrain:
di = pop();
es = pop();
cx = pop();
al = 0;
}
void DreamGenContext::liftnoise() {
STACK_CHECK;
_cmp(data.byte(kReallocation), 5);
@ -16969,7 +16945,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) {
case addr_reminders: reminders(); break;
case addr_initrain: initrain(); break;
case addr_splitintolines: splitintolines(); break;
case addr_getblockofpixel: getblockofpixel(); break;
case addr_backobject: backobject(); break;
case addr_liftnoise: liftnoise(); break;
case addr_random: random(); break;

View File

@ -553,7 +553,6 @@ public:
static const uint16 addr_random = 0xc17c;
static const uint16 addr_liftnoise = 0xc178;
static const uint16 addr_backobject = 0xc170;
static const uint16 addr_getblockofpixel = 0xc168;
static const uint16 addr_splitintolines = 0xc164;
static const uint16 addr_initrain = 0xc160;
static const uint16 addr_reminders = 0xc15c;
@ -1381,7 +1380,7 @@ public:
//void updatepeople();
//void addtopeoplelist();
void hangoncurs();
void sparkydrip();
//void getblockofpixel();
//void kernchars();
void printcurs();
//void convertkey();
@ -1629,7 +1628,7 @@ public:
void madmanstelly();
void constant();
void loadroomssample();
void getblockofpixel();
void sparkydrip();
void paltostartpal();
void bossman();
void getridofpit();

View File

@ -876,6 +876,19 @@ void DreamGenContext::checkone(uint8 x, uint8 y, uint8 *flag, uint8 *flagEx, uin
*type = tileData[2];
}
void DreamGenContext::getblockofpixel() {
al = getblockofpixel(cl, ch);
}
uint8 DreamGenContext::getblockofpixel(uint8 x, uint8 y) {
uint8 flag, flagEx, type, flagX, flagY;
checkone(x + data.word(kMapxstart), y + data.word(kMapystart), &flag, &flagEx, &type, &flagX, &flagY);
if (flag & 1)
return 0;
else
return type;
}
void DreamGenContext::addtopeoplelist() {
addtopeoplelist((ReelRoutine *)es.ptr(bx, sizeof(ReelRoutine)));
}

View File

@ -241,4 +241,6 @@
uint8 *getobtextstartCPP();
void usetext(const uint8 *string);
void usetext();
void getblockofpixel();
uint8 getblockofpixel(uint8 x, uint8 y);