aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2019-12-29 00:37:05 +0100
committerEugene Sandulenko2019-12-29 00:51:16 +0100
commit44210738937408e3cbffd358f5948154df4cf269 (patch)
treebb58b121d747fe6f7d2f7137ce43c1aadaeed154
parent35e9a957575e7d8c194fd460f6f1ee50519a7033 (diff)
downloadscummvm-rg350-44210738937408e3cbffd358f5948154df4cf269.tar.gz
scummvm-rg350-44210738937408e3cbffd358f5948154df4cf269.tar.bz2
scummvm-rg350-44210738937408e3cbffd358f5948154df4cf269.zip
DIRECTOR: LINGO: Code simplificaiton in Lingo::setTheCast()
-rw-r--r--engines/director/lingo/lingo-the.cpp31
1 files changed, 16 insertions, 15 deletions
diff --git a/engines/director/lingo/lingo-the.cpp b/engines/director/lingo/lingo-the.cpp
index 1f82a90784..592542f11e 100644
--- a/engines/director/lingo/lingo-the.cpp
+++ b/engines/director/lingo/lingo-the.cpp
@@ -734,24 +734,25 @@ Datum Lingo::getTheCast(Datum &id1, int field) {
void Lingo::setTheCast(Datum &id1, int field, Datum &d) {
int id = 0;
+ Score *score = _vm->getCurrentScore();
- if (id1.type == INT) {
- id = id1.u.i;
- } else {
- warning("Lingo::setTheCast(): Unknown the cast id type: %s", id1.type2str());
+ if (!score) {
+ warning("Lingo::setTheCast(): The cast %d field %d setting over non-active score", id, field);
return;
}
- if (!_vm->getCurrentScore()) {
- warning("Lingo::setTheCast(): The cast %d field %d setting over non-active score", id, field);
+ if (id1.type == INT) {
+ id = id1.u.i + score->_castIDoffset;
+ } else {
+ warning("Lingo::setTheCast(): Unknown the cast id type: %s", id1.type2str());
return;
}
- CastType castType = _vm->getCurrentScore()->_castTypes[id];
- CastInfo *castInfo = _vm->getCurrentScore()->_castsInfo[id];
+ CastType castType = score->_castTypes[id];
+ CastInfo *castInfo = score->_castsInfo[id];
if (!castInfo) {
- warning("Lingo::setTheCast(): The cast %d found", id);
+ warning("Lingo::setTheCast(): The cast %d not found", id);
return;
}
@@ -772,19 +773,19 @@ void Lingo::setTheCast(Datum &id1, int field, Datum &d) {
castInfo->script = *d.u.s;
break;
case kTheWidth:
- _vm->getCurrentScore()->getCastMemberInitialRect(id).setWidth(d.u.i);
- _vm->getCurrentScore()->setCastMemberModified(id);
+ score->getCastMemberInitialRect(id).setWidth(d.u.i);
+ score->setCastMemberModified(id);
break;
case kTheHeight:
- _vm->getCurrentScore()->getCastMemberInitialRect(id).setHeight(d.u.i);
- _vm->getCurrentScore()->setCastMemberModified(id);
+ score->getCastMemberInitialRect(id).setHeight(d.u.i);
+ score->setCastMemberModified(id);
break;
case kTheBackColor:
{
if (castType != kCastShape) {
warning("Lingo::setTheCast(): Field %d of cast %d not found", field, id);
}
- ShapeCast *shape = _vm->getCurrentScore()->_loadedShapes->getVal(id);
+ ShapeCast *shape = score->_loadedShapes->getVal(id);
shape->_bgCol = d.u.i;
shape->_modified = 1;
}
@@ -795,7 +796,7 @@ void Lingo::setTheCast(Datum &id1, int field, Datum &d) {
warning("Lingo::setTheCast(): Field %d of cast %d not found", field, id);
return;
}
- ShapeCast *shape = _vm->getCurrentScore()->_loadedShapes->getVal(id);
+ ShapeCast *shape = score->_loadedShapes->getVal(id);
shape->_fgCol = d.u.i;
shape->_modified = 1;
}