aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Iskrich2016-07-04 16:25:58 +0300
committerEugene Sandulenko2016-08-03 23:40:36 +0200
commit350f81635f0186a9c93d8750d1d043f8c1cfda00 (patch)
tree253d1888fb9b97d3072bf185cdbbb84e88f92a5c
parentf4325f30effa36d14bfa97312c25a58ac1ebe4cd (diff)
downloadscummvm-rg350-350f81635f0186a9c93d8750d1d043f8c1cfda00.tar.gz
scummvm-rg350-350f81635f0186a9c93d8750d1d043f8c1cfda00.tar.bz2
scummvm-rg350-350f81635f0186a9c93d8750d1d043f8c1cfda00.zip
DIRECTOR: Render checkbox and button rectangles
-rw-r--r--engines/director/score.cpp25
-rw-r--r--engines/director/score.h3
2 files changed, 27 insertions, 1 deletions
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 22f5381d20..9e174987e8 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -1268,6 +1268,31 @@ void Frame::renderSprites(Graphics::ManagedSurface &surface, bool renderTrail) {
}
}
+void Frame::renderButton(Graphics::ManagedSurface &surface, uint16 spriteId) {
+ renderText(surface, spriteId);
+
+ uint16 castID = _sprites[spriteId]->_castId;
+ ButtonCast *button = static_cast<ButtonCast *>(_vm->_currentScore->_casts[castID]);
+
+ uint32 rectLeft = button->initialRect.left;
+ uint32 rectTop = button->initialRect.top;
+
+ int x = _sprites[spriteId]->_startPoint.x + rectLeft;
+ int y = _sprites[spriteId]->_startPoint.y + rectTop;
+ int height = _sprites[spriteId]->_height;
+ int width = _sprites[spriteId]->_width;
+
+ switch (button->buttonType) {
+ case kTypeCheckBox:
+ //Magic numbers: checkbox square need to move left about 5px from text and 12px side size (d4)
+ surface.frameRect(Common::Rect(x - 17, y, x + 12, y + 12), 0);
+ break;
+ case kTypeButton:
+ surface.frameRect(Common::Rect(x, y, x + width, y + height), 0);
+ break;
+ }
+}
+
Image::ImageDecoder *Frame::getImageFrom(uint16 spriteId) {
uint16 imgId = spriteId + 1024;
Image::ImageDecoder *img = NULL;
diff --git a/engines/director/score.h b/engines/director/score.h
index b6eb96803a..8a3400b46d 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -301,7 +301,8 @@ private:
void playTransition(Score *score);
void playSoundChannel();
void renderSprites(Graphics::ManagedSurface &surface, bool renderTrail);
- void renderText(Graphics::ManagedSurface &surface, uint16 castId);
+ void renderText(Graphics::ManagedSurface &surface, uint16 spriteId);
+ void renderButton(Graphics::ManagedSurface &surface, uint16 spriteId);
void readPaletteInfo(Common::SeekableSubReadStreamEndian &stream);
void readSprite(Common::SeekableSubReadStreamEndian &stream, uint16 offset, uint16 size);
void readMainChannels(Common::SeekableSubReadStreamEndian &stream, uint16 offset, uint16 size);