[Scummvm-git-logs] scummvm master -> 8423839f4862b358d42fb2bd1685fba905f4112b
moralrecordings
code at moral.net.au
Tue Jun 16 16:35:35 UTC 2020
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
7c9ed6febb DIRECTOR: Add new SpriteChannel class
8423839f48 DIRECTOR: Fix compiler warning
Commit: 7c9ed6febbed9c32fb6406def6aef7804d02ca75
https://github.com/scummvm/scummvm/commit/7c9ed6febbed9c32fb6406def6aef7804d02ca75
Author: Scott Percival (code at moral.net.au)
Date: 2020-06-17T00:33:26+08:00
Commit Message:
DIRECTOR: Add new SpriteChannel class
Some sprite properties are considered global across all frames.
This can be seen in Chop Suey where e.g the exitFrame script for
frame 1 will change the visibility on sprite channels that aren't used
until frame 3. This adds a new global list of sprite channel properties
that aren't attached to a Frame.
This just tracks visibility for now, additional properties can be moved
over from Sprite when they are confirmed to be global.
Changed paths:
engines/director/lingo/lingo-bytecode.cpp
engines/director/lingo/lingo-the.cpp
engines/director/score-loading.cpp
engines/director/score.cpp
engines/director/score.h
engines/director/sprite.cpp
engines/director/sprite.h
diff --git a/engines/director/lingo/lingo-bytecode.cpp b/engines/director/lingo/lingo-bytecode.cpp
index 0e1cb416d1..d2dc160b25 100644
--- a/engines/director/lingo/lingo-bytecode.cpp
+++ b/engines/director/lingo/lingo-bytecode.cpp
@@ -342,7 +342,7 @@ void LC::cb_objectcall() {
// if there's nothing, try calling a function with that name
Symbol func = g_lingo->getHandler(*object.u.s);
if (func.type != VOID) {
- LC::call(*object.u.s, nargs.u.i);
+ LC::call(func, nargs.u.i);
} else {
warning("cb_objectcall: could not find object or function with name %s", object.u.s->c_str());
}
diff --git a/engines/director/lingo/lingo-the.cpp b/engines/director/lingo/lingo-the.cpp
index 0af229ccb0..96892ec659 100644
--- a/engines/director/lingo/lingo-the.cpp
+++ b/engines/director/lingo/lingo-the.cpp
@@ -689,6 +689,7 @@ Datum Lingo::getTheSprite(Datum &id1, int field) {
}
Sprite *sprite = score->getSpriteById(id);
+ SpriteChannel *channel = score->getSpriteChannelById(id);
if (!sprite)
return d;
@@ -776,7 +777,7 @@ Datum Lingo::getTheSprite(Datum &id1, int field) {
break;
case kTheVisibility:
case kTheVisible:
- d.u.i = (sprite->_visible ? 1 : 0);
+ d.u.i = (channel->_visible ? 1 : 0);
break;
case kTheVolume:
d.u.i = sprite->_volume;
@@ -809,6 +810,7 @@ void Lingo::setTheSprite(Datum &id1, int field, Datum &d) {
}
Sprite *sprite = score->getSpriteById(id);
+ SpriteChannel *channel = score->getSpriteChannelById(id);
if (!sprite)
return;
@@ -893,7 +895,7 @@ void Lingo::setTheSprite(Datum &id1, int field, Datum &d) {
break;
case kTheVisibility:
case kTheVisible:
- sprite->_visible = (d.asInt() == 0 ? false : true);
+ channel->_visible = (d.asInt() == 0 ? false : true);
break;
case kTheVolume:
sprite->_volume = d.asInt();
diff --git a/engines/director/score-loading.cpp b/engines/director/score-loading.cpp
index d1b4c36815..c367067a63 100644
--- a/engines/director/score-loading.cpp
+++ b/engines/director/score-loading.cpp
@@ -514,6 +514,10 @@ void Score::loadFrames(Common::SeekableSubReadStreamEndian &stream) {
warning("STUB: Score::loadFrames. unk1: %x unk2: %x unk3: %x unk4: %x unk5: %x unk6: %x", unk1, unk2, unk3, unk4, unk5, unk6);
}
+ for (int i = 0; i < _numChannelsDisplayed + 1; i++) {
+ _spriteChannels.push_back(new SpriteChannel());
+ }
+
uint16 channelSize;
uint16 channelOffset;
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index ec7e1f356b..b8af63e241 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -109,6 +109,9 @@ Score::~Score() {
for (uint i = 0; i < _frames.size(); i++)
delete _frames[i];
+ for (uint i = 0; i < _spriteChannels.size(); i++)
+ delete _spriteChannels[i];
+
if (_loadedStxts)
for (Common::HashMap<int, const Stxt *>::iterator it = _loadedStxts->begin(); it != _loadedStxts->end(); ++it)
delete it->_value;
@@ -543,8 +546,9 @@ void Score::unrenderSprite(uint16 spriteId) {
void Score::renderSprite(uint16 id) {
Sprite *sprite = _sprites[id];
+ SpriteChannel *channel = _spriteChannels[id];
- if (!sprite || !sprite->_enabled || !sprite->_castType)
+ if (!sprite || !sprite->_enabled || !channel->_visible || !sprite->_castType)
return;
sprite->updateCast();
@@ -737,6 +741,14 @@ Sprite *Score::getSpriteById(uint16 id) {
}
}
+SpriteChannel *Score::getSpriteChannelById(uint16 id) {
+ if (id >= _spriteChannels.size()) {
+ warning("Score::getSpriteChannelById(%d): out of bounds", id);
+ return nullptr;
+ }
+ return _spriteChannels[id];
+}
+
void Score::playSoundChannel(uint16 frameId) {
Frame *frame = _frames[frameId];
diff --git a/engines/director/score.h b/engines/director/score.h
index 1b50b19ac0..e7da43276c 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -49,6 +49,7 @@ struct Label;
class Lingo;
struct Resource;
class Sprite;
+class SpriteChannel;
class Stxt;
class BitmapCast;
class ScriptCast;
@@ -110,6 +111,7 @@ public:
uint16 getCurrentFrame() { return _currentFrame; }
Common::String getMacName() const { return _macName; }
Sprite *getSpriteById(uint16 id);
+ SpriteChannel *getSpriteChannelById(uint16 id);
void setSpriteCasts();
void setSpriteBboxes();
void loadSpriteImages(bool isSharedCast);
@@ -173,6 +175,7 @@ private:
public:
Common::Array<Frame *> _frames;
Common::Array<Sprite *> _sprites;
+ Common::Array<SpriteChannel *> _spriteChannels;
Common::HashMap<uint16, CastInfo *> _castsInfo;
Common::HashMap<Common::String, int, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> _castsNames;
Common::SortedArray<Label *> *_labels;
diff --git a/engines/director/sprite.cpp b/engines/director/sprite.cpp
index 3c236cf3f7..0d59887ae2 100644
--- a/engines/director/sprite.cpp
+++ b/engines/director/sprite.cpp
@@ -30,6 +30,13 @@
namespace Director {
+SpriteChannel::SpriteChannel() {
+ _visible = true;
+}
+
+SpriteChannel::~SpriteChannel() {
+}
+
Sprite::Sprite() {
_scriptId = 0;
_scriptCastIndex = 0;
@@ -61,7 +68,6 @@ Sprite::Sprite() {
_foreColor = 0;
_blend = 0;
- _visible = false;
_movieRate = 0;
_movieTime = 0;
_startTime = 0;
diff --git a/engines/director/sprite.h b/engines/director/sprite.h
index d966740e8e..204a12ca25 100644
--- a/engines/director/sprite.h
+++ b/engines/director/sprite.h
@@ -56,6 +56,14 @@ enum MainChannelsPosition {
kPalettePosition = 15
};
+class SpriteChannel {
+public:
+ SpriteChannel();
+ ~SpriteChannel();
+
+ bool _visible;
+};
+
class Sprite {
public:
Sprite();
@@ -108,7 +116,6 @@ public:
byte _foreColor;
byte _blend;
- bool _visible;
// Using in digital movie sprites
byte _movieRate;
uint16 _movieTime;
Commit: 8423839f4862b358d42fb2bd1685fba905f4112b
https://github.com/scummvm/scummvm/commit/8423839f4862b358d42fb2bd1685fba905f4112b
Author: Scott Percival (code at moral.net.au)
Date: 2020-06-17T00:35:21+08:00
Commit Message:
DIRECTOR: Fix compiler warning
Changed paths:
engines/director/score.h
diff --git a/engines/director/score.h b/engines/director/score.h
index e7da43276c..d9969fdabe 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -30,7 +30,7 @@ namespace Graphics {
class ManagedSurface;
class Font;
class MacWindow;
- class ZoomBox;
+ struct ZoomBox;
}
namespace Common {
More information about the Scummvm-git-logs
mailing list