DREAMWEB: 'checkifperson' ported to C++
This commit is contained in:
parent
01ccadf7c1
commit
e78a5a2b08
7 changed files with 62 additions and 79 deletions
|
@ -105,6 +105,7 @@ generator = cpp(context, "DreamGen", blacklist = [
|
||||||
'parseblaster',
|
'parseblaster',
|
||||||
'deltextline',
|
'deltextline',
|
||||||
'doblocks',
|
'doblocks',
|
||||||
|
'checkifperson',
|
||||||
], skip_output = [
|
], skip_output = [
|
||||||
# These functions are processed but not output
|
# These functions are processed but not output
|
||||||
'dreamweb',
|
'dreamweb',
|
||||||
|
|
|
@ -16339,69 +16339,6 @@ nothingund:
|
||||||
blank();
|
blank();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DreamGenContext::checkifperson() {
|
|
||||||
STACK_CHECK;
|
|
||||||
es = data.word(kBuffers);
|
|
||||||
bx = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5));
|
|
||||||
cx = 12;
|
|
||||||
identifyreel:
|
|
||||||
push(cx);
|
|
||||||
_cmp(es.byte(bx+4), 255);
|
|
||||||
if (flags.z())
|
|
||||||
goto notareelid;
|
|
||||||
push(es);
|
|
||||||
push(bx);
|
|
||||||
push(ax);
|
|
||||||
ax = es.word(bx+0);
|
|
||||||
data.word(kReelpointer) = ax;
|
|
||||||
getreelstart();
|
|
||||||
_cmp(es.word(si+2), 0x0ffff);
|
|
||||||
if (!flags.z())
|
|
||||||
goto notblankpers;
|
|
||||||
_add(si, 5);
|
|
||||||
notblankpers:
|
|
||||||
cx = es.word(si+2);
|
|
||||||
ax = es.word(si+0);
|
|
||||||
push(cx);
|
|
||||||
getreelframeax();
|
|
||||||
cx = pop();
|
|
||||||
_add(cl, es.byte(bx+4));
|
|
||||||
_add(ch, es.byte(bx+5));
|
|
||||||
dx = cx;
|
|
||||||
_add(dl, es.byte(bx+0));
|
|
||||||
_add(dh, es.byte(bx+1));
|
|
||||||
ax = pop();
|
|
||||||
bx = pop();
|
|
||||||
es = pop();
|
|
||||||
_cmp(al, cl);
|
|
||||||
if (flags.c())
|
|
||||||
goto notareelid;
|
|
||||||
_cmp(ah, ch);
|
|
||||||
if (flags.c())
|
|
||||||
goto notareelid;
|
|
||||||
_cmp(al, dl);
|
|
||||||
if (!flags.c())
|
|
||||||
goto notareelid;
|
|
||||||
_cmp(ah, dh);
|
|
||||||
if (!flags.c())
|
|
||||||
goto notareelid;
|
|
||||||
cx = pop();
|
|
||||||
ax = es.word(bx+2);
|
|
||||||
data.word(kPersondata) = ax;
|
|
||||||
al = es.byte(bx+4);
|
|
||||||
ah = 5;
|
|
||||||
obname();
|
|
||||||
al = 0;
|
|
||||||
_cmp(al, 1);
|
|
||||||
return;
|
|
||||||
notareelid:
|
|
||||||
cx = pop();
|
|
||||||
_add(bx, 5);
|
|
||||||
_dec(cx);
|
|
||||||
if (!flags.z())
|
|
||||||
goto identifyreel;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DreamGenContext::checkifset() {
|
void DreamGenContext::checkifset() {
|
||||||
STACK_CHECK;
|
STACK_CHECK;
|
||||||
es = data.word(kBuffers);
|
es = data.word(kBuffers);
|
||||||
|
@ -19949,7 +19886,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) {
|
||||||
case addr_madmanrun: madmanrun(); break;
|
case addr_madmanrun: madmanrun(); break;
|
||||||
case addr_checkcoords: checkcoords(); break;
|
case addr_checkcoords: checkcoords(); break;
|
||||||
case addr_identifyob: identifyob(); break;
|
case addr_identifyob: identifyob(); break;
|
||||||
case addr_checkifperson: checkifperson(); break;
|
|
||||||
case addr_checkifset: checkifset(); break;
|
case addr_checkifset: checkifset(); break;
|
||||||
case addr_checkifex: checkifex(); break;
|
case addr_checkifex: checkifex(); break;
|
||||||
case addr_checkiffree: checkiffree(); break;
|
case addr_checkiffree: checkiffree(); break;
|
||||||
|
|
|
@ -146,7 +146,6 @@ public:
|
||||||
static const uint16 addr_checkiffree = 0xc9e4;
|
static const uint16 addr_checkiffree = 0xc9e4;
|
||||||
static const uint16 addr_checkifex = 0xc9e0;
|
static const uint16 addr_checkifex = 0xc9e0;
|
||||||
static const uint16 addr_checkifset = 0xc9dc;
|
static const uint16 addr_checkifset = 0xc9dc;
|
||||||
static const uint16 addr_checkifperson = 0xc9d8;
|
|
||||||
static const uint16 addr_identifyob = 0xc9d4;
|
static const uint16 addr_identifyob = 0xc9d4;
|
||||||
static const uint16 addr_checkcoords = 0xc9d0;
|
static const uint16 addr_checkcoords = 0xc9d0;
|
||||||
static const uint16 addr_madmanrun = 0xc9cc;
|
static const uint16 addr_madmanrun = 0xc9cc;
|
||||||
|
@ -1362,7 +1361,7 @@ public:
|
||||||
void clearendpal();
|
void clearendpal();
|
||||||
void findtext1();
|
void findtext1();
|
||||||
void isryanholding();
|
void isryanholding();
|
||||||
void interupttest();
|
void showslots();
|
||||||
void usecashcard();
|
void usecashcard();
|
||||||
void usewall();
|
void usewall();
|
||||||
void opentomb();
|
void opentomb();
|
||||||
|
@ -1494,9 +1493,10 @@ public:
|
||||||
void isitdescribed();
|
void isitdescribed();
|
||||||
void hotelbell();
|
void hotelbell();
|
||||||
void loadspeech();
|
void loadspeech();
|
||||||
|
void interupttest();
|
||||||
//void cls();
|
//void cls();
|
||||||
//void printsprites();
|
//void printsprites();
|
||||||
//void dumptimedtext();
|
//void checkifperson();
|
||||||
void showallobs();
|
void showallobs();
|
||||||
//void getnumber();
|
//void getnumber();
|
||||||
void adjustleft();
|
void adjustleft();
|
||||||
|
@ -1564,7 +1564,7 @@ public:
|
||||||
void folderhints();
|
void folderhints();
|
||||||
void openhoteldoor();
|
void openhoteldoor();
|
||||||
void removesetobject();
|
void removesetobject();
|
||||||
void checkifperson();
|
//void dumptimedtext();
|
||||||
//void frameoutfx();
|
//void frameoutfx();
|
||||||
void blank();
|
void blank();
|
||||||
void drinker();
|
void drinker();
|
||||||
|
@ -1749,10 +1749,9 @@ public:
|
||||||
void loadintotemp2();
|
void loadintotemp2();
|
||||||
void gamer();
|
void gamer();
|
||||||
void personnametext();
|
void personnametext();
|
||||||
void quitsymbol();
|
|
||||||
void readfromfile();
|
void readfromfile();
|
||||||
void initialinv();
|
void initialinv();
|
||||||
void showslots();
|
void quitsymbol();
|
||||||
//void modifychar();
|
//void modifychar();
|
||||||
void hangon();
|
void hangon();
|
||||||
void settopright();
|
void settopright();
|
||||||
|
|
|
@ -570,14 +570,10 @@ void DreamGenContext::showgamereel() {
|
||||||
es.word(bx+3) = data.word(kReelpointer);
|
es.word(bx+3) = data.word(kReelpointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DreamGenContext::getreelframeax() {
|
const Frame *DreamGenContext::getreelframeax(uint16 frame) {
|
||||||
push(ds);
|
data.word(kCurrentframe) = frame;
|
||||||
data.word(kCurrentframe) = ax;
|
uint16 offset = data.word(kCurrentframe) - data.word(kTakeoff);
|
||||||
findsource();
|
return findsourceCPP() + offset;
|
||||||
es = ds;
|
|
||||||
ds = pop();
|
|
||||||
cx = (data.word(kCurrentframe) - data.word(kTakeoff)) * 2;
|
|
||||||
bx = (data.word(kCurrentframe) - data.word(kTakeoff)) * 6;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DreamGenContext::showrain() {
|
void DreamGenContext::showrain() {
|
||||||
|
|
|
@ -96,6 +96,19 @@ struct Reel {
|
||||||
uint8 b4;
|
uint8 b4;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct People {
|
||||||
|
uint8 b0;
|
||||||
|
uint8 b1;
|
||||||
|
uint16 w0() const { return READ_LE_UINT16(&b0); }
|
||||||
|
void setW0(uint16 v) { WRITE_LE_UINT16(&b0, v); }
|
||||||
|
uint8 b2;
|
||||||
|
uint8 b3;
|
||||||
|
uint16 w2() const { return READ_LE_UINT16(&b2); }
|
||||||
|
void setW2(uint16 v) { WRITE_LE_UINT16(&b2, v); }
|
||||||
|
uint8 b4;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
struct Room {
|
struct Room {
|
||||||
uint8 name[10];
|
uint8 name[10];
|
||||||
uint8 b10;
|
uint8 b10;
|
||||||
|
|
|
@ -964,4 +964,40 @@ void DreamGenContext::checkdest(const uint8 *roomsPaths) {
|
||||||
data.byte(kDestination) = destination;
|
data.byte(kDestination) = destination;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DreamGenContext::checkifperson() {
|
||||||
|
flags._z = not checkifperson(al, ah);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DreamGenContext::checkifperson(uint8 x, uint8 y) {
|
||||||
|
People *people = (People *)segRef(data.word(kBuffers)).ptr(kPeoplelist, 0);
|
||||||
|
|
||||||
|
for (size_t i = 0; i < 12; ++i, ++people) {
|
||||||
|
if (people->b4 == 255)
|
||||||
|
continue;
|
||||||
|
data.word(kReelpointer) = people->w0();
|
||||||
|
Reel *reel = getreelstartCPP();
|
||||||
|
if (reel->frame() == 0xffff)
|
||||||
|
++reel;
|
||||||
|
const Frame *frame = getreelframeax(reel->frame());
|
||||||
|
uint8 xmin = reel->x + frame->x;
|
||||||
|
uint8 ymin = reel->y + frame->y;
|
||||||
|
uint8 xmax = xmin + frame->width;
|
||||||
|
uint8 ymax = ymin + frame->height;
|
||||||
|
if (x < xmin)
|
||||||
|
continue;
|
||||||
|
if (y < ymin)
|
||||||
|
continue;
|
||||||
|
if (x >= xmax)
|
||||||
|
continue;
|
||||||
|
if (y >= ymax)
|
||||||
|
continue;
|
||||||
|
data.word(kPersondata) = people->w2();
|
||||||
|
al = people->b4;
|
||||||
|
ah = 5;
|
||||||
|
obname();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
} /*namespace dreamgen */
|
} /*namespace dreamgen */
|
||||||
|
|
|
@ -101,7 +101,7 @@
|
||||||
void showgamereel();
|
void showgamereel();
|
||||||
void showreelframe();
|
void showreelframe();
|
||||||
void showreelframe(Reel *reel);
|
void showreelframe(Reel *reel);
|
||||||
void getreelframeax();
|
const Frame *getreelframeax(uint16 frame);
|
||||||
void turnpathonCPP(uint8 param);
|
void turnpathonCPP(uint8 param);
|
||||||
void turnpathoffCPP(uint8 param);
|
void turnpathoffCPP(uint8 param);
|
||||||
void getroomspaths();
|
void getroomspaths();
|
||||||
|
@ -119,4 +119,6 @@
|
||||||
void showrain();
|
void showrain();
|
||||||
void deltextline();
|
void deltextline();
|
||||||
void doblocks();
|
void doblocks();
|
||||||
|
void checkifperson();
|
||||||
|
bool checkifperson(uint8 x, uint8 y);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue