From c255de107d3dc57e210857a7bf34847e36f3dc0c Mon Sep 17 00:00:00 2001 From: Andrei Prykhodko Date: Sun, 5 Aug 2018 22:08:54 +0300 Subject: PINK: implemented text drawing in ActionText for English version --- engines/pink/objects/actions/action_text.cpp | 9 ++++++++- engines/pink/pink.h | 1 + engines/pink/resource_mgr.cpp | 8 -------- engines/pink/resource_mgr.h | 2 -- 4 files changed, 9 insertions(+), 11 deletions(-) (limited to 'engines/pink') diff --git a/engines/pink/objects/actions/action_text.cpp b/engines/pink/objects/actions/action_text.cpp index 174ad8c65f..ea7d486327 100644 --- a/engines/pink/objects/actions/action_text.cpp +++ b/engines/pink/objects/actions/action_text.cpp @@ -77,6 +77,11 @@ void ActionText::start() { findColorsInPalette(); Director *director = _actor->getPage()->getGame()->getDirector(); Graphics::TextAlign align = _centered ? Graphics::kTextAlignCenter : Graphics::kTextAlignLeft; + Common::SeekableReadStream *stream = _actor->getPage()->getResourceStream(_fileName); + + char *str = new char[stream->size()]; + stream->read(str, stream->size()); + delete stream; if (_scrollBar) { Graphics::MacFont *font = new Graphics::MacFont; @@ -85,10 +90,12 @@ void ActionText::start() { _txtWnd->move(_xLeft, _yTop); _txtWnd->resize(_xRight - _xLeft, _yBottom - _yTop); - _txtWnd->appendText("Testing ActionText", font); + if (_actor->getPage()->getGame()->getGameDesc().language == Common::EN_ANY) + _txtWnd->appendText(str, font); } else { director->addTextAction(this); } + delete[] str; } void ActionText::end() { diff --git a/engines/pink/pink.h b/engines/pink/pink.h index b46d4f07b4..bafe15f6c5 100644 --- a/engines/pink/pink.h +++ b/engines/pink/pink.h @@ -115,6 +115,7 @@ public: void executeMenuCommand(uint id); + const ADGameDescription &getGameDesc() { return _desc; } OrbFile *getOrb() { return &_orb; } BroFile *getBro() { return _bro; } Common::RandomSource &getRnd() { return _rnd; }; diff --git a/engines/pink/resource_mgr.cpp b/engines/pink/resource_mgr.cpp index 52f92839d6..dbbfd01e63 100644 --- a/engines/pink/resource_mgr.cpp +++ b/engines/pink/resource_mgr.cpp @@ -55,14 +55,6 @@ void ResourceMgr::clear() { _resDescTable = nullptr; } -Common::String ResourceMgr::loadText(Common::String &name) { - Common::SeekableReadStream *stream = getResourceStream(name); - char *txt = new char[stream->size()]; - Common::String str(txt, stream->size()); - delete [] txt; - return str; -} - static int resDescComp(const void *a, const void *b) { return scumm_stricmp((const char *)a, (const char *)b); } diff --git a/engines/pink/resource_mgr.h b/engines/pink/resource_mgr.h index 7cfd2fb65e..9f199f8ca9 100644 --- a/engines/pink/resource_mgr.h +++ b/engines/pink/resource_mgr.h @@ -52,8 +52,6 @@ public: Common::SafeSeekableSubReadStream *getResourceStream(const Common::String &name); - Common::String loadText(Common::String &name); - PinkEngine *getGame() const { return _game; } private: -- cgit v1.2.3