mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-13 21:31:53 +00:00
Added a new LureLanguage enumeration of supported languages, and changed game code to use it
svn-id: r47019
This commit is contained in:
parent
c8f991e89b
commit
43f19bc722
@ -43,6 +43,19 @@ uint32 LureEngine::getFeatures() const { return _gameDescription->features; }
|
|||||||
Common::Language LureEngine::getLanguage() const { return _gameDescription->desc.language; }
|
Common::Language LureEngine::getLanguage() const { return _gameDescription->desc.language; }
|
||||||
Common::Platform LureEngine::getPlatform() const { return _gameDescription->desc.platform; }
|
Common::Platform LureEngine::getPlatform() const { return _gameDescription->desc.platform; }
|
||||||
|
|
||||||
|
LureLanguage LureEngine::getLureLanguage() const {
|
||||||
|
switch (_gameDescription->desc.language) {
|
||||||
|
case IT_ITA: return LANG_IT_ITA;
|
||||||
|
case FR_FRA: return LANG_FR_FRA;
|
||||||
|
case DE_DEU: return LANG_DE_DEU;
|
||||||
|
case ES_ESP: return LANG_ES_ESP;
|
||||||
|
case EN_ANY: return LANG_EN_ANY;
|
||||||
|
case UNK_LANG: return LANG_UNKNOWN;
|
||||||
|
default:
|
||||||
|
error("Unknown game language");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // End of namespace Lure
|
} // End of namespace Lure
|
||||||
|
|
||||||
static const PlainGameDescriptor lureGames[] = {
|
static const PlainGameDescriptor lureGames[] = {
|
||||||
|
@ -115,7 +115,7 @@ void Disk::openFile(uint8 fileNum) {
|
|||||||
error("The file %s is not a valid Lure support file", sFilename);
|
error("The file %s is not a valid Lure support file", sFilename);
|
||||||
|
|
||||||
// Scan for the correct language block
|
// Scan for the correct language block
|
||||||
Common::Language language = LureEngine::getReference().getLanguage();
|
LureLanguage language = LureEngine::getReference().getLureLanguage();
|
||||||
bool foundFlag = false;
|
bool foundFlag = false;
|
||||||
|
|
||||||
while (!foundFlag) {
|
while (!foundFlag) {
|
||||||
@ -123,7 +123,7 @@ void Disk::openFile(uint8 fileNum) {
|
|||||||
if ((byte)buffer[0] == 0xff)
|
if ((byte)buffer[0] == 0xff)
|
||||||
error("Could not find language data in support file");
|
error("Could not find language data in support file");
|
||||||
|
|
||||||
if ((language == (Common::Language)buffer[0]) || (language == UNK_LANG)) {
|
if ((language == (LureLanguage)buffer[0]) || (language == LANG_UNKNOWN)) {
|
||||||
foundFlag = true;
|
foundFlag = true;
|
||||||
_dataOffset = READ_LE_UINT32(&buffer[1]);
|
_dataOffset = READ_LE_UINT32(&buffer[1]);
|
||||||
_fileHandle->seek(_dataOffset);
|
_fileHandle->seek(_dataOffset);
|
||||||
|
@ -186,7 +186,7 @@ bool LureEngine::saveGame(uint8 slotNumber, Common::String &caption) {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
f->write("lure", 5);
|
f->write("lure", 5);
|
||||||
f->writeByte(getLanguage());
|
f->writeByte(getLureLanguage());
|
||||||
f->writeByte(LURE_SAVEGAME_MINOR);
|
f->writeByte(LURE_SAVEGAME_MINOR);
|
||||||
f->writeString(caption);
|
f->writeString(caption);
|
||||||
f->writeByte(0); // End of string terminator
|
f->writeByte(0); // End of string terminator
|
||||||
@ -221,7 +221,7 @@ bool LureEngine::loadGame(uint8 slotNumber) {
|
|||||||
// Check language version
|
// Check language version
|
||||||
uint8 language = f->readByte();
|
uint8 language = f->readByte();
|
||||||
_saveVersion = f->readByte();
|
_saveVersion = f->readByte();
|
||||||
if ((language != getLanguage()) || (_saveVersion < LURE_MIN_SAVEGAME_MINOR)) {
|
if ((language != getLureLanguage()) || (_saveVersion < LURE_MIN_SAVEGAME_MINOR)) {
|
||||||
warning("loadGame: Failed to load slot %d - incorrect version", slotNumber);
|
warning("loadGame: Failed to load slot %d - incorrect version", slotNumber);
|
||||||
delete f;
|
delete f;
|
||||||
return false;
|
return false;
|
||||||
@ -274,7 +274,7 @@ Common::String *LureEngine::detectSave(int slotNumber) {
|
|||||||
// Check language version
|
// Check language version
|
||||||
uint8 language = f->readByte();
|
uint8 language = f->readByte();
|
||||||
uint8 version = f->readByte();
|
uint8 version = f->readByte();
|
||||||
if ((language == getLanguage()) && (version >= LURE_MIN_SAVEGAME_MINOR)) {
|
if ((language == getLureLanguage()) && (version >= LURE_MIN_SAVEGAME_MINOR)) {
|
||||||
// Read in the savegame title
|
// Read in the savegame title
|
||||||
char saveName[MAX_DESC_SIZE];
|
char saveName[MAX_DESC_SIZE];
|
||||||
char *p = saveName;
|
char *p = saveName;
|
||||||
|
@ -54,6 +54,15 @@ namespace Lure {
|
|||||||
|
|
||||||
#define RandomNumberGen LureEngine::getReference().rnd()
|
#define RandomNumberGen LureEngine::getReference().rnd()
|
||||||
|
|
||||||
|
enum LureLanguage {
|
||||||
|
LANG_IT_ITA = 10,
|
||||||
|
LANG_FR_FRA = 6,
|
||||||
|
LANG_DE_DEU = 7,
|
||||||
|
LANG_ES_ESP = 17,
|
||||||
|
LANG_EN_ANY = 3,
|
||||||
|
LANG_UNKNOWN = -1
|
||||||
|
};
|
||||||
|
|
||||||
struct LureGameDescription;
|
struct LureGameDescription;
|
||||||
|
|
||||||
class LureEngine : public Engine {
|
class LureEngine : public Engine {
|
||||||
@ -107,6 +116,7 @@ public:
|
|||||||
void GUIError(const char *msg, ...) GCC_PRINTF(2, 3);
|
void GUIError(const char *msg, ...) GCC_PRINTF(2, 3);
|
||||||
|
|
||||||
uint32 getFeatures() const;
|
uint32 getFeatures() const;
|
||||||
|
LureLanguage getLureLanguage() const;
|
||||||
Common::Language getLanguage() const;
|
Common::Language getLanguage() const;
|
||||||
Common::Platform getPlatform() const;
|
Common::Platform getPlatform() const;
|
||||||
virtual GUI::Debugger *getDebugger();
|
virtual GUI::Debugger *getDebugger();
|
||||||
|
Loading…
Reference in New Issue
Block a user