Skip to content

Commit

Permalink
SCI: Add parser support for LSL3, SQ3 German Amiga
Browse files Browse the repository at this point in the history
Add parser support for multilingual Amiga versions that were released
in 1991 and are SCI_VERSION_1_MIDDLE
  • Loading branch information
sluicebox authored and bluegr committed Apr 9, 2019
1 parent 1e4c457 commit bc2ab79
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion engines/sci/engine/kparse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ reg_t kSetSynonyms(EngineState *s, int argc, reg_t *argv) {
Vocabulary *voc = g_sci->getVocabulary();

// Only SCI0-SCI1 EGA games had a parser. In newer versions, this is a stub
if (getSciVersion() > SCI_VERSION_1_EGA_ONLY)
if (!g_sci->hasParser())
return s->r_acc;

voc->clearSynonyms();
Expand Down
2 changes: 1 addition & 1 deletion engines/sci/parser/vocabulary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Vocabulary::Vocabulary(ResourceManager *resMan, bool foreign) : _resMan(resMan),
_resourceIdBranches += 10;
}

if (getSciVersion() <= SCI_VERSION_1_EGA_ONLY && loadParserWords()) {
if (g_sci->hasParser() && loadParserWords()) {
loadSuffixes();
if (loadBranches())
// Now build a GNF grammar out of this
Expand Down
13 changes: 8 additions & 5 deletions engines/sci/sci.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,11 +311,7 @@ Common::Error SciEngine::run() {
_kernel->init();

_features = new GameFeatures(segMan, _kernel);
// Only SCI0, SCI01 and SCI1 EGA games used a parser
_vocabulary = (getSciVersion() <= SCI_VERSION_1_EGA_ONLY) ? new Vocabulary(_resMan, false) : NULL;
// Also, XMAS1990 apparently had a parser too. Refer to https://forums.scummvm.org/viewtopic.php?t=9135
if (getGameId() == GID_CHRISTMAS1990)
_vocabulary = new Vocabulary(_resMan, false);
_vocabulary = hasParser() ? new Vocabulary(_resMan, false) : NULL;

_gamestate = new EngineState(segMan);
_guestAdditions = new GuestAdditions(_gamestate, _features, _kernel);
Expand Down Expand Up @@ -779,6 +775,13 @@ bool SciEngine::isBE() const{
}
}

bool SciEngine::hasParser() const {
// Only SCI0, SCI01 and SCI1 EGA games used a parser, along with
// multilingual LSL3 and SQ3 Amiga which are SCI_VERSION_1_MIDDLE
return getSciVersion() <= SCI_VERSION_1_EGA_ONLY ||
getGameId() == GID_LSL3 || getGameId() == GID_SQ3;
}

bool SciEngine::hasMacIconBar() const {
return _resMan->isSci11Mac() && getSciVersion() == SCI_VERSION_1_1 &&
(getGameId() == GID_KQ6 || getGameId() == GID_FREDDYPHARKAS);
Expand Down
3 changes: 2 additions & 1 deletion engines/sci/sci.h
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ enum SciVersion {
SCI_VERSION_01, // KQ1 and multilingual games (S.old.*)
SCI_VERSION_1_EGA_ONLY, // SCI 1 EGA with parser (i.e. QFG2 only)
SCI_VERSION_1_EARLY, // KQ5 floppy, SQ4 floppy, XMAS card 1990, Fairy tales, Jones floppy
SCI_VERSION_1_MIDDLE, // LSL1, Jones CD
SCI_VERSION_1_MIDDLE, // LSL1, Jones CD, LSL3 & SQ3 multilingual Amiga
SCI_VERSION_1_LATE, // Dr. Brain 1, EcoQuest 1, Longbow, PQ3, SQ1, LSL5, KQ5 CD
SCI_VERSION_1_1, // Dr. Brain 2, EcoQuest 1 CD, EcoQuest 2, KQ6, QFG3, SQ4CD, XMAS 1992 and many more
SCI_VERSION_2, // GK1, PQ4 floppy, QFG4 floppy
Expand Down Expand Up @@ -283,6 +283,7 @@ class SciEngine : public Engine {
/** Returns true if the game's original platform is big-endian. */
bool isBE() const;

bool hasParser() const;
bool hasMacIconBar() const;

inline ResourceManager *getResMan() const { return _resMan; }
Expand Down

0 comments on commit bc2ab79

Please sign in to comment.