From ea5af861282b0bc4081e033b3ba8212524289d49 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 1 Dec 2019 16:26:57 +0100 Subject: DIRECTOR: Make text fields assignable --- engines/director/cachedmactext.cpp | 1 + engines/director/cast.cpp | 8 +++++++- engines/director/cast.h | 2 ++ engines/director/lingo/lingo-code.cpp | 4 +++- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/engines/director/cachedmactext.cpp b/engines/director/cachedmactext.cpp index d9a0740f78..e152974911 100644 --- a/engines/director/cachedmactext.cpp +++ b/engines/director/cachedmactext.cpp @@ -34,6 +34,7 @@ void CachedMacText::makeMacText() { assert(_wm != NULL); delete _macText; + _macText = nullptr; if ((int)_textCast->_textAlign == -1) _align = (Graphics::TextAlign)3; diff --git a/engines/director/cast.cpp b/engines/director/cast.cpp index d864b50bfc..f01b4a17d9 100644 --- a/engines/director/cast.cpp +++ b/engines/director/cast.cpp @@ -217,7 +217,7 @@ void TextCast::importStxt(const Stxt *stxt) { _ftext = stxt->_ftext; } -void TextCast::importRTE(byte* text) { +void TextCast::importRTE(byte *text) { //assert(rteList.size() == 3); //child0 is probably font data. //child1 is the raw text. @@ -225,6 +225,12 @@ void TextCast::importRTE(byte* text) { //child2 is positional? } +void TextCast::setText(const char *text) { + _ftext = text; + + _cachedMacText->forceDirty(); +} + ShapeCast::ShapeCast(Common::ReadStreamEndian &stream, uint16 version) { if (version < 4) { /*byte flags = */ stream.readByte(); diff --git a/engines/director/cast.h b/engines/director/cast.h index 213cfbd1c9..7b3ed2701f 100644 --- a/engines/director/cast.h +++ b/engines/director/cast.h @@ -128,6 +128,8 @@ class TextCast : public Cast { public: TextCast(Common::ReadStreamEndian &stream, uint16 version = 2); + void setText(const char *text); + SizeType _borderSize; SizeType _gutterSize; SizeType _boxShadow; diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp index b2607edd55..ca9073e8d6 100644 --- a/engines/director/lingo/lingo-code.cpp +++ b/engines/director/lingo/lingo-code.cpp @@ -341,7 +341,9 @@ void Lingo::c_assign() { } } - warning("STUB: c_assing REFERENCE"); + d2.toString(); + + g_director->getCurrentScore()->_loadedText->getVal(d1.u.i)->setText(d2.u.s->c_str()); return; } -- cgit v1.2.3