DREAMWEB: 'findnextcolon' ported to C++

This commit is contained in:
Bertrand Augereau 2011-09-07 03:41:05 +02:00
parent 230d17ed30
commit 09a734bd25
5 changed files with 21 additions and 17 deletions

View file

@ -194,6 +194,7 @@ generator = cpp(context, "DreamGen", blacklist = [
'useroutine',
'hangon',
'hangonp',
'findnextcolon',
], skip_output = [
# These functions are processed but not output
'dreamweb',

View file

@ -4253,19 +4253,6 @@ foundmatch:
bx = pop();
}
void DreamGenContext::findnextcolon() {
STACK_CHECK;
isntcolon:
al = es.byte(si);
_inc(si);
_cmp(al, 0);
if (flags.z())
return /* (endofcolon) */;
_cmp(al, ':');
if (!flags.z())
goto isntcolon;
}
void DreamGenContext::inventory() {
STACK_CHECK;
_cmp(data.byte(kMandead), 1);
@ -17072,7 +17059,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) {
case addr_obsthatdothings: obsthatdothings(); break;
case addr_getobtextstart: getobtextstart(); break;
case addr_searchforsame: searchforsame(); break;
case addr_findnextcolon: findnextcolon(); break;
case addr_inventory: inventory(); break;
case addr_setpickup: setpickup(); break;
case addr_examinventory: examinventory(); break;

View file

@ -477,7 +477,6 @@ public:
static const uint16 addr_examinventory = 0xc384;
static const uint16 addr_setpickup = 0xc380;
static const uint16 addr_inventory = 0xc37c;
static const uint16 addr_findnextcolon = 0xc378;
static const uint16 addr_searchforsame = 0xc374;
static const uint16 addr_getobtextstart = 0xc370;
static const uint16 addr_obsthatdothings = 0xc36c;
@ -1852,7 +1851,7 @@ public:
void soundonreels();
void usegun();
void autoappear();
void findnextcolon();
//void findnextcolon();
//void readmouse4();
void openryan();
void callhotellift();

View file

@ -1899,5 +1899,22 @@ void DreamGenContext::hangonp(uint16 count) {
data.byte(kPointermode) = 0;
}
void DreamGenContext::findnextcolon() {
uint8 *initialString = es.ptr(si, 0);
uint8 *string = initialString;
al = findnextcolon(&string);
si += (string - initialString);
}
uint8 DreamGenContext::findnextcolon(uint8 **string) {
uint8 c;
do {
c = **string;
++(*string);
} while ((c != 0) && (c != ':'));
return c;
}
} /*namespace dreamgen */

View file

@ -235,5 +235,6 @@
void hangon(uint16 frameCount);
void hangonp();
void hangonp(uint16 count);
uint8 findnextcolon(uint8 **string);
void findnextcolon();