aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra/graphics
diff options
context:
space:
mode:
authorathrxx2019-03-24 17:39:55 +0100
committerathrxx2019-04-13 18:54:59 +0200
commit5462d42363bf6f0e84aa0ecbb12b0dc8941acadb (patch)
tree7b136b23b4fc490098b35b95ee4edf8f166ce05f /engines/kyra/graphics
parent463cf48e2a16e0056922b06a741ee477e7078de2 (diff)
downloadscummvm-rg350-5462d42363bf6f0e84aa0ecbb12b0dc8941acadb.tar.gz
scummvm-rg350-5462d42363bf6f0e84aa0ecbb12b0dc8941acadb.tar.bz2
scummvm-rg350-5462d42363bf6f0e84aa0ecbb12b0dc8941acadb.zip
KYRA: (EOB2/Amiga) - improve font file warnings
- add warning for wrong font file: The German version of EOB II has a font file with more characters than the English version or the EOB I fonts. Users now get a warning/instruction if they have the wrong file. - add translation support for all AmigaDOS font related warnings/errors
Diffstat (limited to 'engines/kyra/graphics')
-rw-r--r--engines/kyra/graphics/screen.cpp2
-rw-r--r--engines/kyra/graphics/screen.h8
-rw-r--r--engines/kyra/graphics/screen_eob.cpp43
3 files changed, 43 insertions, 10 deletions
diff --git a/engines/kyra/graphics/screen.cpp b/engines/kyra/graphics/screen.cpp
index 5717319b7f..ea0871f317 100644
--- a/engines/kyra/graphics/screen.cpp
+++ b/engines/kyra/graphics/screen.cpp
@@ -1365,7 +1365,7 @@ bool Screen::loadFont(FontId fontId, const char *filename) {
fnt = new AMIGAFont();
#ifdef ENABLE_EOB
else if (_isAmiga)
- fnt = new AmigaDOSFont(_vm->resource());
+ fnt = new AmigaDOSFont(_vm->resource(), _vm->game() == GI_EOB2 && _vm->gameFlags().lang == Common::DE_DEU);
else if (_vm->game() == GI_EOB1 || _vm->game() == GI_EOB2)
// We use normal VGA rendering in EOB II, since we do the complete EGA dithering in updateScreen().
fnt = new OldDOSFont(_useHiResEGADithering ? Common::kRenderVGA : _renderMode);
diff --git a/engines/kyra/graphics/screen.h b/engines/kyra/graphics/screen.h
index 5a746a0956..b6706cd14f 100644
--- a/engines/kyra/graphics/screen.h
+++ b/engines/kyra/graphics/screen.h
@@ -187,7 +187,7 @@ private:
class Resource;
class AmigaDOSFont : public Font {
public:
- AmigaDOSFont(Resource *res);
+ AmigaDOSFont(Resource *res, bool needsLocalizedFont = false);
~AmigaDOSFont() { unload(); }
bool load(Common::SeekableReadStream &file);
@@ -197,6 +197,8 @@ public:
void setColorMap(const uint8 *src) { _colorMap = src; }
void drawChar(uint16 c, byte *dst, int pitch, int) const;
+ static void errorDialog(int index);
+
private:
void unload();
@@ -242,8 +244,10 @@ private:
uint16 _selectedElement;
const uint8 *_colorMap;
-
const uint16 _maxPathLen;
+ const bool _needsLocalizedFont;
+
+ static uint8 _errorDialogDisplayed;
Resource *_res;
};
diff --git a/engines/kyra/graphics/screen_eob.cpp b/engines/kyra/graphics/screen_eob.cpp
index 33f4bab131..b3c0393e8a 100644
--- a/engines/kyra/graphics/screen_eob.cpp
+++ b/engines/kyra/graphics/screen_eob.cpp
@@ -31,6 +31,7 @@
#include "kyra/resource/resource.h"
#include "common/system.h"
+#include "common/translation.h"
#include "graphics/cursorman.h"
#include "graphics/palette.h"
@@ -1975,7 +1976,7 @@ void OldDOSFont::unload() {
_bitmapOffsets = 0;
}
-AmigaDOSFont::AmigaDOSFont(Resource *res) : _res(res), _width(0), _height(0), _first(0), _last(0), _content(0), _numElements(0), _selectedElement(0), _maxPathLen(256) {
+AmigaDOSFont::AmigaDOSFont(Resource *res, bool needsLocalizedFont) : _res(res), _needsLocalizedFont(needsLocalizedFont), _width(0), _height(0), _first(0), _last(0), _content(0), _numElements(0), _selectedElement(0), _maxPathLen(256) {
assert(_res);
}
@@ -2078,6 +2079,35 @@ void AmigaDOSFont::drawChar(uint16 c, byte *dst, int pitch, int) const {
}
}
+uint8 AmigaDOSFont::_errorDialogDisplayed = 0;
+
+void AmigaDOSFont::errorDialog(int index) {
+ if (_errorDialogDisplayed & (1 << index))
+ return;
+ _errorDialogDisplayed |= (1 << index);
+
+ // I've made rather elaborate dialogs here, since the Amiga font file handling is quite prone to cause problems for users.
+ // This will hopefully prevent unnecessary forum posts and bug reports.
+ if (index == 0) {
+ ::GUI::displayErrorDialog(_s(
+ "This AMIGA version requires the following font files:\n\nEOBF6.FONT\nEOBF6/6\nEOBF8.FONT\nEOBF8/8\n\n"
+ "If you used the orginal installer for the installation these files\nshould be located in the AmigaDOS system 'Fonts/' folder.\n"
+ "Please copy them into the EOB game data directory.\n"
+ ));
+
+ error("Failed to load font files.");
+ } else if (index == 1) {
+ ::GUI::displayErrorDialog(_s(
+ "This AMIGA version requires the following font files:\n\nEOBF6.FONT\nEOBF6/6\nEOBF8.FONT\nEOBF8/8\n\n"
+ "This is a localized (non-English) version of EOB II which uses language specific characters\n"
+ "contained only in the specific font files that came with your game. You cannot use the font\n"
+ "files from the English version or from any EOB I game which seems to be what you are doing.\n\n"
+ "The game will continue, but the language specific characters will not be displayed.\n"
+ "Please copy the correct font files into your EOB II game data directory.\n\n"
+ ));
+ }
+}
+
void AmigaDOSFont::unload() {
delete[] _content;
}
@@ -2105,12 +2135,8 @@ AmigaDOSFont::TextFont *AmigaDOSFont::loadContentFile(const Common::String fileN
str = _res->createEndianAwareReadStream(fileNameAlt);
}
- if (!str) {
- ::GUI::displayErrorDialog("This AMIGA version requires the following font files:\n\nEOBF6.FONT\nEOBF6/6\nEOBF8.FONT\nEOBF8/8\n\n"
- "If you used the orginal installer for the installation these files\nshould be located in the AmigaDOS system 'Fonts/' folder.\n"
- "Please copy them into the EOB game data directory.\n");
- error("Failed to load font files.");
- }
+ if (!str)
+ errorDialog(0);
}
uint32 hunkId = str->readUint32();
@@ -2137,6 +2163,9 @@ AmigaDOSFont::TextFont *AmigaDOSFont::loadContentFile(const Common::String fileN
fnt->firstChar = str->readByte();
fnt->lastChar = str->readByte();
+ if (_needsLocalizedFont && fnt->lastChar <= 127)
+ errorDialog(1);
+
str->seek(18, SEEK_CUR);
int32 curPos = str->pos();
uint32 bufferSize = dataSize - (curPos - fntStartPos);