XEEN: Fix crash on startup loading xeen.ccs data

This commit is contained in:
Paul Gilbert 2021-10-11 20:34:05 -07:00
parent fd12f18c57
commit 0cf71cccea
3 changed files with 11 additions and 5 deletions

View file

@ -11,6 +11,9 @@ For a more comprehensive changelog of the latest experimental code, see:
- Fixed black screen while entering save game name.
- OpenGL without shaders is preferred as default for Grim Fandango.
Xeen:
- Fix crash on startup loading constants from xeen.ccs
#### 2.5.0 "Twenty years ago today..." (2021-10-09)
New games:

View file

@ -1310,7 +1310,7 @@ void LangConstants::writeConstants(Common::String num, CCArchive &cc) {
void writeConstants(CCArchive &cc) {
EN eng;
eng.writeConstants(Common::String::format("_%i", Common::EN_ANY), cc);
eng.writeConstants(Common::String::format("_%i", 7 /*Common::EN_ANY */), cc);
RU ru;
ru.writeConstants(Common::String::format("_%i", Common::RU_RUS), cc);
ru.writeConstants(Common::String::format("_%i", 26 /* Common::RU_RUS */), cc);
}

View file

@ -60,8 +60,11 @@ Resources::Resources() {
}
void Resources::loadData() {
Common::Language lang = g_vm->getLanguage();
ResFile file("CONSTANTS_", _buffer, lang);
int langId = 7; // English
if (g_vm->getLanguage() == Common::RU_RUS)
langId = 26;
ResFile file("CONSTANTS_", _buffer, langId);
file.syncString(CLOUDS_CREDITS);
file.syncString(DARK_SIDE_CREDITS);
file.syncString(SWORDS_CREDITS1);
@ -425,7 +428,7 @@ void Resources::loadData() {
file.syncStrings(CLOUDS_MONSTERS, 91);
file.syncStrings(CLOUDS_SPELLS, 77);
ResFile keys("CONSTKEYS_", _buffer, lang);
ResFile keys("CONSTKEYS_", _buffer, langId);
keys.syncNumber(KeyConstants.DialogsCharInfo.KEY_ITEM);
keys.syncNumber(KeyConstants.DialogsCharInfo.KEY_QUICK);
keys.syncNumber(KeyConstants.DialogsCharInfo.KEY_EXCHANGE);