DREAMWEB: 'isitworn' and 'makeworn' ported to C++

This commit is contained in:
Bertrand Augereau 2011-09-02 09:11:48 +02:00
parent 214cff8db8
commit 1de8427361
5 changed files with 25 additions and 22 deletions

View File

@ -185,6 +185,8 @@ generator = cpp(context, "DreamGen", blacklist = [
'checkifpathison',
'delsprite',
'dumpeverything',
'isitworn',
'makeworn',
], skip_output = [
# These functions are processed but not output
'dreamweb',

View File

@ -4015,22 +4015,6 @@ finishfill:
bx = pop();
}
void DreamGenContext::isitworn() {
STACK_CHECK;
al = es.byte(bx+12);
_cmp(al, 'W'-'A');
if (!flags.z())
return /* (notworn) */;
al = es.byte(bx+13);
_cmp(al, 'E'-'A');
}
void DreamGenContext::makeworn() {
STACK_CHECK;
es.byte(bx+12) = 'W'-'A';
es.byte(bx+13) = 'E'-'A';
}
void DreamGenContext::examineob() {
STACK_CHECK;
data.byte(kPointermode) = 0;
@ -17385,8 +17369,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) {
case addr_findallryan: findallryan(); break;
case addr_findallopen: findallopen(); break;
case addr_obtoinv: obtoinv(); break;
case addr_isitworn: isitworn(); break;
case addr_makeworn: makeworn(); break;
case addr_examineob: examineob(); break;
case addr_makemainscreen: makemainscreen(); break;
case addr_getbackfromob: getbackfromob(); break;

View File

@ -494,8 +494,6 @@ public:
static const uint16 addr_getbackfromob = 0xc344;
static const uint16 addr_makemainscreen = 0xc340;
static const uint16 addr_examineob = 0xc33c;
static const uint16 addr_makeworn = 0xc338;
static const uint16 addr_isitworn = 0xc334;
static const uint16 addr_obtoinv = 0xc330;
static const uint16 addr_findallopen = 0xc32c;
static const uint16 addr_findallryan = 0xc328;
@ -1273,7 +1271,7 @@ public:
void neterror();
void storeit();
//void lockeddoorway();
void isitworn();
//void isitworn();
//void putundertimed();
//void dumpmap();
//void multidump();
@ -1667,7 +1665,7 @@ public:
//void showallfree();
void loadnews();
void rollem();
void makeworn();
//void makeworn();
void examineobtext();
void startup();
void savegame();

View File

@ -1779,5 +1779,22 @@ bool DreamGenContext::checkifset(uint8 x, uint8 y) {
return false;
}
void DreamGenContext::isitworn() {
flags._z = isitworn((const DynObject *)es.ptr(bx, sizeof(DynObject)));
}
bool DreamGenContext::isitworn(const DynObject *object) {
return (object->id[0] == 'W'-'A') && (object->id[1] == 'E'-'A');
}
void DreamGenContext::makeworn() {
makeworn((DynObject *)es.ptr(bx, sizeof(DynObject)));
}
void DreamGenContext::makeworn(DynObject *object) {
object->id[0] = 'W'-'A';
object->id[1] = 'E'-'A';
}
} /*namespace dreamgen */

View File

@ -220,4 +220,8 @@
bool checkifset(uint8 x, uint8 y);
void checkifpathison();
bool checkifpathison(uint8 index);
void isitworn();
bool isitworn(const DynObject *object);
void makeworn();
void makeworn(DynObject *object);