DREAMWEB: Ported 'findxyfrompath' to C++

This commit is contained in:
Bertrand Augereau 2011-08-18 22:22:39 +02:00
parent ef7c28c2cd
commit 3f6a277819
5 changed files with 9 additions and 19 deletions

View file

@ -133,6 +133,7 @@ generator = cpp(context, "DreamGen", blacklist = [
'blocknametext',
'walktotext',
'personnametext',
'findxyfrompath',
], skip_output = [
# These functions are processed but not output
'dreamweb',

View file

@ -17659,22 +17659,6 @@ lookx2:
es.byte(bx+6) = al;
}
void DreamGenContext::findxyfrompath() {
STACK_CHECK;
getroomspaths();
al = data.byte(kManspath);
ah = 0;
_add(ax, ax);
_add(ax, ax);
_add(ax, ax);
_add(bx, ax);
ax = es.word(bx);
_sub(al, 12);
_sub(ah, 12);
data.byte(kRyanx) = al;
data.byte(kRyany) = ah;
}
void DreamGenContext::findroominloc() {
STACK_CHECK;
al = data.byte(kMapy);
@ -18982,7 +18966,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) {
case addr_restoreall: restoreall(); break;
case addr_sortoutmap: sortoutmap(); break;
case addr_disablepath: disablepath(); break;
case addr_findxyfrompath: findxyfrompath(); break;
case addr_findroominloc: findroominloc(); break;
case addr_dontloadseg: dontloadseg(); break;
case addr_allocateload: allocateload(); break;

View file

@ -59,7 +59,6 @@ public:
static const uint16 addr_allocateload = 0xcb68;
static const uint16 addr_dontloadseg = 0xcb64;
static const uint16 addr_findroominloc = 0xcb58;
static const uint16 addr_findxyfrompath = 0xcb54;
static const uint16 addr_disablepath = 0xcb50;
static const uint16 addr_sortoutmap = 0xcb48;
static const uint16 addr_restoreall = 0xcb44;
@ -1746,7 +1745,7 @@ public:
void pitinterupt();
void deleverything();
void fadescreendown();
void findxyfrompath();
//void findxyfrompath();
void namestoold();
//void getxad();
void openinv();

View file

@ -1110,6 +1110,12 @@ void DreamGenContext::walktotext() {
commandwithob(3, data.byte(kCommandtype), data.byte(kCommand));
}
void DreamGenContext::findxyfrompath() {
const uint8 *roomsPaths = getroomspathsCPP();
data.byte(kRyanx) = roomsPaths[data.byte(kManspath) * 8 + 0] - 12;
data.byte(kRyany) = roomsPaths[data.byte(kManspath) * 8 + 1] - 12;
}
bool DreamGenContext::isCD() {
// The original sources has two codepaths depending if the game is 'if cd' or not
// This is a hack to guess which version to use with the assumption that if we have a cd version

View file

@ -148,5 +148,6 @@
void blocknametext();
void walktotext();
void personnametext();
void findxyfrompath();
bool isCD();