aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Iskrich2016-07-04 23:03:52 +0300
committerEugene Sandulenko2016-08-03 23:40:36 +0200
commitbb469dc84d9935335372c3c84c99ea99c06c3be4 (patch)
tree11238c46641dc0f09a45a645855d3d7740b02ed8
parentfb51685b07131d0fe62d2efd6d6eb068ae896792 (diff)
downloadscummvm-rg350-bb469dc84d9935335372c3c84c99ea99c06c3be4.tar.gz
scummvm-rg350-bb469dc84d9935335372c3c84c99ea99c06c3be4.tar.bz2
scummvm-rg350-bb469dc84d9935335372c3c84c99ea99c06c3be4.zip
DIRECTOR: Lingo: Set/Get common sprite fields
-rw-r--r--engines/director/lingo/lingo-the.cpp44
-rw-r--r--engines/director/score.cpp8
-rw-r--r--engines/director/score.h1
3 files changed, 50 insertions, 3 deletions
diff --git a/engines/director/lingo/lingo-the.cpp b/engines/director/lingo/lingo-the.cpp
index 168e9ee717..f772d0490f 100644
--- a/engines/director/lingo/lingo-the.cpp
+++ b/engines/director/lingo/lingo-the.cpp
@@ -24,6 +24,8 @@
namespace Director {
+class Sprite;
+
static struct TheEntityProto {
TheEntity entity;
const char *name;
@@ -159,10 +161,28 @@ void Lingo::setTheEntity(TheEntity entity, int id, TheField field, Datum &d) {
}
void Lingo::setTheSprite(int id, TheField field, Datum &d) {
+ Sprite *sprite = _vm->_currentScore->getSpriteById(id);
+
switch (field) {
case kTheCastNum:
- warning("STUB: setting thecastnum of sprite %d", id);
+ if (_vm->_currentScore->_casts.contains(d.u.i)) {
+ sprite->_cast = _vm->_currentScore->_casts[d.u.i];
+ sprite->_castId = d.u.i;
+ }
+ break;
+ case kTheWidth:
+ sprite->_width = d.u.i;
+ break;
+ case kTheHeight:
+ sprite->_height = d.u.i;
break;
+ case kTheTrails:
+ sprite->_trails = d.u.i;
+ break;
+ case kTheInk:
+ sprite->_ink = static_cast<InkType>(d.u.i);
+ break;
+
default:
error("Unprocessed setting field %d of sprite", field);
}
@@ -187,10 +207,27 @@ Datum Lingo::getTheEntity(TheEntity entity, int id, TheField field) {
Datum Lingo::getTheSprite(int id, TheField field) {
Datum d;
-
+ Sprite *sprite = _vm->_currentScore->getSpriteById(id);
switch (field) {
case kTheCastNum:
- warning("STUB: getting thecastnum of sprite %d", id);
+ d.type = INT;
+ d.u.i = sprite->_castId;
+ break;
+ case kTheWidth:
+ d.type = INT;
+ d.u.i = sprite->_width;
+ break;
+ case kTheHeight:
+ d.type = INT;
+ d.u.i = sprite->_height;
+ break;
+ case kTheTrails:
+ d.type = INT;
+ d.u.i = sprite->_trails;
+ break;
+ case kTheInk:
+ d.type = INT;
+ d.u.i = sprite->_ink;
break;
default:
error("Unprocessed getting field %d of sprite", field);
@@ -199,4 +236,5 @@ Datum Lingo::getTheSprite(int id, TheField field) {
return d;
}
+
} // End of namespace Director
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 9e174987e8..dd3ab54eb8 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -821,6 +821,14 @@ void Score::processEvents() {
}
}
+Sprite *Score::getSpriteById(uint16 id) {
+ if (_frames[_currentFrame]->_sprites[id]) {
+ return _frames[_currentFrame]->_sprites[id];
+ } else {
+ error("Sprite on frame %d width id %d not found", _currentFrame, id);
+ }
+}
+
Frame::Frame(DirectorEngine *vm) {
_vm = vm;
_transDuration = 0;
diff --git a/engines/director/score.h b/engines/director/score.h
index 8a3400b46d..ee0eaa2972 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -356,6 +356,7 @@ public:
void loadCastData(Common::SeekableSubReadStreamEndian &stream);
void setCurrentFrame(uint16 frameId) { _currentFrame = frameId; }
Common::String getMacName() const { return _macName; }
+ Sprite *getSpriteById(uint16 id);
private:
void update();
void readVersion(uint32 rid);