diff options
author | Peter Kohaut | 2019-07-15 00:26:18 +0200 |
---|---|---|
committer | Peter Kohaut | 2019-07-16 21:56:33 +0200 |
commit | 39e4fdb98c27f97ffffcfba8b6579697a4c809d2 (patch) | |
tree | 0aed595ef6ef7f11a5116f91449d5572a34fac44 /engines/bladerunner/subtitles.h | |
parent | a767a6800d2f76b90b66d7c0dcb96c0514350721 (diff) | |
download | scummvm-rg350-39e4fdb98c27f97ffffcfba8b6579697a4c809d2.tar.gz scummvm-rg350-39e4fdb98c27f97ffffcfba8b6579697a4c809d2.tar.bz2 scummvm-rg350-39e4fdb98c27f97ffffcfba8b6579697a4c809d2.zip |
BLADERUNNER: Use ScummVM word wrapping algorithm
Diffstat (limited to 'engines/bladerunner/subtitles.h')
-rw-r--r-- | engines/bladerunner/subtitles.h | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/engines/bladerunner/subtitles.h b/engines/bladerunner/subtitles.h index eb45a35a3f..1de059b071 100644 --- a/engines/bladerunner/subtitles.h +++ b/engines/bladerunner/subtitles.h @@ -26,6 +26,7 @@ #include "bladerunner/bladerunner.h" #include "common/str.h" +#include "common/ustr.h" namespace Graphics { class Font; @@ -41,11 +42,10 @@ class Subtitles { // // Subtitles could be in 6 possible languages are EN_ANY, DE_DEU, FR_FRA, IT_ITA, RU_RUS, ES_ESP // with corresponding _vm->_languageCode values: "E", "G", "F", "I", "E", "S" (Russian version is built on top of English one) - static const int kMaxNumOfSubtitlesLines = 4; // At least one quote in the game requires 4 lines to be displayed correctly - static const int kStartFromSubtitleLineFromTop = 2; // Prefer drawing from this line (the top-most of available subtitle lines index is 0) by default - static const int kSubtitlesBottomYOffsetPx = 12; // In pixels. This is the bottom margin beneath the subtitles space - static const int kMaxWidthPerLineToAutoSplitThresholdPx = 610; // In pixels - static const int kMaxTextResourceEntries = 1 + 25; // Support in-game subs (1) and all possible VQAs (25) with spoken dialogue or translatable text + static const uint kPreferedLine = 2; // Prefer drawing from this line (the bottom-most of available subtitle lines index is 0) by default + static const int kMarginBottom = 12; // In pixels. This is the bottom margin beneath the subtitles space + static const int kTextMaxWidth = 610; // In pixels + static const int kMaxTextResourceEntries = 1 + 25; // Support in-game subs (1) and all possible VQAs (25) with spoken dialogue or translatable text static const char *SUBTITLES_FILENAME_PREFIXES[kMaxTextResourceEntries]; static const char *SUBTITLES_FONT_FILENAME_EXTERNAL; static const char *SUBTITLES_VERSION_TRENAME; @@ -72,29 +72,23 @@ class Subtitles { Graphics::Font *_font; bool _useUTF8; - bool _isVisible; - bool _forceShowWhenNoSpeech; - Common::String _currentSubtitleTextFull; - Common::String _subtitleLineQuote[kMaxNumOfSubtitlesLines]; - int _subtitleLineScreenY[kMaxNumOfSubtitlesLines]; - int _subtitleLineScreenX[kMaxNumOfSubtitlesLines]; - int _subtitleLineSplitAtCharIndex[kMaxNumOfSubtitlesLines]; - int _currentSubtitleLines; - bool _subtitlesQuoteChanged; + bool _isVisible; + bool _forceShowWhenNoSpeech; + Common::U32String _currentText; bool _gameSubsResourceEntriesFound[kMaxTextResourceEntries]; // false if a TRE file did not open successfully - bool _subtitlesSystemActive; // true if the whole subtitles subsystem should be disabled (due to missing required resources) + bool _isSystemActive; // true if the whole subtitles subsystem should be disabled (due to missing required resources) public: Subtitles(BladeRunnerEngine *vm); ~Subtitles(); - bool isSystemActive() const { return _subtitlesSystemActive; } + bool isSystemActive() const { return _isSystemActive; } void init(); SubtitlesInfo getSubtitlesInfo() const; - 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 + void loadInGameSubsText(int actorId, int speech_id); // get the text for actorId, quoteId (in-game subs) + void loadOuttakeSubsText(const Common::String &outtakesName, int frame); // get the text for this frame if any void setGameSubsText(Common::String dbgQuote, bool force); // for debugging - explicit set subs text bool show(); @@ -105,7 +99,6 @@ public: private: void draw(Graphics::Surface &s); - void calculatePosition(); int getIdxForSubsTreName(const Common::String &treName) const; |