DREAWMEB: 'transfertext' ported to C++

This commit is contained in:
Bertrand Augereau 2011-11-15 12:33:13 +01:00
parent bc509e9e08
commit 5adf8b4864
5 changed files with 18 additions and 33 deletions

View File

@ -208,6 +208,7 @@ generator = cpp(context, "DreamGen", blacklist = [
'examineob',
'showwatch',
'roomname',
'transfertext',
], skip_output = [
# These functions are processed but not output
'dreamweb',

View File

@ -5284,35 +5284,6 @@ void DreamGenContext::transfercontoex() {
ds.byte(si+2) = 255;
}
void DreamGenContext::transfertext() {
STACK_CHECK;
es = data.word(kExtras);
al = data.byte(kExpos);
ah = 0;
_add(ax, ax);
bx = (0+2080+30000+(16*114));
_add(bx, ax);
di = data.word(kExtextpos);
es.word(bx) = di;
_add(di, (0+2080+30000+(16*114)+((114+2)*2)));
al = data.byte(kItemtotran);
ah = 0;
_add(ax, ax);
ds = data.word(kFreedesc);
bx = (0);
_add(bx, ax);
si = (0+(82*2));
ax = ds.word(bx);
_add(si, ax);
moretext:
_lodsb();
_stosb();
_inc(data.word(kExtextpos));
_cmp(al, 0);
if (!flags.z())
goto moretext;
}
void DreamGenContext::purgealocation() {
STACK_CHECK;
push(ax);
@ -16480,7 +16451,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) {
case addr_transfertoex: transfertoex(); break;
case addr_pickupconts: pickupconts(); break;
case addr_transfercontoex: transfercontoex(); break;
case addr_transfertext: transfertext(); break;
case addr_purgealocation: purgealocation(); break;
case addr_emergencypurge: emergencypurge(); break;
case addr_purgeanitem: purgeanitem(); break;

View File

@ -433,7 +433,6 @@ public:
static const uint16 addr_purgeanitem = 0xc414;
static const uint16 addr_emergencypurge = 0xc410;
static const uint16 addr_purgealocation = 0xc40c;
static const uint16 addr_transfertext = 0xc404;
static const uint16 addr_transfercontoex = 0xc400;
static const uint16 addr_pickupconts = 0xc3fc;
static const uint16 addr_transfertoex = 0xc3f8;
@ -1603,7 +1602,6 @@ public:
void checkbasemem();
void lastfolder();
void transfermap();
//void showreelframe();
void showmonk();
void diarykeyn();
void set16colpalette();
@ -1658,7 +1656,7 @@ public:
void actualsave();
void autolook();
void playguitar();
void transfertext();
//void showreelframe();
void searchforsame();
void showmainops();
void getback1();
@ -1788,6 +1786,7 @@ public:
//void plotreel();
void swapwithopen();
//void makesprite();
//void transfertext();
void dreamweb();
void droperror();
void edenscdplayer();

View File

@ -245,6 +245,20 @@ void DreamGenContext::inventory() {
examineob(false);
}
void DreamGenContext::transfertext() {
segRef(data.word(kExtras)).word(kExtextdat + data.byte(kExpos) * 2) = data.word(kExtextpos);
uint16 freeTextOffset = data.byte(kItemtotran) * 2;
uint16 srcOffset = segRef(data.word(kFreedesc)).word(kFreetextdat + freeTextOffset);
const uint8 *src = segRef(data.word(kFreedesc)).ptr(kFreetext + srcOffset, 0);
uint8 *dst = segRef(data.word(kExtras)).ptr(kExtext + data.word(kExtextpos), 0);
uint8 c;
do {
c = *src++;
*dst++ = c;
++data.word(kExtextpos);
} while (c);
}
} /*namespace dreamgen */

View File

@ -252,4 +252,5 @@
void examineob(bool examineAgain = true);
void showwatch();
void roomname();
void transfertext();