DREAMWEB: 'standardload' ported to C++

This commit is contained in:
Bertrand Augereau 2011-11-17 18:21:34 +01:00
parent 6c51635bb2
commit 088ec69949
5 changed files with 18 additions and 21 deletions

View File

@ -231,6 +231,7 @@ generator = cpp(context, "DreamGen", blacklist = [
'showoutermenu',
'textforend',
'textformonk',
'standardload',
'twodigitnum',
'readsetdata',
'loadroomssample',

View File

@ -14125,24 +14125,6 @@ void DreamGenContext::loadtempcharset() {
data.word(kTempcharset) = ax;
}
void DreamGenContext::standardload() {
STACK_CHECK;
openfile();
readheader();
bx = es.word(di);
push(bx);
cl = 4;
_shr(bx, cl);
allocatemem();
ds = ax;
cx = pop();
push(ax);
dx = 0;
readfromfile();
closefile();
ax = pop();
}
void DreamGenContext::loadtemptext() {
STACK_CHECK;
standardload();
@ -16070,7 +16052,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) {
case addr_loadintotemp2: loadintotemp2(); break;
case addr_loadintotemp3: loadintotemp3(); break;
case addr_loadtempcharset: loadtempcharset(); break;
case addr_standardload: standardload(); break;
case addr_loadtemptext: loadtemptext(); break;
case addr_getridofreels: getridofreels(); break;
case addr_getridofall: getridofall(); break;

View File

@ -64,7 +64,6 @@ public:
static const uint16 addr_getridofall = 0xcb3c;
static const uint16 addr_getridofreels = 0xcb38;
static const uint16 addr_loadtemptext = 0xcb2c;
static const uint16 addr_standardload = 0xcb28;
static const uint16 addr_loadtempcharset = 0xcb24;
static const uint16 addr_loadintotemp3 = 0xcb20;
static const uint16 addr_loadintotemp2 = 0xcb1c;
@ -1924,7 +1923,7 @@ public:
//void setallchanges();
void newgame();
//void printboth();
void standardload();
//void standardload();
void undertextline();
void findroominloc();
void sitdowninbar();

View File

@ -208,6 +208,20 @@ static Common::String getFilename(Context &context) {
return Common::String(name);
}
uint16 DreamGenContext::standardload(const char *fileName) {
engine->openFile(fileName);
engine->readFromFile(cs.ptr(kFileheader, kHeaderlen), kHeaderlen);
uint16 sizeInBytes = cs.word(kFiledata);
uint16 result = allocatemem((sizeInBytes + 15) / 16);
engine->readFromFile(segRef(result).ptr(0, 0), sizeInBytes);
engine->closeFile();
return result;
}
void DreamGenContext::standardload() {
ax = standardload((const char *)cs.ptr(dx, 0));
}
void DreamGenContext::seecommandtail() {
data.word(kSoundbaseadd) = 0x220;
data.byte(kSoundint) = 5;

View File

@ -23,6 +23,8 @@
uint8 *workspace();
void allocatework();
void clearwork();
void standardload();
uint16 standardload(const char *fileName); // Returns a segment handle which needs to be freed with deallocatemem for symmetry
void multidump();
void multidump(uint16 x, uint16 y, uint8 width, uint8 height);
void frameoutv(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, int16 x, int16 y);