DREAMWEB: 'findsource' ported to C++

This commit is contained in:
Bertrand Augereau 2011-07-30 15:19:22 +02:00
parent 1f0eccb296
commit 95fa7451d6
5 changed files with 17 additions and 24 deletions

View File

@ -66,6 +66,7 @@ generator = cpp(context, "DreamGen", blacklist = [
'showframe',
'initman',
'aboutturn',
'findsource',
'walking',
'spriteupdate',
'dodoor',

View File

@ -2237,27 +2237,6 @@ void DreamGenContext::checkone() {
dx = pop();
}
void DreamGenContext::findsource() {
STACK_CHECK;
ax = data.word(kCurrentframe);
_cmp(ax, 160);
if (!flags.c())
goto over1000;
ds = data.word(kReel1);
data.word(kTakeoff) = 0;
return;
over1000:
_cmp(ax, 320);
if (!flags.c())
goto over1001;
ds = data.word(kReel2);
data.word(kTakeoff) = 160;
return;
over1001:
ds = data.word(kReel3);
data.word(kTakeoff) = 320;
}
void DreamGenContext::checkforexit() {
STACK_CHECK;
cl = data.byte(kRyanx);
@ -20519,7 +20498,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) {
case addr_checkspeed: checkspeed(); break;
case addr_delsprite: delsprite(); break;
case addr_checkone: checkone(); break;
case addr_findsource: findsource(); break;
case addr_mainman: mainman(); break;
case addr_checkforexit: checkforexit(); break;
case addr_adjustdown: adjustdown(); break;

View File

@ -673,7 +673,6 @@ public:
static const uint16 addr_adjustdown = 0xc14c;
static const uint16 addr_checkforexit = 0xc148;
static const uint16 addr_mainman = 0xc138;
static const uint16 addr_findsource = 0xc130;
static const uint16 addr_checkone = 0xc12c;
static const uint16 addr_delsprite = 0xc11c;
static const uint16 addr_checkspeed = 0xc110;
@ -1382,7 +1381,7 @@ public:
void fadeupmonfirst();
void drawfloor();
void loadkeypad();
void findsource();
//void findsource();
void clearendpal();
void findtext1();
void isryanholding();

View File

@ -538,5 +538,19 @@ void DreamGenContext::facerightway() {
data.byte(kLeavedirection) = dir;
}
void DreamGenContext::findsource() {
uint16 currentFrame = data.word(kCurrentframe);
if (currentFrame < 160) {
ds = data.word(kReel1);
data.word(kTakeoff) = 0;
} else if (currentFrame < 320) {
ds = data.word(kReel2);
data.word(kTakeoff) = 160;
} else {
ds = data.word(kReel3);
data.word(kTakeoff) = 320;
}
}
} /*namespace dreamgen */

View File

@ -86,6 +86,7 @@
void lockeddoorway(Sprite *sprite, ObjData *objData);
void liftsprite();
void liftsprite(Sprite *sprite, ObjData *objData);
void findsource();
void turnpathonCPP(uint8 param);
void turnpathoffCPP(uint8 param);
void getroomspaths();