DREAMWEB: 'autosetwalk' ported to C++

This commit is contained in:
Bertrand Augereau 2011-08-08 22:26:31 +02:00
parent baa109f058
commit 3407f2803a
5 changed files with 25 additions and 58 deletions

View File

@ -74,6 +74,7 @@ generator = cpp(context, "DreamGen", blacklist = [
'showreelframe',
'findsource',
'walking',
'autosetwalk',
'spriteupdate',
'dodoor',
'lockeddoorway',

View File

@ -17359,59 +17359,6 @@ holdingreel:
data.byte(kWatchmode) = 2;
}
void DreamGenContext::autosetwalk() {
STACK_CHECK;
al = data.byte(kManspath);
_cmp(data.byte(kFinaldest), al);
if (!flags.z())
goto notsamealready;
return;
notsamealready:
getroomspaths();
checkdest();
push(bx);
al = data.byte(kManspath);
ah = 0;
_add(ax, ax);
_add(ax, ax);
_add(ax, ax);
_add(bx, ax);
al = es.byte(bx);
ah = 0;
_sub(ax, 12);
data.word(kLinestartx) = ax;
al = es.byte(bx+1);
ah = 0;
_sub(ax, 12);
data.word(kLinestarty) = ax;
bx = pop();
al = data.byte(kDestination);
ah = 0;
_add(ax, ax);
_add(ax, ax);
_add(ax, ax);
_add(bx, ax);
al = es.byte(bx);
ah = 0;
_sub(ax, 12);
data.word(kLineendx) = ax;
al = es.byte(bx+1);
ah = 0;
_sub(ax, 12);
data.word(kLineendy) = ax;
bresenhams();
_cmp(data.byte(kLinedirection), 0);
if (flags.z())
goto normalline;
al = data.byte(kLinelength);
_dec(al);
data.byte(kLinepointer) = al;
data.byte(kLinedirection) = 1;
return;
normalline:
data.byte(kLinepointer) = 0;
}
void DreamGenContext::checkdest() {
STACK_CHECK;
push(bx);
@ -20190,7 +20137,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) {
case addr_walktotext: walktotext(); break;
case addr_getflagunderp: getflagunderp(); break;
case addr_setwalk: setwalk(); break;
case addr_autosetwalk: autosetwalk(); break;
case addr_checkdest: checkdest(); break;
case addr_bresenhams: bresenhams(); break;
case addr_workoutframes: workoutframes(); break;

View File

@ -120,7 +120,6 @@ public:
static const uint16 addr_workoutframes = 0xca54;
static const uint16 addr_bresenhams = 0xca50;
static const uint16 addr_checkdest = 0xca4c;
static const uint16 addr_autosetwalk = 0xca48;
static const uint16 addr_setwalk = 0xca44;
static const uint16 addr_getflagunderp = 0xca40;
static const uint16 addr_walktotext = 0xca3c;
@ -1360,6 +1359,7 @@ public:
void fadedos();
//void fillspace();
//void multiget();
//void autosetwalk();
void fadeupmonfirst();
void drawfloor();
void loadkeypad();
@ -1385,7 +1385,7 @@ public:
void additionaltext();
//void kernchars();
void othersmoker();
void autosetwalk();
void dofade();
void setuptimedtemp();
void blocknametext();
void useelevator5();
@ -1431,7 +1431,6 @@ public:
void addtopeoplelist();
void hangoncurs();
void sparkydrip();
//void modifychar();
void compare();
void printcurs();
//void convertkey();
@ -1759,7 +1758,7 @@ public:
void readfromfile();
void initialinv();
void showslots();
void dofade();
//void modifychar();
void hangon();
void settopright();
void findsetobject();

View File

@ -882,5 +882,25 @@ void DreamGenContext::deltextline() {
multiput(ds.ptr(si, 0), x, y, kUndertextsizex, kUndertextsizey);
}
void DreamGenContext::autosetwalk() {
al = data.byte(kManspath);
if (data.byte(kFinaldest) == al)
return;
getroomspaths();
uint8 *roomsPaths = getroomspathsCPP();
checkdest();
data.word(kLinestartx) = roomsPaths[data.byte(kManspath) * 8 + 0] - 12;
data.word(kLinestarty) = roomsPaths[data.byte(kManspath) * 8 + 1] - 12;
data.word(kLineendx) = roomsPaths[data.byte(kDestination) * 8 + 0] - 12;
data.word(kLineendy) = roomsPaths[data.byte(kDestination) * 8 + 1] - 12;
bresenhams();
if (data.byte(kLinedirection) != 0) {
data.byte(kLinepointer) = data.byte(kLinelength) - 1;
data.byte(kLinedirection) = 1;
return;
}
data.byte(kLinepointer) = 0;
}
} /*namespace dreamgen */

View File

@ -82,6 +82,7 @@
void facerightway();
void walking();
void walking(Sprite *sprite);
void autosetwalk();
void aboutturn(Sprite *sprite);
void backobject(Sprite *sprite);
void constant(Sprite *sprite, ObjData *objData);