SCI: Merged Message() and GetMessage(). Set SCI1.1 to use SCI1 kernel table (for now).
svn-id: r40481
This commit is contained in:
parent
a79716e367
commit
c299dbeb26
5 changed files with 26 additions and 27 deletions
|
@ -201,7 +201,6 @@ SciKernelFunction kfunct_mappers[] = {
|
||||||
/*(?)*/ DEFUN("TimesCot", kTimesCot, "ii"),
|
/*(?)*/ DEFUN("TimesCot", kTimesCot, "ii"),
|
||||||
/*(?)*/ DEFUN("TimesTan", kTimesTan, "ii"),
|
/*(?)*/ DEFUN("TimesTan", kTimesTan, "ii"),
|
||||||
DEFUN("Message", kMessage, ".*"),
|
DEFUN("Message", kMessage, ".*"),
|
||||||
DEFUN("GetMessage", kGetMessage, "iiir"),
|
|
||||||
DEFUN("DoAudio", kDoAudio, ".*"),
|
DEFUN("DoAudio", kDoAudio, ".*"),
|
||||||
DEFUN("DoSync", kDoSync, ".*"),
|
DEFUN("DoSync", kDoSync, ".*"),
|
||||||
|
|
||||||
|
|
|
@ -451,7 +451,6 @@ reg_t kGetSaveDir(EngineState *s, int funct_nr, int argc, reg_t *argv);
|
||||||
reg_t kTextSize(EngineState *s, int funct_nr, int argc, reg_t *argv);
|
reg_t kTextSize(EngineState *s, int funct_nr, int argc, reg_t *argv);
|
||||||
reg_t kIsItSkip(EngineState *s, int funct_nr, int argc, reg_t *argv);
|
reg_t kIsItSkip(EngineState *s, int funct_nr, int argc, reg_t *argv);
|
||||||
reg_t kMessage(EngineState *s, int funct_nr, int argc, reg_t *argv);
|
reg_t kMessage(EngineState *s, int funct_nr, int argc, reg_t *argv);
|
||||||
reg_t kGetMessage(EngineState *s, int funct_nr, int argc, reg_t *argv);
|
|
||||||
reg_t kDoAudio(EngineState *s, int funct_nr, int argc, reg_t *argv);
|
reg_t kDoAudio(EngineState *s, int funct_nr, int argc, reg_t *argv);
|
||||||
reg_t kDoSync(EngineState *s, int funct_nr, int argc, reg_t *argv);
|
reg_t kDoSync(EngineState *s, int funct_nr, int argc, reg_t *argv);
|
||||||
reg_t k_Unknown(EngineState *s, int funct_nr, int argc, reg_t *argv);
|
reg_t k_Unknown(EngineState *s, int funct_nr, int argc, reg_t *argv);
|
||||||
|
|
|
@ -729,6 +729,27 @@ static MessageState state;
|
||||||
reg_t kMessage(EngineState *s, int funct_nr, int argc, reg_t *argv) {
|
reg_t kMessage(EngineState *s, int funct_nr, int argc, reg_t *argv) {
|
||||||
MessageTuple tuple;
|
MessageTuple tuple;
|
||||||
|
|
||||||
|
if (argc == 4) {
|
||||||
|
// Earlier version of of this function (GetMessage)
|
||||||
|
tuple.noun = UKPV(0);
|
||||||
|
int module = UKPV(1);
|
||||||
|
tuple.verb = UKPV(2);
|
||||||
|
tuple.cond = 0;
|
||||||
|
tuple.seq = 1;
|
||||||
|
|
||||||
|
if (state.loadRes(s->resmgr, module, true) && state.getMessage(&tuple)) {
|
||||||
|
int len = state.getLength();
|
||||||
|
char *buffer = kernel_dereference_char_pointer(s, argv[3], len + 1);
|
||||||
|
|
||||||
|
if (buffer) {
|
||||||
|
state.getText(buffer);
|
||||||
|
return argv[3];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL_REG;
|
||||||
|
}
|
||||||
|
|
||||||
switch (UKPV(0)) {
|
switch (UKPV(0)) {
|
||||||
case 0:
|
case 0:
|
||||||
case 2:
|
case 2:
|
||||||
|
@ -807,25 +828,4 @@ reg_t kMessage(EngineState *s, int funct_nr, int argc, reg_t *argv) {
|
||||||
return NULL_REG;
|
return NULL_REG;
|
||||||
}
|
}
|
||||||
|
|
||||||
reg_t kGetMessage(EngineState *s, int funct_nr, int argc, reg_t *argv) {
|
|
||||||
MessageTuple tuple;
|
|
||||||
tuple.noun = UKPV(0);
|
|
||||||
int module = UKPV(1);
|
|
||||||
tuple.verb = UKPV(2);
|
|
||||||
tuple.cond = 0;
|
|
||||||
tuple.seq = 0;
|
|
||||||
|
|
||||||
if (state.loadRes(s->resmgr, module, true) && state.getMessage(&tuple)) {
|
|
||||||
int len = state.getLength();
|
|
||||||
char *buffer = kernel_dereference_char_pointer(s, argv[3], len + 1);
|
|
||||||
|
|
||||||
if (buffer) {
|
|
||||||
state.getText(buffer);
|
|
||||||
return argv[3];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL_REG;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // End of namespace Sci
|
} // End of namespace Sci
|
||||||
|
|
|
@ -33,7 +33,7 @@ void MessageState::parse(IndexRecordCursor *cursor, MessageTuple *t) {
|
||||||
t->verb = *(cursor->index_record + 1);
|
t->verb = *(cursor->index_record + 1);
|
||||||
if (_version == 2101) {
|
if (_version == 2101) {
|
||||||
t->cond = 0;
|
t->cond = 0;
|
||||||
t->seq = 0;
|
t->seq = 1;
|
||||||
} else {
|
} else {
|
||||||
t->cond = *(cursor->index_record + 2);
|
t->cond = *(cursor->index_record + 2);
|
||||||
t->seq = *(cursor->index_record + 3);
|
t->seq = *(cursor->index_record + 3);
|
||||||
|
|
|
@ -276,7 +276,7 @@ static const char *sci1_default_knames[SCI1_KNAMES_DEFAULT_ENTRIES_NR] = {
|
||||||
/*0x79*/ "ATan",
|
/*0x79*/ "ATan",
|
||||||
/*0x7a*/ "Lock",
|
/*0x7a*/ "Lock",
|
||||||
/*0x7b*/ "StrSplit",
|
/*0x7b*/ "StrSplit",
|
||||||
/*0x7c*/ "GetMessage",
|
/*0x7c*/ "Message",
|
||||||
/*0x7d*/ "IsItSkip"
|
/*0x7d*/ "IsItSkip"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -456,7 +456,7 @@ static void vocabulary_get_knames1(ResourceManager *resmgr, Common::StringList &
|
||||||
names[i] = sci1_default_knames[i];
|
names[i] = sci1_default_knames[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
#ifdef ENABLE_SCI32
|
||||||
static void vocabulary_get_knames11(ResourceManager *resmgr, Common::StringList &names) {
|
static void vocabulary_get_knames11(ResourceManager *resmgr, Common::StringList &names) {
|
||||||
/*
|
/*
|
||||||
999.voc format for SCI1.1 games:
|
999.voc format for SCI1.1 games:
|
||||||
|
@ -481,6 +481,7 @@ static void vocabulary_get_knames11(ResourceManager *resmgr, Common::StringList
|
||||||
names[i] = Common::String((char *)r->data + off + 2, len);
|
names[i] = Common::String((char *)r->data + off + 2, len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void vocabulary_get_knames(ResourceManager *resmgr, Common::StringList &names) {
|
void vocabulary_get_knames(ResourceManager *resmgr, Common::StringList &names) {
|
||||||
names.clear();
|
names.clear();
|
||||||
|
@ -502,7 +503,7 @@ void vocabulary_get_knames(ResourceManager *resmgr, Common::StringList &names) {
|
||||||
vocabulary_get_knames1(resmgr, names);
|
vocabulary_get_knames1(resmgr, names);
|
||||||
break;
|
break;
|
||||||
case SCI_VERSION_1_1:
|
case SCI_VERSION_1_1:
|
||||||
vocabulary_get_knames11(resmgr, names);
|
vocabulary_get_knames1(resmgr, names);
|
||||||
break;
|
break;
|
||||||
#ifdef ENABLE_SCI32
|
#ifdef ENABLE_SCI32
|
||||||
case SCI_VERSION_32:
|
case SCI_VERSION_32:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue