aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorEugene Sandulenko2017-02-09 18:48:22 +0100
committerEugene Sandulenko2017-02-09 18:48:22 +0100
commitc444de0ecaab3757ac6170a283734214166dc696 (patch)
treeb0fb1740987d52c196b1773356d622027bfc3147 /engines
parent5fb528743b1e98fb769686b5193c4e58cf32143f (diff)
downloadscummvm-rg350-c444de0ecaab3757ac6170a283734214166dc696.tar.gz
scummvm-rg350-c444de0ecaab3757ac6170a283734214166dc696.tar.bz2
scummvm-rg350-c444de0ecaab3757ac6170a283734214166dc696.zip
DIRECTOR: Made DirectorEngine::_currentScore private
Diffstat (limited to 'engines')
-rw-r--r--engines/director/director.h3
-rw-r--r--engines/director/frame.cpp32
-rw-r--r--engines/director/lingo/lingo-builtins.cpp4
-rw-r--r--engines/director/lingo/lingo-funcs.cpp14
-rw-r--r--engines/director/lingo/lingo-the.cpp34
5 files changed, 44 insertions, 43 deletions
diff --git a/engines/director/director.h b/engines/director/director.h
index 882eb14495..001393bc97 100644
--- a/engines/director/director.h
+++ b/engines/director/director.h
@@ -98,7 +98,6 @@ public:
Common::HashMap<int, Cast *> *getSharedCasts() const { return _sharedCasts; }
Common::HashMap<Common::String, Score *> *_movies;
- Score *_currentScore;
Common::RandomSource _rnd;
Graphics::MacWindowManager *_wm;
@@ -142,6 +141,8 @@ private:
uint16 _currentPaletteLength;
Lingo *_lingo;
+ Score *_currentScore;
+
Graphics::MacPatterns _director3Patterns;
Graphics::MacPatterns _director3QuickDrawPatterns;
diff --git a/engines/director/frame.cpp b/engines/director/frame.cpp
index 68b1713f46..f6a16e6cef 100644
--- a/engines/director/frame.cpp
+++ b/engines/director/frame.cpp
@@ -560,7 +560,7 @@ void Frame::renderSprites(Graphics::ManagedSurface &surface, bool renderTrail) {
break;
}
} else {
- if (!_vm->_currentScore->_casts.contains(_sprites[i]->_castId)) {
+ if (!_vm->getCurrentScore()->_casts.contains(_sprites[i]->_castId)) {
if (!_vm->getSharedCasts()->contains(_sprites[i]->_castId)) {
warning("Cast id %d not found", _sprites[i]->_castId);
continue;
@@ -569,7 +569,7 @@ void Frame::renderSprites(Graphics::ManagedSurface &surface, bool renderTrail) {
cast = _vm->getSharedCasts()->getVal(_sprites[i]->_castId);
}
} else {
- cast = _vm->_currentScore->_casts[_sprites[i]->_castId];
+ cast = _vm->getCurrentScore()->_casts[_sprites[i]->_castId];
}
castType = cast->type;
}
@@ -661,7 +661,7 @@ void Frame::renderShape(Graphics::ManagedSurface &surface, uint16 spriteId) {
void Frame::renderButton(Graphics::ManagedSurface &surface, uint16 spriteId, uint16 textId) {
uint16 castId = _sprites[spriteId]->_castId;
- ButtonCast *button = static_cast<ButtonCast *>(_vm->_currentScore->_casts[castId]);
+ ButtonCast *button = static_cast<ButtonCast *>(_vm->getCurrentScore()->_casts[castId]);
uint32 rectLeft = button->initialRect.left;
uint32 rectTop = button->initialRect.top;
@@ -703,14 +703,14 @@ void Frame::renderButton(Graphics::ManagedSurface &surface, uint16 spriteId, uin
Image::ImageDecoder *Frame::getImageFrom(uint16 spriteId) {
uint16 imgId = spriteId + 1024;
- if (_vm->getVersion() >= 4 && _vm->_currentScore->_casts[spriteId]->children.size() > 0)
- imgId = _vm->_currentScore->_casts[spriteId]->children[0].index;
+ if (_vm->getVersion() >= 4 && _vm->getCurrentScore()->_casts[spriteId]->children.size() > 0)
+ imgId = _vm->getCurrentScore()->_casts[spriteId]->children[0].index;
Image::ImageDecoder *img = NULL;
- if (_vm->_currentScore->getArchive()->hasResource(MKTAG('D', 'I', 'B', ' '), imgId)) {
+ if (_vm->getCurrentScore()->getArchive()->hasResource(MKTAG('D', 'I', 'B', ' '), imgId)) {
img = new DIBDecoder();
- img->loadStream(*_vm->_currentScore->getArchive()->getResource(MKTAG('D', 'I', 'B', ' '), imgId));
+ img->loadStream(*_vm->getCurrentScore()->getArchive()->getResource(MKTAG('D', 'I', 'B', ' '), imgId));
return img;
}
@@ -728,9 +728,9 @@ Image::ImageDecoder *Frame::getImageFrom(uint16 spriteId) {
pic = _vm->getSharedBMP()->getVal(imgId);
pic->seek(0); // TODO: this actually gets re-read every loop... we need to rewind it!
bc = static_cast<BitmapCast *>(_vm->getSharedCasts()->getVal(spriteId));
- } else if (_vm->_currentScore->getArchive()->hasResource(MKTAG('B', 'I', 'T', 'D'), imgId)) {
- pic = _vm->_currentScore->getArchive()->getResource(MKTAG('B', 'I', 'T', 'D'), imgId);
- bc = static_cast<BitmapCast *>(_vm->_currentScore->_casts[spriteId]);
+ } else if (_vm->getCurrentScore()->getArchive()->hasResource(MKTAG('B', 'I', 'T', 'D'), imgId)) {
+ pic = _vm->getCurrentScore()->getArchive()->getResource(MKTAG('B', 'I', 'T', 'D'), imgId);
+ bc = static_cast<BitmapCast *>(_vm->getCurrentScore()->_casts[spriteId]);
}
if (pic != NULL && bc != NULL) {
@@ -741,7 +741,7 @@ Image::ImageDecoder *Frame::getImageFrom(uint16 spriteId) {
imgId, w, h, bc->flags, bc->someFlaggyThing, bc->unk1, bc->unk2);
img = new BITDDecoder(w, h);
} else if (_vm->getVersion() < 6) {
- bc = static_cast<BitmapCast *>(_vm->_currentScore->_casts[spriteId]);
+ bc = static_cast<BitmapCast *>(_vm->getCurrentScore()->_casts[spriteId]);
int w = bc->initialRect.width(), h = bc->initialRect.height();
debugC(2, kDebugImages, "id: %d, w: %d, h: %d, flags: %x, some: %x, unk1: %d, unk2: %d",
@@ -798,8 +798,8 @@ void Frame::inkBasedBlit(Graphics::ManagedSurface &targetSurface, const Graphics
void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteId, uint16 castId) {
Common::SeekableSubReadStreamEndian *textStream = NULL;
- if (_vm->_currentScore->_movieArchive->hasResource(MKTAG('S', 'T', 'X', 'T'), castId)) {
- textStream = _vm->_currentScore->_movieArchive->getResource(MKTAG('S', 'T', 'X', 'T'), castId);
+ if (_vm->getCurrentScore()->_movieArchive->hasResource(MKTAG('S', 'T', 'X', 'T'), castId)) {
+ textStream = _vm->getCurrentScore()->_movieArchive->getResource(MKTAG('S', 'T', 'X', 'T'), castId);
} else if (_vm->getSharedSTXT() != nullptr) {
textStream = _vm->getSharedSTXT()->getVal(spriteId + 1024);
}
@@ -812,7 +812,7 @@ void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteId, Commo
return;
uint16 castId = _sprites[spriteId]->_castId;
- TextCast *textCast = static_cast<TextCast *>(_vm->_currentScore->_casts[castId]);
+ TextCast *textCast = static_cast<TextCast *>(_vm->getCurrentScore()->_casts[castId]);
uint32 unk1 = textStream->readUint32();
uint32 strLen = textStream->readUint32();
@@ -906,10 +906,10 @@ void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteId, Commo
if (_vm->getVersion() >= 4 && textSize != NULL)
width = textCast->initialRect.right;
- if (_vm->_currentScore->_fontMap.contains(textCast->fontId)) {
+ if (_vm->getCurrentScore()->_fontMap.contains(textCast->fontId)) {
// We need to make sure that the Shared Cast fonts have been loaded in?
// might need a mapping table here of our own.
- // textCast->fontId = _vm->_wm->_fontMan->getFontIdByName(_vm->_currentScore->_fontMap[textCast->fontId]);
+ // textCast->fontId = _vm->_wm->_fontMan->getFontIdByName(_vm->getCurrentScore()->_fontMap[textCast->fontId]);
}
Graphics::MacFont macFont = Graphics::MacFont(textCast->fontId, textCast->fontSize, textCast->textSlant);
diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp
index 03e1a86544..f34be6e526 100644
--- a/engines/director/lingo/lingo-builtins.cpp
+++ b/engines/director/lingo/lingo-builtins.cpp
@@ -904,8 +904,8 @@ void Lingo::b_printFrom(int nargs) {
}
void Lingo::b_quit(int nargs) {
- if (g_director->_currentScore)
- g_director->_currentScore->_stopPlay = true;
+ if (g_director->getCurrentScore())
+ g_director->getCurrentScore()->_stopPlay = true;
g_lingo->pushVoid();
}
diff --git a/engines/director/lingo/lingo-funcs.cpp b/engines/director/lingo/lingo-funcs.cpp
index 6260fe9562..a6dc3f0c5e 100644
--- a/engines/director/lingo/lingo-funcs.cpp
+++ b/engines/director/lingo/lingo-funcs.cpp
@@ -185,7 +185,7 @@ void Lingo::func_goto(Datum &frame, Datum &movie) {
}
_vm->_nextMovie = *movie.u.s;
- _vm->_currentScore->_stopPlay = true;
+ _vm->getCurrentScore()->_stopPlay = true;
_vm->_nextMovieFrameS.clear();
_vm->_nextMovieFrameI = -1;
@@ -221,24 +221,24 @@ void Lingo::func_goto(Datum &frame, Datum &movie) {
}
void Lingo::func_gotoloop() {
- if (!_vm->_currentScore)
+ if (!_vm->getCurrentScore())
return;
- _vm->_currentScore->gotoLoop();
+ _vm->getCurrentScore()->gotoLoop();
}
void Lingo::func_gotonext() {
- if (!_vm->_currentScore)
+ if (!_vm->getCurrentScore())
return;
- _vm->_currentScore->gotoNext();
+ _vm->getCurrentScore()->gotoNext();
}
void Lingo::func_gotoprevious() {
- if (!_vm->_currentScore)
+ if (!_vm->getCurrentScore())
return;
- _vm->_currentScore->gotoPrevious();
+ _vm->getCurrentScore()->gotoPrevious();
}
void Lingo::func_cursor(int c) {
diff --git a/engines/director/lingo/lingo-the.cpp b/engines/director/lingo/lingo-the.cpp
index 090a7fed81..8a5f837d1a 100644
--- a/engines/director/lingo/lingo-the.cpp
+++ b/engines/director/lingo/lingo-the.cpp
@@ -317,20 +317,20 @@ void Lingo::setTheSprite(Datum &id1, int field, Datum &d) {
d.toInt(); // Enforce Integer
- if (!_vm->_currentScore) {
+ if (!_vm->getCurrentScore()) {
warning("The sprite %d field %d setting over non-active score", id, field);
return;
}
- Sprite *sprite = _vm->_currentScore->getSpriteById(id);
+ Sprite *sprite = _vm->getCurrentScore()->getSpriteById(id);
if (!sprite)
return;
switch (field) {
case kTheCastNum:
- if (_vm->_currentScore->_casts.contains(d.u.i)) {
- sprite->_cast = _vm->_currentScore->_casts[d.u.i];
+ if (_vm->getCurrentScore()->_casts.contains(d.u.i)) {
+ sprite->_cast = _vm->getCurrentScore()->_casts[d.u.i];
sprite->_castId = d.u.i;
}
break;
@@ -519,12 +519,12 @@ Datum Lingo::getTheSprite(Datum &id1, int field) {
return d;
}
- if (!_vm->_currentScore) {
+ if (!_vm->getCurrentScore()) {
warning("The sprite %d field %d setting over non-active score", id, field);
return d;
}
- Sprite *sprite = _vm->_currentScore->getSpriteById(id);
+ Sprite *sprite = _vm->getCurrentScore()->getSpriteById(id);
if (!sprite)
return d;
@@ -630,14 +630,14 @@ Datum Lingo::getTheCast(Datum &id1, int field) {
return d;
}
- if (!_vm->_currentScore) {
+ if (!_vm->getCurrentScore()) {
warning("The cast %d field %d setting over non-active score", id, field);
return d;
}
Cast *cast;
CastInfo *castInfo;
- if (!_vm->_currentScore->_casts.contains(id)) {
+ if (!_vm->getCurrentScore()->_casts.contains(id)) {
if (field == kTheLoaded) {
d.type = INT;
d.u.i = 0;
@@ -648,8 +648,8 @@ Datum Lingo::getTheCast(Datum &id1, int field) {
warning("The cast %d found", id);
}
- cast = _vm->_currentScore->_casts[id];
- castInfo = _vm->_currentScore->_castsInfo[id];
+ cast = _vm->getCurrentScore()->_casts[id];
+ castInfo = _vm->getCurrentScore()->_castsInfo[id];
d.type = INT;
@@ -683,7 +683,7 @@ Datum Lingo::getTheCast(Datum &id1, int field) {
return d;
}
- ShapeCast *shape = static_cast<ShapeCast *>(_vm->_currentScore->_casts[id]);
+ ShapeCast *shape = static_cast<ShapeCast *>(_vm->getCurrentScore()->_casts[id]);
d.u.i = shape->bgCol;
}
break;
@@ -695,7 +695,7 @@ Datum Lingo::getTheCast(Datum &id1, int field) {
return d;
}
- ShapeCast *shape = static_cast<ShapeCast *>(_vm->_currentScore->_casts[id]);
+ ShapeCast *shape = static_cast<ShapeCast *>(_vm->getCurrentScore()->_casts[id]);
d.u.i = shape->fgCol;
}
break;
@@ -721,13 +721,13 @@ void Lingo::setTheCast(Datum &id1, int field, Datum &d) {
return;
}
- if (!_vm->_currentScore) {
+ if (!_vm->getCurrentScore()) {
warning("The cast %d field %d setting over non-active score", id, field);
return;
}
- Cast *cast = _vm->_currentScore->_casts[id];
- CastInfo *castInfo = _vm->_currentScore->_castsInfo[id];
+ Cast *cast = _vm->getCurrentScore()->_casts[id];
+ CastInfo *castInfo = _vm->getCurrentScore()->_castsInfo[id];
if (!cast) {
warning("The cast %d found", id);
@@ -761,7 +761,7 @@ void Lingo::setTheCast(Datum &id1, int field, Datum &d) {
if (cast->type != kCastShape) {
warning("Field %d of cast %d not found", field, id);
}
- ShapeCast *shape = static_cast<ShapeCast *>(_vm->_currentScore->_casts[id]);
+ ShapeCast *shape = static_cast<ShapeCast *>(_vm->getCurrentScore()->_casts[id]);
shape->bgCol = d.u.i;
shape->modified = 1;
}
@@ -772,7 +772,7 @@ void Lingo::setTheCast(Datum &id1, int field, Datum &d) {
warning("Field %d of cast %d not found", field, id);
return;
}
- ShapeCast *shape = static_cast<ShapeCast *>(_vm->_currentScore->_casts[id]);
+ ShapeCast *shape = static_cast<ShapeCast *>(_vm->getCurrentScore()->_casts[id]);
shape->fgCol = d.u.i;
shape->modified = 1;
}