mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-22 12:12:16 +00:00
DREAMWEB: Convert 'parser'
This commit is contained in:
parent
bd70cd9dff
commit
b08804f360
@ -718,6 +718,7 @@ generator = cpp(context, "DreamGen", blacklist = [
|
||||
'panelicons1',
|
||||
'paneltomap',
|
||||
'parseblaster',
|
||||
'parser',
|
||||
'personnametext',
|
||||
'pickupconts',
|
||||
'pickupob',
|
||||
|
@ -177,6 +177,7 @@ public:
|
||||
void loadNews();
|
||||
void loadCart();
|
||||
void showKeys();
|
||||
const char *parser();
|
||||
|
||||
// from newplace.cpp
|
||||
void getUnderCentre();
|
||||
@ -590,6 +591,7 @@ public:
|
||||
void errorMessage1();
|
||||
void errorMessage2();
|
||||
void errorMessage3();
|
||||
void decide();
|
||||
|
||||
// from talk.cpp
|
||||
void talk();
|
||||
|
@ -148,45 +148,6 @@ notfound:
|
||||
al = 1;
|
||||
}
|
||||
|
||||
void DreamGenContext::parser() {
|
||||
STACK_CHECK;
|
||||
es = cs;
|
||||
di = offset_operand1;
|
||||
cx = 13;
|
||||
al = 0;
|
||||
_stosb(cx, true);
|
||||
di = offset_operand1;
|
||||
al = '=';
|
||||
_stosb();
|
||||
ds = cs;
|
||||
si = 483;
|
||||
notspace1:
|
||||
_lodsw();
|
||||
_cmp(al, 32);
|
||||
if (flags.z())
|
||||
goto stillspace1;
|
||||
_cmp(al, 0);
|
||||
if (!flags.z())
|
||||
goto notspace1;
|
||||
goto finishpars;
|
||||
stillspace1:
|
||||
_lodsw();
|
||||
_cmp(al, 32);
|
||||
if (flags.z())
|
||||
goto stillspace1;
|
||||
copyin1:
|
||||
_stosb();
|
||||
_lodsw();
|
||||
_cmp(al, 0);
|
||||
if (flags.z())
|
||||
goto finishpars;
|
||||
_cmp(al, 32);
|
||||
if (!flags.z())
|
||||
goto copyin1;
|
||||
finishpars:
|
||||
di = offset_operand1;
|
||||
}
|
||||
|
||||
void DreamGenContext::__start() {
|
||||
static const uint8 src[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x13, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
|
@ -419,7 +419,6 @@ public:
|
||||
void dirFile();
|
||||
void dreamweb();
|
||||
void searchForString();
|
||||
void parser();
|
||||
};
|
||||
|
||||
} // End of namespace DreamGen
|
||||
|
@ -458,8 +458,11 @@ void DreamGenContext::getKeyAndLogo() {
|
||||
|
||||
void DreamGenContext::dirCom() {
|
||||
randomAccess(30);
|
||||
parser();
|
||||
if (es.byte(di + 1)) {
|
||||
|
||||
const char *dirname = parser();
|
||||
if (dirname[1]) {
|
||||
es = cs;
|
||||
di = offset_operand1; // cs:operand1 == dirname
|
||||
dirFile();
|
||||
return;
|
||||
}
|
||||
@ -479,8 +482,8 @@ void DreamGenContext::read() {
|
||||
bool foundFile = false;
|
||||
|
||||
randomAccess(40);
|
||||
parser();
|
||||
if (es.byte(di+1) == 0) {
|
||||
const char *name = parser();
|
||||
if (name[1] == 0) {
|
||||
netError();
|
||||
return;
|
||||
}
|
||||
@ -552,10 +555,10 @@ void DreamGenContext::read() {
|
||||
}
|
||||
|
||||
void DreamGenContext::signOn() {
|
||||
parser();
|
||||
const char *name = parser();
|
||||
|
||||
int8 foundIndex = -1;
|
||||
Common::String inputLine = (const char *)data.ptr(offset_operand1 + 1, 0);
|
||||
Common::String inputLine = name + 1;
|
||||
inputLine.trim();
|
||||
|
||||
for (byte i = 0; i < 4; i++) {
|
||||
@ -623,4 +626,44 @@ void DreamGenContext::searchForFiles(uint16 segment) {
|
||||
}
|
||||
}
|
||||
|
||||
const char *DreamBase::parser() {
|
||||
char *output = (char *)data.ptr(offset_operand1, 13);
|
||||
|
||||
memset(output, 0, 13);
|
||||
|
||||
char *p = output;
|
||||
*p++ = '=';
|
||||
|
||||
const char *in = (const char *)data.ptr(kInputline, 0);
|
||||
|
||||
uint8 c;
|
||||
|
||||
// skip command
|
||||
do {
|
||||
c = *in++;
|
||||
in++;
|
||||
|
||||
if (!c)
|
||||
return output;
|
||||
} while (c != 32);
|
||||
|
||||
// skip spaces between command and operand
|
||||
do {
|
||||
c = *in++;
|
||||
in++;
|
||||
} while (c == 32);
|
||||
|
||||
// copy first operand
|
||||
do {
|
||||
*p++ = c;
|
||||
c = *in++;
|
||||
in++;
|
||||
if (!c)
|
||||
return output;
|
||||
} while (c != 32);
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
} // End of namespace DreamGen
|
||||
|
@ -3101,7 +3101,7 @@ void DreamGenContext::madmanRun() {
|
||||
}
|
||||
|
||||
|
||||
void DreamGenContext::decide() {
|
||||
void DreamBase::decide() {
|
||||
setMode();
|
||||
loadPalFromIFF();
|
||||
clearPalette();
|
||||
@ -3118,10 +3118,10 @@ void DreamGenContext::decide() {
|
||||
fadeScreenUp();
|
||||
data.byte(kGetback) = 0;
|
||||
|
||||
RectWithCallback<DreamGenContext> decideList[] = {
|
||||
RectWithCallback<DreamBase> decideList[] = {
|
||||
{ kOpsx+69,kOpsx+124,kOpsy+30,kOpsy+76,&DreamBase::newGame },
|
||||
{ kOpsx+20,kOpsx+87,kOpsy+10,kOpsy+59,&DreamBase::DOSReturn },
|
||||
{ kOpsx+123,kOpsx+190,kOpsy+10,kOpsy+59,&DreamGenContext::loadOld },
|
||||
{ kOpsx+123,kOpsx+190,kOpsy+10,kOpsy+59,&DreamBase::loadOld },
|
||||
{ 0,320,0,200,&DreamBase::blank },
|
||||
{ 0xFFFF,0,0,0,0 }
|
||||
};
|
||||
|
@ -107,7 +107,6 @@
|
||||
void allPointer();
|
||||
void afterNewRoom();
|
||||
void madmanRun();
|
||||
void decide();
|
||||
void showGun();
|
||||
void triggerMessage(uint16 index);
|
||||
void processTrigger();
|
||||
|
Loading…
x
Reference in New Issue
Block a user