diff options
author | antoniou79 | 2018-12-16 19:45:19 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2018-12-25 12:35:52 +0100 |
commit | c5da2df9e83298ad680cadec635d2a5cd223ffb7 (patch) | |
tree | b70450086025e9147f92c9db747859cb9eef2f35 | |
parent | 35e248f3f4a5ed45a9aa849fdee4b3b2ce643bd2 (diff) | |
download | scummvm-rg350-c5da2df9e83298ad680cadec635d2a5cd223ffb7.tar.gz scummvm-rg350-c5da2df9e83298ad680cadec635d2a5cd223ffb7.tar.bz2 scummvm-rg350-c5da2df9e83298ad680cadec635d2a5cd223ffb7.zip |
BLADERUNNER: Remove fallback to internal font
-rw-r--r-- | engines/bladerunner/font.cpp | 2 | ||||
-rw-r--r-- | engines/bladerunner/subtitles.cpp | 61 | ||||
-rw-r--r-- | engines/bladerunner/subtitles.h | 17 |
3 files changed, 14 insertions, 66 deletions
diff --git a/engines/bladerunner/font.cpp b/engines/bladerunner/font.cpp index 59cafe7068..0f0307b161 100644 --- a/engines/bladerunner/font.cpp +++ b/engines/bladerunner/font.cpp @@ -213,7 +213,7 @@ void Font::drawCharacter(const uint8 character, Graphics::Surface &surface, int // but that table get corrupted past the 176th entry. The image data glyph part of the FON file also only covers the 176 entries. // So the following if clause-check will return here if the width and height values are unnaturally big. // The bug only affects debug cases where all character glyph need to be displayed... - // ...or potential custom dialogue / translations that reference characters that are not within the range of Ascii values for the normal Latin characters. + // ...or potential custom dialogue / translations that reference characters that are not within the range of ASCII values for the normal Latin characters. if (width > 100 || height > 100) { return; } diff --git a/engines/bladerunner/subtitles.cpp b/engines/bladerunner/subtitles.cpp index 13eb3232fc..be236d2ec2 100644 --- a/engines/bladerunner/subtitles.cpp +++ b/engines/bladerunner/subtitles.cpp @@ -26,17 +26,14 @@ #include "bladerunner/font.h" #include "bladerunner/text_resource.h" #include "bladerunner/audio_speech.h" -#include "bladerunner/game_flags.h" // for Game_Flag_Query declaration (actually script.h, but this seems to be included in other source files instead) -#include "bladerunner/game_constants.h" // for EDS flags - for subtitle checkbox flag state #include "common/debug.h" -#include "common/util.h" namespace BladeRunner { /* * Optional support for subtitles * CHECK what happens in VQA where the audio plays separately (are the finales such VQAs ?) - * TODO Catch error for bad symbol in a quote (one that causes the font to crash) - this could happen with the corrupted internal font (TAHOMA18) -> font crash or bad font display / garbage character + * TODO? Catch error for bad symbol in a quote (one that causes the font to crash) - this could happen with the corrupted internal font (TAHOMA18) -> font crash or bad font display / garbage character * TODO? Use another escape sequence to progressively display text in a line (like in SCUMM games) <-- this could be very useful with very long lines - might also need an extra manual time or ticks parameter to determine when during the display of the first segment we should switch to the second. * TODO? A more advanced subtitles system * TODO: subtitles could be independent from sound playing (but should disappear when switching between UI screens) @@ -45,9 +42,8 @@ namespace BladeRunner { * TODO?: If the subtitle is the last one then extend its duration to another predefined delay. * TODO?: A system to auto-split a dialogue after some max characters per both lines to a new dialogue set (delete previous 2 lines, start a new one(s) with the rest of the quote). * - * DONE Minor fixes In internal font TAHOMA18 some letters like 'P' and 'o' and not rightly aligned in the font. also not good spacing with '-' and a few other chars - * Also seems that this particular font is corrupted! - * Create and Support proper external FON for subtitles. + * DONE Removed support for internal font TAHOMA18 - this particular font is corrupted! + * DONE Create and Support proper external FON for subtitles. * DONE split at new line character (priority over auto-split) * DONE auto-split a long line into two * DONE support the basic 2 line subtitles @@ -60,7 +56,6 @@ namespace BladeRunner { */ const Common::String Subtitles::SUBTITLES_FONT_FILENAME_EXTERNAL = "SUBTLS_E.FON"; -const Common::String Subtitles::SUBTITLES_FONT_FILENAME_INTERNAL = "TAHOMA18.FON"; /* * All entries need to have the language code appended (after a '_'). @@ -107,7 +102,6 @@ Subtitles::Subtitles(BladeRunnerEngine *vm) { _vqaSubsTextResourceEntries[i] = nullptr; } _subsFont = nullptr; - _subsBgFont = nullptr; reset(); } @@ -129,12 +123,6 @@ Subtitles::~Subtitles() { delete _subsFont; _subsFont = nullptr; } - // _subsBgFont is only used for the internal subtitles font case - if (_subsBgFont != nullptr) { - _subsBgFont->close(); - delete _subsBgFont; - _subsBgFont = nullptr; - } } // @@ -164,26 +152,11 @@ void Subtitles::init(void) { if (_subsFont ->open(SUBTITLES_FONT_FILENAME_EXTERNAL, 640, 480, -1, 0, 0)) { // Color setting does not seem to affect the TAHOMA fonts or does it affect the black outline since we give 0 here? _subsFont->setSpacing(-1, 0); _subsFontsLoaded = true; - _subsFontsExternal = true; - } else if (_subsFont ->open(SUBTITLES_FONT_FILENAME_INTERNAL, 640, 480, -1, 0, 0)) { - _subsFont->setSpacing(1, 0); - _subsFontsLoaded = true; - _subsFontsExternal = false; } else { - _subsFontsExternal = false; _subsFontsLoaded = false; } - if (!_subsFontsExternal) { - _subsBgFont = new Font(_vm); - if (_subsFontsLoaded && _subsBgFont ->open(SUBTITLES_FONT_FILENAME_INTERNAL, 640, 480, -1, 0, 0)) { // TODO dark color? --- color does not seem to affect the TAHOMA fonts or does it affect the black outline since we give 0 here? ?? - we should give the original color here. What is it for TAHOMA? - _subsBgFont ->setSpacing(1, 0); - _subsBgFont ->setBlackColor(); - } else { - _subsFontsLoaded = false; - } - } - //Done - Initializing/Loading Subtitles' Fonts + //Done - Initializing/Loading Subtitles Fonts // // calculate the Screen Y position of the subtitle lines // getTextHeight("") returns the maxHeight of the font glyphs regardless of the actual text parameter @@ -368,23 +341,8 @@ void Subtitles::draw(Graphics::Surface &s) { _subtitlesQuoteChanged = false; } - if (_subsFontsExternal) { - for (int i = 0; i < _currentSubtitleLines; ++i) { - _subsFont->draw(_subtitleLineQuote[i], s, _subtitleLineScreenX[i], _subtitleLineScreenY[i]); - } - } else { - // INTERNAL FONT. NEEDS HACK (_subsBgFont) FOR SHADOW EFFECT - for (int i = 0; i < _currentSubtitleLines; ++i) { - _subsBgFont->draw(_subtitleLineQuote[i], s, _subtitleLineScreenX[i], _subtitleLineScreenY[i] - 1); - _subsBgFont->draw(_subtitleLineQuote[i], s, _subtitleLineScreenX[i], _subtitleLineScreenY[i] + 1); - _subsBgFont->draw(_subtitleLineQuote[i], s, _subtitleLineScreenX[i] + 1, _subtitleLineScreenY[i] + 1); - _subsBgFont->draw(_subtitleLineQuote[i], s, _subtitleLineScreenX[i] + 1, _subtitleLineScreenY[i] - 1); - if (_subtitleLineScreenX[i] > 0) { - _subsBgFont->draw(_subtitleLineQuote[i], s, _subtitleLineScreenX[i] - 1, _subtitleLineScreenY[i] - 1); - _subsBgFont->draw(_subtitleLineQuote[i], s, _subtitleLineScreenX[i] - 1, _subtitleLineScreenY[i] + 1); - } - _subsFont->draw(_subtitleLineQuote[i], s, _subtitleLineScreenX[i], _subtitleLineScreenY[i]); - } + for (int i = 0; i < _currentSubtitleLines; ++i) { + _subsFont->draw(_subtitleLineQuote[i], s, _subtitleLineScreenX[i], _subtitleLineScreenY[i]); } } @@ -574,14 +532,7 @@ void Subtitles::reset() { _subsFont = nullptr; } - if (_subsBgFont != nullptr) { - _subsBgFont->close(); - delete _subsBgFont; - _subsBgFont = nullptr; - } - _subsFontsLoaded = false; - _subsFontsExternal = false; } } // End of namespace BladeRunner diff --git a/engines/bladerunner/subtitles.h b/engines/bladerunner/subtitles.h index 5c6f8029c9..5169ef5eb0 100644 --- a/engines/bladerunner/subtitles.h +++ b/engines/bladerunner/subtitles.h @@ -48,31 +48,28 @@ class Subtitles { // TODO Or just support the current _vm->_languageCode ? [current implementation] static const int kMaxNumOfSubtitlesLines = 3; static const int kMaxWidthPerLineToAutoSplitThresholdPx = 610; - static const int kMaxTextResourceEntries = 1 + 25; // Support in-game subs (1) and all possible VQAs (26) with spoken dialogue! + static const int kMaxTextResourceEntries = 1 + 25; // Support in-game subs (1) and all possible VQAs (25) with spoken dialogue! static const Common::String SUBTITLES_FILENAME_PREFIXES[kMaxTextResourceEntries]; static const Common::String SUBTITLES_FONT_FILENAME_EXTERNAL; - static const Common::String SUBTITLES_FONT_FILENAME_INTERNAL; BladeRunnerEngine *_vm; TextResource *_vqaSubsTextResourceEntries[kMaxTextResourceEntries]; Font *_subsFont; - Font *_subsBgFont; // needed for internal font to be used as a shadow effect and make subtitles more legible in certain situations - bool _isVisible; - Common::String _currentSubtitleTextFull; - Common::String _subtitleLineQuote[kMaxNumOfSubtitlesLines]; + bool _isVisible; + Common::String _currentSubtitleTextFull; + Common::String _subtitleLineQuote[kMaxNumOfSubtitlesLines]; int _subtitleLineScreenY[kMaxNumOfSubtitlesLines]; int _subtitleLineScreenX[kMaxNumOfSubtitlesLines]; int _subtitleLineSplitAtCharIndex[kMaxNumOfSubtitlesLines]; int _currentSubtitleLines; bool _subtitlesQuoteChanged; - bool _gameSubsResourceEntriesFound[kMaxTextResourceEntries]; // false if a TRE file did not open successfully - bool _subsFontsExternal; // true if we are using the external font, false otherwise - bool _subsFontsLoaded; // false if external fonts and internal fonts (fore and background) did not load - bool _subtitlesSystemInactive; // true if the whole subtitles subsystem should be disabled (due to missing required resources) + bool _gameSubsResourceEntriesFound[kMaxTextResourceEntries]; // false if a TRE file did not open successfully + bool _subsFontsLoaded; // false if external fonts did not load + bool _subtitlesSystemInactive; // true if the whole subtitles subsystem should be disabled (due to missing required resources) public: Subtitles(BladeRunnerEngine *vm); |