diff options
author | antoniou79 | 2018-08-01 20:41:36 +0300 |
---|---|---|
committer | Eugene Sandulenko | 2018-12-25 12:35:52 +0100 |
commit | 79ff97d5d92502936d9773be28980db6a862e19b (patch) | |
tree | e032423f3e93438ccf69fc08d535dd5abbcfc1f7 | |
parent | 2f28926f22cd954c3db3e725b280339cac2a7297 (diff) | |
download | scummvm-rg350-79ff97d5d92502936d9773be28980db6a862e19b.tar.gz scummvm-rg350-79ff97d5d92502936d9773be28980db6a862e19b.tar.bz2 scummvm-rg350-79ff97d5d92502936d9773be28980db6a862e19b.zip |
BLADERUNNER: switch clause in fonts and style fixes
-rw-r--r-- | engines/bladerunner/bladerunner.cpp | 2 | ||||
-rw-r--r-- | engines/bladerunner/font.cpp | 27 | ||||
-rw-r--r-- | engines/bladerunner/outtake.cpp | 2 | ||||
-rw-r--r-- | engines/bladerunner/subtitles.cpp | 87 | ||||
-rw-r--r-- | engines/bladerunner/subtitles.h | 2 |
5 files changed, 65 insertions, 55 deletions
diff --git a/engines/bladerunner/bladerunner.cpp b/engines/bladerunner/bladerunner.cpp index cb09ddfb1c..c5f8734806 100644 --- a/engines/bladerunner/bladerunner.cpp +++ b/engines/bladerunner/bladerunner.cpp @@ -684,7 +684,7 @@ void BladeRunnerEngine::shutdown() { } if(isArchiveOpen("SUBTITLES.MIX")) { - closeArchive("SUBTITLES.MIX"); + closeArchive("SUBTITLES.MIX"); } if (_subtitles) { delete _subtitles; diff --git a/engines/bladerunner/font.cpp b/engines/bladerunner/font.cpp index 535144f581..da8928757d 100644 --- a/engines/bladerunner/font.cpp +++ b/engines/bladerunner/font.cpp @@ -70,16 +70,27 @@ bool Font::open(const Common::String &fileName, int screenWidth, int screenHeigh _characters[i].dataOffset = stream->readUint32LE(); // special explicit alignment fixes for TAHOMA18 (INTERNAL) font if (fileName == "TAHOMA18.FON") { - // fix P -> i = 81 (ascii code 80 + 1) - if (i == 81 || i == 72 || i == 74 || i == 75 // P, G, I, J - || i == 46) { // '-' + switch (i) { + case 46: // '-' + case 72: // G + case 74: // I + case 75: // J _characters[i].x = 0; // original value was 1 - } - if (i == 81 // P - || i == 83 || i == 84 // R, S, - || i == 86 // U - || i == 87 || i == 88 || i == 89 || i == 90 || i == 91) { // V, W, X, Y ,Z + break; + case 81: // P (ascii code 80 + 1) + _characters[i].x = 0; // original value was 1 + _characters[i].y = 7; // original value was 6 -- bring them down for one (1) pixel + break; + case 83: // R + case 84: // S + case 86: // U + case 87: // V + case 88: // W + case 89: // X + case 90: // Y + case 91: // Z _characters[i].y = 7; // original value was 6 -- bring them down for one (1) pixel + break; } } //debug("char::%d character x: %d, y: %d, w: %d, h:%d, do: %d", i, _characters[i].x, _characters[i].y, _characters[i].width, _characters[i].height, _characters[i].dataOffset); diff --git a/engines/bladerunner/outtake.cpp b/engines/bladerunner/outtake.cpp index cbcc7fc0ec..231a660cdb 100644 --- a/engines/bladerunner/outtake.cpp +++ b/engines/bladerunner/outtake.cpp @@ -42,7 +42,7 @@ void OuttakePlayer::play(const Common::String &name, bool noLocalization, int co if (!noLocalization) { resName = resName + "_" + _vm->_languageCode; } - Common::String resNameNoVQASuffix = resName; + Common::String resNameNoVQASuffix = resName; resName = resName + ".VQA"; VQAPlayer vqa_player(_vm, &_vm->_surfaceBack); // surfaceBack is needed here for subtitles rendering properly, original was _surfaceFront here diff --git a/engines/bladerunner/subtitles.cpp b/engines/bladerunner/subtitles.cpp index 98283ef8f1..b61f54947d 100644 --- a/engines/bladerunner/subtitles.cpp +++ b/engines/bladerunner/subtitles.cpp @@ -134,7 +134,7 @@ Subtitles::~Subtitles() { delete _subsFont; _subsFont = nullptr; } - // _subsBgFont is only used for the internal subtitles font case + // _subsBgFont is only used for the internal subtitles font case if (_subsBgFont != nullptr) { _subsBgFont->close(); delete _subsBgFont; @@ -146,9 +146,9 @@ Subtitles::~Subtitles() { // Init is kept separated from constructor to allow not loading up resources if subtitles system is disabled // void Subtitles::init(void) { - if (_subtitlesSystemInactive) { - return; - } + if (_subtitlesSystemInactive) { + return; + } // // Loading text resources for (int i = 0; i < kMaxTextResourceEntries; i++) { @@ -180,13 +180,13 @@ void Subtitles::init(void) { } 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; - } + _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 // @@ -201,7 +201,7 @@ void Subtitles::init(void) { } void Subtitles::setSubtitlesSystemInactive(bool flag) { - _subtitlesSystemInactive = flag; + _subtitlesSystemInactive = flag; } /** @@ -226,9 +226,9 @@ int Subtitles::getIdxForSubsTreName(const Common::String &treName) const { * Returns the dialogue quote, but also sets the private _currentSubtitleTextFull member */ const char *Subtitles::getInGameSubsText(int actorId, int speech_id) { - if (_subtitlesSystemInactive) { - return ""; - } + if (_subtitlesSystemInactive) { + return ""; + } int32 id = 10000 * actorId + speech_id; if (!_gameSubsResourceEntriesFound[0]) { @@ -250,9 +250,9 @@ const char *Subtitles::getInGameSubsText(int actorId, int speech_id) { * Returns the dialogue quote, but also sets the private _currentSubtitleTextFull member */ const char *Subtitles::getOuttakeSubsText(const Common::String &outtakesName, int frame) { - if (_subtitlesSystemInactive) { - return ""; - } + if (_subtitlesSystemInactive) { + return ""; + } int fileIdx = getIdxForSubsTreName(outtakesName); if (fileIdx == -1 || !_gameSubsResourceEntriesFound[fileIdx]) { @@ -291,9 +291,9 @@ void Subtitles::setGameSubsText(Common::String dbgQuote) { * @return true if the member was set now, false if the member was already set */ bool Subtitles::show() { - if (_subtitlesSystemInactive) { - return false; - } + if (_subtitlesSystemInactive) { + return false; + } if (_isVisible) { return false; @@ -307,9 +307,9 @@ bool Subtitles::show() { * @return true if the member was cleared, false if it was already clear. */ bool Subtitles::hide() { - if (_subtitlesSystemInactive) { - return false; - } + if (_subtitlesSystemInactive) { + return false; + } if (!_isVisible) { return false; @@ -373,25 +373,24 @@ 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]); - } - } + 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]); + } + } } /** @@ -552,7 +551,7 @@ void Subtitles::reset() { _gameSubsResourceEntriesFound[i] = false; } - if (_subsFont != nullptr) { + if (_subsFont != nullptr) { _subsFont->close(); delete _subsFont; _subsFont = nullptr; diff --git a/engines/bladerunner/subtitles.h b/engines/bladerunner/subtitles.h index 97020f6b99..5c6f8029c9 100644 --- a/engines/bladerunner/subtitles.h +++ b/engines/bladerunner/subtitles.h @@ -79,7 +79,7 @@ public: ~Subtitles(); void init(); - void setSubtitlesSystemInactive(bool flag); // disable subtitles system (possibly due to missing important resources like SUBTITLES.MIX file) + void setSubtitlesSystemInactive(bool flag); // disable subtitles system (possibly due to missing important resources like SUBTITLES.MIX file) const char *getInGameSubsText(int actorId, int speech_id) ; // get the text for actorId, quoteId (in-game subs) const char *getOuttakeSubsText(const Common::String &outtakesName, int frame); // get the text for this frame if any |