2017-05-26 05:24:38 +02:00
|
|
|
/* 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.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2017-07-12 21:17:55 +02:00
|
|
|
#include "common/debug.h"
|
|
|
|
|
2017-06-05 19:10:47 +02:00
|
|
|
#include "sludge/allfiles.h"
|
|
|
|
#include "sludge/newfatal.h"
|
|
|
|
#include "sludge/moreio.h"
|
|
|
|
#include "sludge/language.h"
|
|
|
|
#include "sludge/sludge.h"
|
2017-07-13 18:08:30 +02:00
|
|
|
#include "sludge/version.h"
|
2017-05-27 20:16:54 +02:00
|
|
|
|
2017-05-26 21:25:11 +02:00
|
|
|
namespace Sludge {
|
|
|
|
|
2017-07-12 23:20:46 +02:00
|
|
|
uint *languageTable;
|
2017-07-11 14:57:31 +02:00
|
|
|
Common::String *languageName;
|
2017-05-26 05:24:38 +02:00
|
|
|
settingsStruct gameSettings;
|
|
|
|
|
2017-05-27 20:16:54 +02:00
|
|
|
void makeLanguageTable(Common::File *table) {
|
2017-07-12 23:20:46 +02:00
|
|
|
languageTable = new uint[gameSettings.numLanguages + 1];
|
2017-05-29 08:02:59 +02:00
|
|
|
if (!checkNew(languageTable))
|
|
|
|
return;
|
2017-05-26 05:24:38 +02:00
|
|
|
|
2017-07-11 14:57:31 +02:00
|
|
|
languageName = new Common::String[gameSettings.numLanguages + 1];
|
2017-05-29 08:02:59 +02:00
|
|
|
if (!checkNew(languageName))
|
|
|
|
return;
|
2017-05-26 05:24:38 +02:00
|
|
|
|
2017-07-10 21:44:14 +02:00
|
|
|
for (uint i = 0; i <= gameSettings.numLanguages; i++) {
|
2017-05-30 09:59:56 +02:00
|
|
|
languageTable[i] = i ? table->readUint16BE() : 0;
|
2017-06-05 11:49:19 +02:00
|
|
|
debug(kSludgeDebugDataLoad, "languageTable %i: %i", i, languageTable[i]);
|
2017-07-11 14:57:31 +02:00
|
|
|
languageName[i].clear();
|
2017-05-26 05:24:38 +02:00
|
|
|
if (gameVersion >= VERSION(2, 0)) {
|
|
|
|
if (gameSettings.numLanguages) {
|
|
|
|
languageName[i] = readString(table);
|
2017-07-11 14:57:31 +02:00
|
|
|
debug(kSludgeDebugDataLoad, "languageName %i: %s\n", i, languageName[i].c_str());
|
2017-05-26 05:24:38 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int getLanguageForFileB() {
|
|
|
|
int indexNum = -1;
|
|
|
|
|
2017-07-10 21:44:14 +02:00
|
|
|
for (uint i = 0; i <= gameSettings.numLanguages; i++) {
|
2017-05-29 08:02:59 +02:00
|
|
|
if (languageTable[i] == gameSettings.languageID)
|
|
|
|
indexNum = i;
|
2017-05-26 05:24:38 +02:00
|
|
|
}
|
|
|
|
return indexNum;
|
|
|
|
}
|
2017-05-26 21:25:11 +02:00
|
|
|
|
|
|
|
} // End of namespace Sludge
|