From 4663ab2373ac3230ccb95cc2accee87ddd1682b8 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Sun, 1 Jul 2012 15:55:02 +0200 Subject: GOB: Fix some broken German text in Once Upon A Time --- engines/gob/pregob/onceupon/brokenstrings.h | 51 +++++++++++++++++++++++++++++ engines/gob/pregob/onceupon/onceupon.cpp | 18 ++++++++++ engines/gob/pregob/onceupon/onceupon.h | 3 ++ engines/gob/pregob/pregob.cpp | 5 +++ engines/gob/pregob/pregob.h | 2 ++ 5 files changed, 79 insertions(+) create mode 100644 engines/gob/pregob/onceupon/brokenstrings.h (limited to 'engines/gob/pregob') diff --git a/engines/gob/pregob/onceupon/brokenstrings.h b/engines/gob/pregob/onceupon/brokenstrings.h new file mode 100644 index 0000000000..86c0603058 --- /dev/null +++ b/engines/gob/pregob/onceupon/brokenstrings.h @@ -0,0 +1,51 @@ +/* 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. + * + */ + +#ifndef GOB_PREGOB_ONCEUPON_BROKENSTRINGS_H +#define GOB_PREGOB_ONCEUPON_BROKENSTRINGS_H + +struct BrokenString { + const char *wrong; + const char *correct; +}; + +struct BrokenStringLanguage { + const BrokenString *strings; + uint count; +}; + +static const BrokenString kBrokenStringsGerman[] = { + { "Zeichungen von Kaki," , "Zeichnungen von Kaki," }, + { "die es in seine Wachtr\204ume", "die es in seine Tagtr\204ume" }, + { " Spielerfahrung" , " Spielerfahren" }, + { " Fortgeschrittene" , " Fortgeschritten" } +}; + +static const BrokenStringLanguage kBrokenStrings[kLanguageCount] = { + { 0, 0 }, // French + { kBrokenStringsGerman, ARRAYSIZE(kBrokenStringsGerman) }, // German + { 0, 0 }, // English + { 0, 0 }, // Spanish + { 0, 0 }, // Italian +}; + +#endif // GOB_PREGOB_ONCEUPON_BROKENSTRINGS_H diff --git a/engines/gob/pregob/onceupon/onceupon.cpp b/engines/gob/pregob/onceupon/onceupon.cpp index c30421900f..c20ca2a45f 100644 --- a/engines/gob/pregob/onceupon/onceupon.cpp +++ b/engines/gob/pregob/onceupon/onceupon.cpp @@ -211,6 +211,24 @@ void OnceUpon::setGameCursor() { setCursor(cursor, 105, 0, 120, 15, 0, 0); } +void OnceUpon::fixTXTStrings(TXTFile &txt) const { + TXTFile::LineArray &lines = txt.getLines(); + for (uint i = 0; i < lines.size(); i++) + lines[i].text = fixString(lines[i].text); +} + +#include "gob/pregob/onceupon/brokenstrings.h" +Common::String OnceUpon::fixString(const Common::String &str) const { + const BrokenStringLanguage &broken = kBrokenStrings[_vm->_global->_language]; + + for (uint i = 0; i < broken.count; i++) { + if (str == broken.strings[i].wrong) + return broken.strings[i].correct; + } + + return str; +} + enum CopyProtectionState { kCPStateSetup, // Set up the screen kCPStateWaitUser, // Waiting for the user to pick a shape diff --git a/engines/gob/pregob/onceupon/onceupon.h b/engines/gob/pregob/onceupon/onceupon.h index 9ad563903e..efc2710d67 100644 --- a/engines/gob/pregob/onceupon/onceupon.h +++ b/engines/gob/pregob/onceupon/onceupon.h @@ -88,6 +88,9 @@ protected: void setGamePalette(uint palette); void setGameCursor(); + Common::String fixString(const Common::String &str) const; + void fixTXTStrings(TXTFile &txt) const; + bool doCopyProtection(const uint8 colors[7], const uint8 shapes[7 * 20], const uint8 obfuscate[4]); void showWait(uint palette = 0xFFFF); ///< Show the wait / loading screen. diff --git a/engines/gob/pregob/pregob.cpp b/engines/gob/pregob/pregob.cpp index 9c6cfb717a..f94f990f76 100644 --- a/engines/gob/pregob/pregob.cpp +++ b/engines/gob/pregob/pregob.cpp @@ -256,7 +256,12 @@ TXTFile *PreGob::loadTXT(const Common::String &txtFile, TXTFile::Format format) delete txtStream; + fixTXTStrings(*txt); + return txt; } +void PreGob::fixTXTStrings(TXTFile &txt) const { +} + } // End of namespace Gob diff --git a/engines/gob/pregob/pregob.h b/engines/gob/pregob/pregob.h index b91758876e..0a40ed6242 100644 --- a/engines/gob/pregob/pregob.h +++ b/engines/gob/pregob/pregob.h @@ -93,6 +93,8 @@ protected: Common::String getLocFile(const Common::String &file) const; TXTFile *loadTXT(const Common::String &txtFile, TXTFile::Format format) const; + virtual void fixTXTStrings(TXTFile &txt) const; + GobEngine *_vm; -- cgit v1.2.3