[Scummvm-git-logs] scummvm master -> 54220962f2ce87b75866e1ef1f3da7ef8c4e66f8
npjg
nathanael.gentrydb8 at gmail.com
Sat Jun 13 00:29:56 UTC 2020
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
20dde1d917 GRAPHICS: MACGUI: Relocate colours to from MacText to MacWidget
97dd4c1961 DIRECTOR: Cache best fit cast colours
54220962f2 DIRECTOR: LINGO: Implement fore/back colour of text cast
Commit: 20dde1d917e5b17c6f79afa3bc4f3d3dcbd8583e
https://github.com/scummvm/scummvm/commit/20dde1d917e5b17c6f79afa3bc4f3d3dcbd8583e
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2020-06-12T20:29:50-04:00
Commit Message:
GRAPHICS: MACGUI: Relocate colours to from MacText to MacWidget
Changed paths:
graphics/macgui/mactext.h
graphics/macgui/macwidget.cpp
graphics/macgui/macwidget.h
diff --git a/graphics/macgui/mactext.h b/graphics/macgui/mactext.h
index 1d6505587c..eeff44f54d 100644
--- a/graphics/macgui/mactext.h
+++ b/graphics/macgui/mactext.h
@@ -240,6 +240,8 @@ public:
int _scrollPos;
+ bool _fullRefresh;
+
protected:
Common::Point _alignOffset;
@@ -247,7 +249,6 @@ protected:
Common::U32String _str;
const MacFont *_macFont;
- int _fgcolor, _bgcolor;
int _maxWidth;
int _interLinear;
@@ -257,7 +258,6 @@ protected:
int _textMaxHeight;
ManagedSurface *_surface;
- bool _fullRefresh;
TextAlign _textAlignment;
diff --git a/graphics/macgui/macwidget.cpp b/graphics/macgui/macwidget.cpp
index 09085bbf45..29fc2cba97 100644
--- a/graphics/macgui/macwidget.cpp
+++ b/graphics/macgui/macwidget.cpp
@@ -80,6 +80,13 @@ void MacWidget::blit(ManagedSurface *g, Common::Rect &dest) {
g->transBlitFrom(*_composeSurface, _composeSurface->getBounds(), dest, kColorGreen2);
}
+void MacWidget::setColors(int fg, int bg) {
+ _fgcolor = fg;
+ _bgcolor = bg;
+
+ _contentIsDirty = true;
+}
+
bool MacWidget::processEvent(Common::Event &event) {
return false;
}
diff --git a/graphics/macgui/macwidget.h b/graphics/macgui/macwidget.h
index e2e1cb41f5..0d49dbb7dc 100644
--- a/graphics/macgui/macwidget.h
+++ b/graphics/macgui/macwidget.h
@@ -69,6 +69,8 @@ public:
virtual bool hasAllFocus() { return _active; }
virtual bool isEditable() { return _editable; }
+ virtual void setColors(int fg, int bg);
+
virtual void setDimensions(const Common::Rect &r) {
_dims = r;
}
@@ -86,6 +88,8 @@ protected:
uint16 _gutter;
uint16 _shadow;
+ int _fgcolor, _bgcolor;
+
Graphics::ManagedSurface *_composeSurface;
Graphics::ManagedSurface *_maskSurface;
Commit: 97dd4c1961090ed9d56a18b086b3706cb9375e49
https://github.com/scummvm/scummvm/commit/97dd4c1961090ed9d56a18b086b3706cb9375e49
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2020-06-12T20:29:50-04:00
Commit Message:
DIRECTOR: Cache best fit cast colours
Changed paths:
engines/director/cast.cpp
engines/director/cast.h
diff --git a/engines/director/cast.cpp b/engines/director/cast.cpp
index 8d0df88e01..6f61d4b221 100644
--- a/engines/director/cast.cpp
+++ b/engines/director/cast.cpp
@@ -166,6 +166,9 @@ TextCast::TextCast(Common::ReadStreamEndian &stream, uint16 version, bool asButt
_boxShadow = kSizeNone;
_buttonType = kTypeButton;
+ _bgcolor = 0;
+ _fgcolor = 0;
+
_flags = 0;
_textFlags = 0;
_fontId = 0;
@@ -289,6 +292,8 @@ TextCast::TextCast(Common::ReadStreamEndian &stream, uint16 version, bool asButt
}
}
+ _bgcolor = g_director->_wm->findBestColor(_bgpalinfo1 & 0xff, _bgpalinfo2 & 0xff, _bgpalinfo3 & 0xff);
+
_modified = true;
}
@@ -304,14 +309,6 @@ Graphics::TextAlign TextCast::getAlignment() {
}
}
-uint TextCast::getForeColor() {
- return g_director->_wm->findBestColor(_fgpalinfo1 & 0xff, _fgpalinfo2 & 0xff, _fgpalinfo3 & 0xff);
-}
-
-uint TextCast::getBackColor() {
- return g_director->_wm->findBestColor(_bgpalinfo1 & 0xff, _bgpalinfo2 & 0xff, _bgpalinfo3 & 0xff);
-}
-
void TextCast::importStxt(const Stxt *stxt) {
_fontId = stxt->_fontId;
_textSlant = stxt->_textSlant;
@@ -321,6 +318,8 @@ void TextCast::importStxt(const Stxt *stxt) {
_fgpalinfo3 = stxt->_palinfo3;
_ftext = stxt->_ftext;
_ptext = stxt->_ptext;
+
+ _fgcolor = g_director->_wm->findBestColor(_fgpalinfo1 & 0xff, _fgpalinfo2 & 0xff, _fgpalinfo3 & 0xff);
}
void TextCast::createWidget() {
diff --git a/engines/director/cast.h b/engines/director/cast.h
index f9692f4d4a..f4391344b6 100644
--- a/engines/director/cast.h
+++ b/engines/director/cast.h
@@ -125,8 +125,8 @@ public:
virtual bool setEditable(bool editable) override;
Graphics::TextAlign getAlignment();
- uint getBackColor();
- uint getForeColor();
+ uint getBackColor() { return _bgcolor; }
+ uint getForeColor() { return _fgcolor; }
SizeType _borderSize;
SizeType _gutterSize;
@@ -150,6 +150,10 @@ public:
void importRTE(byte* text);
Common::String getText();
+
+private:
+ uint _bgcolor;
+ uint _fgcolor;
};
class ScriptCast : public Cast {
Commit: 54220962f2ce87b75866e1ef1f3da7ef8c4e66f8
https://github.com/scummvm/scummvm/commit/54220962f2ce87b75866e1ef1f3da7ef8c4e66f8
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2020-06-12T20:29:51-04:00
Commit Message:
DIRECTOR: LINGO: Implement fore/back colour of text cast
These lingo commands are just for text casts.
Changed paths:
engines/director/cast.cpp
engines/director/cast.h
engines/director/lingo/lingo-the.cpp
diff --git a/engines/director/cast.cpp b/engines/director/cast.cpp
index 6f61d4b221..feb7957c6c 100644
--- a/engines/director/cast.cpp
+++ b/engines/director/cast.cpp
@@ -297,6 +297,28 @@ TextCast::TextCast(Common::ReadStreamEndian &stream, uint16 version, bool asButt
_modified = true;
}
+void TextCast::setColors(int *fgcolor, int *bgcolor) {
+ if (!_widget)
+ return;
+
+ if (fgcolor)
+ _fgcolor = *fgcolor;
+
+ if (bgcolor)
+ _bgcolor = *bgcolor;
+
+ _widget->setColors(_fgcolor, _bgcolor);
+ ((Graphics::MacText *)_widget)->_fullRefresh = true;
+}
+
+void TextCast::getColors(int *fgcolor, int *bgcolor) {
+ if (fgcolor)
+ *fgcolor = _fgcolor;
+
+ if (bgcolor)
+ *bgcolor = _bgcolor;
+}
+
Graphics::TextAlign TextCast::getAlignment() {
switch (_textAlign) {
case kTextAlignRight:
diff --git a/engines/director/cast.h b/engines/director/cast.h
index f4391344b6..50fe39b950 100644
--- a/engines/director/cast.h
+++ b/engines/director/cast.h
@@ -59,6 +59,9 @@ public:
virtual bool isModified() { return _modified; }
virtual void createWidget();
+ virtual void setColors(int *fgcolor, int *bgcolor) { return; }
+ virtual void getColors(int *fgcolor, int *bgcolor) { return; }
+
CastType _type;
Common::Rect _initialRect;
Common::Rect _boundingRect;
@@ -75,6 +78,7 @@ public:
BitmapCast(Common::ReadStreamEndian &stream, uint32 castTag, uint16 version);
~BitmapCast();
virtual void createWidget() override;
+ // virtual void setColors(int *fgcolor, int *bgcolor) override;
Image::ImageDecoder *_img;
@@ -116,6 +120,8 @@ public:
class TextCast : public Cast {
public:
TextCast(Common::ReadStreamEndian &stream, uint16 version, bool asButton = false);
+ virtual void setColors(int *fgcolor, int *bgcolor) override;
+ virtual void getColors(int *fgcolor, int *bgcolor) override;
void setText(const char *text);
virtual void createWidget() override;
diff --git a/engines/director/lingo/lingo-the.cpp b/engines/director/lingo/lingo-the.cpp
index f0fab20715..f698e9bd0d 100644
--- a/engines/director/lingo/lingo-the.cpp
+++ b/engines/director/lingo/lingo-the.cpp
@@ -950,16 +950,7 @@ Datum Lingo::getTheCast(Datum &id1, int field) {
switch (field) {
case kTheBackColor:
- {
- if (castType != kCastShape) {
- warning("Lingo::getTheCast(): Field \"%s\" of cast %d not found", field2str(field), id);
- d.type = VOID;
- return d;
- }
-
- ShapeCast *shape = (ShapeCast *)member;
- d.u.i = shape->_bgCol;
- }
+ member->getColors(nullptr, &d.u.i);
break;
case kTheCastType:
d.u.i = castType;
@@ -968,16 +959,7 @@ Datum Lingo::getTheCast(Datum &id1, int field) {
d = Datum(castInfo->fileName);
break;
case kTheForeColor:
- {
- if (castType != kCastShape) {
- warning("Lingo::getTheCast(): Field \"%s\" of cast %d not found", field2str(field), id);
- d.type = VOID;
- return d;
- }
-
- ShapeCast *shape = (ShapeCast *)member;
- d.u.i = shape->_fgCol;
- }
+ member->getColors(&d.u.i, nullptr);
break;
case kTheHeight:
d.u.i = score->getCastMemberInitialRect(id).height();
@@ -1046,17 +1028,11 @@ void Lingo::setTheCast(Datum &id1, int field, Datum &d) {
CastInfo *castInfo = score->_castsInfo[id];
switch (field) {
- case kTheBackColor:
- {
- if (castType != kCastShape) {
- warning("Lingo::setTheCast(): Field \"%s\" of cast %d not found", field2str(field), id);
- }
- ShapeCast *shape = (ShapeCast *)member;
-
- shape->_bgCol = d.asInt();
- shape->_modified = 1;
- }
+ case kTheBackColor: {
+ int color = _vm->transformColor(d.asInt());
+ member->setColors(nullptr, &color);
break;
+ }
case kTheCastType:
// TODO: You can actually switch the cast type!?
warning("Lingo::setTheCast(): Tried to switch cast type of %d", id);
@@ -1070,17 +1046,11 @@ void Lingo::setTheCast(Datum &id1, int field, Datum &d) {
}
castInfo->fileName = d.asString();
break;
- case kTheForeColor:
- {
- if (castType != kCastShape) {
- warning("Lingo::setTheCast(): Field \"%s\" of cast %d not found", field2str(field), id);
- return;
- }
- ShapeCast *shape = (ShapeCast *)member;
- shape->_fgCol = d.u.i;
- shape->_modified = 1;
- }
+ case kTheForeColor: {
+ int color = _vm->transformColor(d.asInt());
+ member->setColors(&color, nullptr);
break;
+ }
case kTheHeight:
score->getCastMemberInitialRect(id).setHeight(d.asInt());
score->setCastMemberModified(id);
More information about the Scummvm-git-logs
mailing list