diff options
author | Eugene Sandulenko | 2019-10-19 17:44:05 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2019-10-19 17:44:05 +0200 |
commit | 30c11071c4abc13383db399ad42a4fb367edfc48 (patch) | |
tree | 0be58e44d26070cd14f9d38dd4ffaf9fa905ba6c /engines/pink | |
parent | 2d1dc5d1c4a2de31e925ecff45e177ff1c6a7f7c (diff) | |
download | scummvm-rg350-30c11071c4abc13383db399ad42a4fb367edfc48.tar.gz scummvm-rg350-30c11071c4abc13383db399ad42a4fb367edfc48.tar.bz2 scummvm-rg350-30c11071c4abc13383db399ad42a4fb367edfc48.zip |
PINK: Enable text rendering for localized versions
Diffstat (limited to 'engines/pink')
-rw-r--r-- | engines/pink/objects/actions/action_text.cpp | 30 | ||||
-rw-r--r-- | engines/pink/objects/actions/action_text.h | 1 |
2 files changed, 23 insertions, 8 deletions
diff --git a/engines/pink/objects/actions/action_text.cpp b/engines/pink/objects/actions/action_text.cpp index 4ee9cf634f..70aef5b95e 100644 --- a/engines/pink/objects/actions/action_text.cpp +++ b/engines/pink/objects/actions/action_text.cpp @@ -91,6 +91,22 @@ void ActionText::start() { stream->read(str, stream->size()); delete stream; + switch(_actor->getPage()->getGame()->getLanguage()) { + case Common::RU_RUS: + _text = Common::String(str).decode(Common::kWindows1251); + break; + + case Common::EN_ANY: + default: + _text = Common::String(str); + break; + } + + delete[] str; + + while ( _text.size() > 0 && (_text[ _text.size() - 1 ] == '\n' || _text[ _text.size() - 1 ] == '\r') ) + _text.deleteLastChar(); + if (_scrollBar) { Graphics::MacFont *font = new Graphics::MacFont; _txtWnd = director->getWndManager().addTextWindow(font, _textColorIndex, _backgroundColorIndex, @@ -114,12 +130,11 @@ void ActionText::start() { Graphics::TransparentSurface *noborder2 = new Graphics::TransparentSurface(*noborder, true); _txtWnd->setBorder(noborder2, false); - if (_actor->getPage()->getGame()->getLanguage() == Common::EN_ANY) - _txtWnd->appendText(str, font); + _txtWnd->appendText(_text, font); + } else { director->addTextAction(this); } - delete[] str; } void ActionText::end() { @@ -134,12 +149,11 @@ void ActionText::end() { void ActionText::draw(Graphics::ManagedSurface *surface) { // not working - /*Graphics::TextAlign alignment = _centered ? Graphics::kTextAlignCenter : Graphics::kTextAlignLeft; - Graphics::MacFont *font = new Graphics::MacFont; + Graphics::TextAlign alignment = _centered ? Graphics::kTextAlignCenter : Graphics::kTextAlignLeft; + Graphics::MacFont *font = new Graphics::MacFont(); Director *director = _actor->getPage()->getGame()->getDirector(); - Graphics::MacText text("", &director->getWndManager(), font, _textColorIndex, _backgroundColorIndex, _xRight - _xLeft, alignment); - text.appendText("TESTING", font->getId(), font->getSize(), font->getSlant(), 0); - text.draw(surface, _xLeft, _yTop, _xRight - _xLeft, _yBottom - _yTop, 0, 0);*/ + Graphics::MacText text(_text, &director->getWndManager(), font, _textColorIndex, _backgroundColorIndex, _xRight - _xLeft, alignment); + text.draw(surface, 0, 0, _xRight - _xLeft, _yBottom - _yTop, _xLeft, _yTop); } #define RED(rgb) ((rgb) & 0xFF) diff --git a/engines/pink/objects/actions/action_text.h b/engines/pink/objects/actions/action_text.h index 6a3a96642d..0b6e78c011 100644 --- a/engines/pink/objects/actions/action_text.h +++ b/engines/pink/objects/actions/action_text.h @@ -52,6 +52,7 @@ private: private: Common::String _fileName; + Common::U32String _text; Graphics::MacTextWindow *_txtWnd; uint32 _xLeft; |