aboutsummaryrefslogtreecommitdiff
path: root/engines/mortevielle
diff options
context:
space:
mode:
authorThierry Crozat2013-08-03 16:45:05 +0100
committerThierry Crozat2013-08-03 16:50:14 +0100
commit0a2e64b903a65e9ffcfc3f7f81eba708c774d0f2 (patch)
tree93ab2865cf717fe65fa479601063e7c825f76f5f /engines/mortevielle
parent178feb8e8bd46b0bb5222c7a4a09e6da91df9752 (diff)
downloadscummvm-rg350-0a2e64b903a65e9ffcfc3f7f81eba708c774d0f2.tar.gz
scummvm-rg350-0a2e64b903a65e9ffcfc3f7f81eba708c774d0f2.tar.bz2
scummvm-rg350-0a2e64b903a65e9ffcfc3f7f81eba708c774d0f2.zip
DEVTOOLS: Include English menu in mortevielle dat file
Diffstat (limited to 'engines/mortevielle')
-rw-r--r--engines/mortevielle/menu.cpp54
1 files changed, 48 insertions, 6 deletions
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