DIRECTOR: Implement DV::setMovieRate()

This commit is contained in:
Eugene Sandulenko 2020-08-20 23:38:22 +02:00
parent 586790d987
commit fbbea1a01f
3 changed files with 11 additions and 7 deletions

View File

@ -343,7 +343,7 @@ Graphics::MacWidget *DigitalVideoCastMember::createWidget(Common::Rect &bbox, Ch
_channel = channel;
// Do not render stopped videos
if (_channel->_movieRate == 0.0)
if (_channel->_movieRate == 0.0 && !_pausedAtStart)
return nullptr;
if (!_video || !_video->isVideoLoaded()) {
@ -421,11 +421,14 @@ void DigitalVideoCastMember::setStopTime(int stamp) {
_video->setEndTime(Audio::Timestamp(_channel->_stopTime * 1000 / 60, dur.framerate()));
}
void DigitalVideoCastMember::setMovieRate(int rate) {
void DigitalVideoCastMember::setMovieRate(double rate) {
if (!_video)
return;
warning("STUB: DigitalVideoCastMember::setMovieRate(%d)", rate);
if (rate < 0.0)
warning("STUB: DigitalVideoCastMember::setMovieRate(%g)", rate);
else
_video->setRate(Common::Rational((int)(rate * 100.0), 100));
}
void DigitalVideoCastMember::setFrameRate(int rate) {

View File

@ -146,7 +146,7 @@ public:
uint getMovieTotalTime();
void seekMovie(int stamp);
void setStopTime(int stamp);
void setMovieRate(int rate);
void setMovieRate(double rate);
void setFrameRate(int rate);
bool hasField(int field) override;

View File

@ -1172,9 +1172,10 @@ Datum Lingo::getTheSprite(Datum &id1, int field) {
d.u.i = sprite->_moveable;
break;
case kTheMovieRate:
d.u.i = channel->_movieRate;
d.type = FLOAT;
d.u.f = channel->_movieRate;
if (debugChannelSet(-1, kDebugEndVideo))
d.u.i = 0;
d.u.f = 0.0;
break;
case kTheMovieTime:
d.u.i = channel->_movieTime;
@ -1373,7 +1374,7 @@ void Lingo::setTheSprite(Datum &id1, int field, Datum &d) {
sprite->_moveable = d.asInt();
break;
case kTheMovieRate:
channel->_movieRate = d.asInt();
channel->_movieRate = d.asFloat();
if (sprite->_cast->_type == kCastDigitalVideo)
((DigitalVideoCastMember *)sprite->_cast)->setMovieRate(channel->_movieRate);
else