diff options
author | Thierry Crozat | 2013-08-03 16:45:05 +0100 |
---|---|---|
committer | Thierry Crozat | 2013-08-03 16:50:14 +0100 |
commit | 0a2e64b903a65e9ffcfc3f7f81eba708c774d0f2 (patch) | |
tree | 93ab2865cf717fe65fa479601063e7c825f76f5f | |
parent | 178feb8e8bd46b0bb5222c7a4a09e6da91df9752 (diff) | |
download | scummvm-rg350-0a2e64b903a65e9ffcfc3f7f81eba708c774d0f2.tar.gz scummvm-rg350-0a2e64b903a65e9ffcfc3f7f81eba708c774d0f2.tar.bz2 scummvm-rg350-0a2e64b903a65e9ffcfc3f7f81eba708c774d0f2.zip |
DEVTOOLS: Include English menu in mortevielle dat file
-rw-r--r-- | devtools/create_mortdat/create_mortdat.cpp | 27 | ||||
-rw-r--r-- | devtools/create_mortdat/menudata.h | 79 | ||||
-rw-r--r-- | dists/engine-data/mort.dat | bin | 75737 -> 75887 bytes | |||
-rw-r--r-- | engines/mortevielle/menu.cpp | 54 |
4 files changed, 154 insertions, 6 deletions
diff --git a/devtools/create_mortdat/create_mortdat.cpp b/devtools/create_mortdat/create_mortdat.cpp index 653a0754eb..93ca721d95 100644 --- a/devtools/create_mortdat/create_mortdat.cpp +++ b/devtools/create_mortdat/create_mortdat.cpp @@ -41,6 +41,7 @@ #include "create_mortdat.h" #include "enginetext.h" #include "gametext.h" +#include "menudata.h" bool File::open(const char *filename, AccessMode mode) { @@ -200,10 +201,36 @@ void writeGameStrings() { writeStaticStrings(gameDataDe, kGameStrings, 2); } +/** + * Write out the data for the English menu + */ +void writeMenuBlock() { + // Write out a section header to the output file and the font data + const char menuHeader[4] = { 'M', 'E', 'N', 'U' }; + outputFile.write(menuHeader, 4); // Section Id + outputFile.writeWord(strlen(menuDataEn) / 8); // Section size + // Write each 8-characters block as a byte (one bit per character) + // ' ' -> 0, anything else -> 1 + byte value; + int valueCpt = 0; + const char* str = menuDataEn; + while (*str != 0) { + if (*(str++) != ' ') + value |= (1 << (7 - valueCpt)); + ++valueCpt; + if (valueCpt == 8) { + outputFile.writeByte(value); + value = 0; + valueCpt = 0; + } + } +} + void process() { writeFontBlock(); writeGameStrings(); writeEngineStrings(); + writeMenuBlock(); } /** diff --git a/devtools/create_mortdat/menudata.h b/devtools/create_mortdat/menudata.h new file mode 100644 index 0000000000..aa4557b336 --- /dev/null +++ b/devtools/create_mortdat/menudata.h @@ -0,0 +1,79 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * This is a utility for extracting needed resource data from different language + * version of the Mortevielle executable files into a new file mort.dat - this + * is required for the ScummVM Mortevielle module to work properly + */ + +#ifndef MENUDATA_H +#define MENUDATA_H + +const char *menuDataEn = + " @@@ " + " @ " + " @ @ @@ @@@ @@@ " + " @ @ @ @ @ " + " @ @ @ @ @ " + " @ @ @ @ @ " + "@@@ @@@ @@ @@ " + " " + " @@ @@ " + " @@ @ @ " + " @ @ @ @ @@@ @@@ @@@" + " @ @ @ @ @ @ @ " + " @ @ @ @ @ @ " + " @ @ @ @ @ @ " + "@@@ @@@ @@@@ @@ " + " " + " @ @ " + " @@ @ " + " @ @ @@@@ @@@@ " + " @ @ @ @ @ " + " @@@@@ @ @ " + " @ @ @ @ @ " + "@@@ @@@ @@@ @@ " + " " + " @@@@@ @@@ @@@" + " @ @ @ @ @" + " @ @@@ @ @ " + " @@@@ @ @ @ @@@ " + " @ @@@@@ @ @ " + " @ @ @ @ @ " + "@@@@@@ @@@ @@@ @@@ " + " " + "@@@@@@@ @@@ @@@ " + "@ @ @ @ @ " + " @ @@@@ @ @ @@" + " @ @ @ @ @@ @ " + " @ @ @ @ @ @@ " + " @ @ @ @ @ @ " + "@@@ @@@@ @@@ @@@ @@@" + " " + " @@@@@@@ @ @@@ " + " @ @ @ " + " @ @ @@ @ @@@ " + " @@@@ @ @ @ @" + " @ @ @ @ @@@@@ " + " @ @ @ @ " + "@@@ @@@ @@@ @@@ " + " "; + +#endif diff --git a/dists/engine-data/mort.dat b/dists/engine-data/mort.dat Binary files differindex fca30ab238..466c491a25 100644 --- a/dists/engine-data/mort.dat +++ b/dists/engine-data/mort.dat diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index f86fd208c1..aa8d67e98a 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -491,14 +491,56 @@ void Menu::initMenu(MortevielleEngine *vm) { int i; Common::File f; + + bool enMenuLoaded = false; + if (_vm->getLanguage() == Common::EN_ANY) { + // Open the mort.dat file + if (!f.open(MORT_DAT)) + warning("File %s not found. Using default menu from game data", MORT_DAT); + else { + // Validate the data file header + char fileId[4]; + f.read(fileId, 4); + // Do not display warnings here. They would already have been displayed in MortevielleEngine::loadMortDat(). + if (strncmp(fileId, "MORT", 4) == 0 && f.readByte() >= MORT_DAT_REQUIRED_VERSION) { + f.readByte(); // Minor version + // Loop to load resources from the data file + while (f.pos() < f.size()) { + // Get the Id and size of the next resource + char dataType[4]; + int dataSize; + f.read(dataType, 4); + dataSize = f.readUint16LE(); + if (!strncmp(dataType, "MENU", 4)) { + // MENU section + if (dataSize <= 7 * 24) { + f.read(_charArr, dataSize); + enMenuLoaded = true; + } else + warning("Wrong size %d for menu data. Expected %d or less", dataSize, 7*24); + break; + } else { + // Other sections + f.skip(dataSize); + } + } + } + // Close the file + f.close(); + if (!enMenuLoaded) + warning("Failed to load English menu. Will use default menu from game data instead"); + } + } - if (!f.open("menufr.mor")) - if (!f.open("menual.mor")) - if (!f.open("menu.mor")) - error("Missing file - menufr.mor or menual.mor or menu.mor"); + if (!enMenuLoaded) { + if (!f.open("menufr.mor")) + if (!f.open("menual.mor")) + if (!f.open("menu.mor")) + error("Missing file - menufr.mor or menual.mor or menu.mor"); - f.read(_charArr, 7 * 24); - f.close(); + f.read(_charArr, 7 * 24); + f.close(); + } // Skipped: dialog asking to swap floppy |