diff options
Diffstat (limited to 'engines/director')
-rw-r--r-- | engines/director/frame.cpp | 2 | ||||
-rw-r--r-- | engines/director/lingo/lingo-the.cpp | 4 | ||||
-rw-r--r-- | engines/director/sprite.cpp | 46 | ||||
-rw-r--r-- | engines/director/sprite.h | 4 |
4 files changed, 51 insertions, 5 deletions
diff --git a/engines/director/frame.cpp b/engines/director/frame.cpp index 2fcb50f1f9..ccd82c63d5 100644 --- a/engines/director/frame.cpp +++ b/engines/director/frame.cpp @@ -674,7 +674,7 @@ void Frame::renderShape(Graphics::ManagedSurface &surface, uint16 spriteId) { // No minus one on the pattern here! MacPlotData will do that for us! //Graphics::MacPlotData pd(&tmpSurface, &_vm->getPatterns(), 1, 1, sp->_backColor); - Graphics::MacPlotData pd(&tmpSurface, &_vm->getPatterns(), sp->_pattern, sp->_lineSize + 1, sp->_backColor); + Graphics::MacPlotData pd(&tmpSurface, &_vm->getPatterns(), sp->getPattern(), sp->_lineSize + 1, sp->_backColor); Common::Rect fillRect(shapeRect.width(), shapeRect.height()); switch (sp->_spriteType) { diff --git a/engines/director/lingo/lingo-the.cpp b/engines/director/lingo/lingo-the.cpp index 56dc3fe918..8ae7777c0b 100644 --- a/engines/director/lingo/lingo-the.cpp +++ b/engines/director/lingo/lingo-the.cpp @@ -418,7 +418,7 @@ void Lingo::setTheSprite(Datum &id1, int field, Datum &d) { sprite->_editableText = *d.toString(); break; case kThePattern: - sprite->_pattern = d.u.i; + sprite->setPattern(d.u.i); break; default: warning("Lingo::setTheSprite(): Unprocessed setting field %d of sprite", field); @@ -623,7 +623,7 @@ Datum Lingo::getTheSprite(Datum &id1, int field) { d.u.s = &sprite->_editableText; break; case kThePattern: - d.u.i = sprite->_pattern; + d.u.i = sprite->getPattern(); break; default: warning("Lingo::getTheSprite(): Unprocessed getting field %d of sprite", field); diff --git a/engines/director/sprite.cpp b/engines/director/sprite.cpp index 0148c6665e..da86c0cf01 100644 --- a/engines/director/sprite.cpp +++ b/engines/director/sprite.cpp @@ -39,7 +39,6 @@ Sprite::Sprite() { _castId = 0; _backColor = 255; _foreColor = 0; - _pattern = 0; _left = 0; _right = 0; _top = 0; @@ -121,4 +120,49 @@ Sprite::~Sprite() { delete _buttonCast; } +uint16 Sprite::getPattern() { + switch (_spriteType) { + case kRectangleSprite: + case kRoundedRectangleSprite: + case kOvalSprite: + case kLineTopBottomSprite: + case kLineBottomTopSprite: + case kOutlinedRectangleSprite: + case kOutlinedRoundedRectangleSprite: + case kOutlinedOvalSprite: + return _castId; + + case kCastMemberSprite: + // TODO. Check type being shape, and return its pattern + warning("Sprite::getPattern(): kCastMemberSprite"); + return 0; + + default: + return 0; + } +} + +void Sprite::setPattern(uint16 pattern) { + switch (_spriteType) { + case kRectangleSprite: + case kRoundedRectangleSprite: + case kOvalSprite: + case kLineTopBottomSprite: + case kLineBottomTopSprite: + case kOutlinedRectangleSprite: + case kOutlinedRoundedRectangleSprite: + case kOutlinedOvalSprite: + _castId = pattern; + + case kCastMemberSprite: + // TODO + warning("Sprite::setPattern(): kCastMemberSprite"); + return; + + default: + return; + } +} + + } // End of namespace Director diff --git a/engines/director/sprite.h b/engines/director/sprite.h index f918a3a39e..07cbc54a08 100644 --- a/engines/director/sprite.h +++ b/engines/director/sprite.h @@ -63,6 +63,9 @@ public: Sprite(const Sprite &sprite); ~Sprite(); + uint16 getPattern(); + void setPattern(uint16 pattern); + uint16 _scriptId; byte _flags2; // x40 editable, 0x80 moveable byte _unk2; @@ -91,7 +94,6 @@ public: byte _moveable; byte _backColor; byte _foreColor; - uint16 _pattern; uint16 _left; uint16 _right; |