本文整理汇总了C++中VideoEntryPtr::getTime方法的典型用法代码示例。如果您正苦于以下问题:C++ VideoEntryPtr::getTime方法的具体用法?C++ VideoEntryPtr::getTime怎么用?C++ VideoEntryPtr::getTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VideoEntryPtr
的用法示例。
在下文中一共展示了VideoEntryPtr::getTime方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: o_fortressRotationSetPosition
void Mechanical::o_fortressRotationSetPosition(uint16 var, const ArgumentsArray &args) {
VideoEntryPtr gears = _fortressRotationGears->getVideo();
uint32 moviePosition = Audio::Timestamp(gears->getTime(), 600).totalNumberOfFrames();
// Myst ME short movie workaround, explained in o_fortressRotation_init
if (_fortressRotationShortMovieWorkaround) {
moviePosition += 3600 * _fortressRotationShortMovieCount;
}
_fortressPosition = (moviePosition + 900) / 1800 % 4;
// Stop the gears video so that it does not play while the elevator is going up
_fortressRotationGears->getVideo()->stop();
}
示例2: fortressSimulation_run
void Mechanical::fortressSimulation_run() {
if (_fortressSimulationInit) {
// Init sequence
_vm->_sound->playBackground(_fortressSimulationStartSound1, 65535);
_vm->wait(5000, true);
VideoEntryPtr startup = _fortressSimulationStartup->playMovie();
_vm->playSoundBlocking(_fortressSimulationStartSound2);
_vm->_sound->playBackground(_fortressSimulationStartSound1, 65535);
_vm->waitUntilMovieEnds(startup);
_vm->_sound->stopBackground();
_vm->_sound->playEffect(_fortressSimulationStartSound2);
Common::Rect src = Common::Rect(0, 0, 176, 176);
Common::Rect dst = Common::Rect(187, 3, 363, 179);
_vm->_gfx->copyImageSectionToBackBuffer(6046, src, dst);
_vm->_gfx->copyBackBufferToScreen(dst);
_fortressSimulationStartup->pauseMovie(true);
VideoEntryPtr holo = _fortressSimulationHolo->playMovie();
holo->setLooping(true);
holo->setRate(0);
// HACK: Support negative rates with edit lists
_fortressSimulationHoloRate = 0;
// END HACK
_vm->_cursor->showCursor();
_fortressSimulationInit = false;
} else {
VideoEntryPtr holo = _fortressSimulationHolo->getVideo();
double oldRate = holo->getRate().toDouble();
// HACK: Support negative rates with edit lists
oldRate = _fortressSimulationHoloRate;
// END HACK
uint32 moviePosition = Audio::Timestamp(holo->getTime(), 600).totalNumberOfFrames();
int32 positionInQuarter = 900 - (moviePosition + 900) % 1800;
// Are the gears moving?
if (oldRate >= 0.1 || ABS<int32>(positionInQuarter) >= 30 || _fortressSimulationBrake) {
double newRate = oldRate;
if (_fortressSimulationBrake && (double)_fortressSimulationBrake * 0.2 > oldRate) {
newRate += 0.1;
}
// Don't let the gears get stuck between two fortress positions
if (ABS<double>(oldRate) <= 0.05) {
if (oldRate <= 0.0) {
newRate += oldRate;
} else {
newRate -= oldRate;
}
} else {
if (oldRate <= 0.0) {
newRate += 0.05;
} else {
newRate -= 0.05;
}
}
// Adjust speed accordingly to acceleration lever
newRate += (double) (positionInQuarter / 1500.0)
* (double) (9 - _fortressSimulationSpeed) / 9.0;
newRate = CLIP<double>(newRate, -2.5, 2.5);
// HACK: Support negative rates with edit lists
// Our current QuickTime implementation does not support negative
// playback rates for movies using edit lists.
// The fortress rotation simulator movie this code handles is the
// only movie in the game requiring that feature.
// This hack approximates the next frame to display when the rate
// is negative, and seeks to it. It's not intended to be precise.
_fortressSimulationHoloRate = newRate;
if (_fortressSimulationHoloRate < 0) {
double newMoviePosition = moviePosition + _fortressSimulationHoloRate * 10;
holo->setRate(0);
holo->seek(Audio::Timestamp(0, (uint)newMoviePosition, 600));
} else {
holo->setRate(Common::Rational((int)(newRate * 1000.0), 1000));
}
// END HACK
_gearsWereRunning = true;
} else if (_gearsWereRunning) {
// The fortress has stopped. Set its new position
uint16 simulationPosition = (moviePosition + 900) / 1800 % 4;
holo->setRate(0);
//.........这里部分代码省略.........
示例3: fortressRotation_run
void Mechanical::fortressRotation_run() {
VideoEntryPtr gears = _fortressRotationGears->getVideo();
double oldRate = gears->getRate().toDouble();
uint32 moviePosition = Audio::Timestamp(gears->getTime(), 600).totalNumberOfFrames();
// Myst ME short movie workaround, explained in o_fortressRotation_init
if (_fortressRotationShortMovieWorkaround) {
// Detect if we just looped
if (ABS<int32>(_fortressRotationShortMovieLast - 3680) < 50
&& ABS<int32>(moviePosition) < 50) {
_fortressRotationShortMovieCount++;
}
_fortressRotationShortMovieLast = moviePosition;
// Simulate longer movie
moviePosition += 3600 * _fortressRotationShortMovieCount;
}
int32 positionInQuarter = 900 - (moviePosition + 900) % 1800;
// Are the gears moving?
if (oldRate >= 0.1 || ABS<int32>(positionInQuarter) >= 30 || _fortressRotationBrake) {
double newRate = oldRate;
if (_fortressRotationBrake && (double)_fortressRotationBrake * 0.2 > oldRate) {
newRate += 0.1;
}
// Don't let the gears get stuck between two fortress positions
if (ABS<double>(oldRate) <= 0.05) {
if (oldRate <= 0.0) {
newRate += oldRate;
} else {
newRate -= oldRate;
}
} else {
if (oldRate <= 0.0) {
newRate += 0.05;
} else {
newRate -= 0.05;
}
}
// Adjust speed accordingly to acceleration lever
newRate += (double) (positionInQuarter / 1500.0)
* (double) (9 - _fortressRotationSpeed) / 9.0;
newRate = CLIP<double>(newRate, -2.5, 2.5);
gears->setRate(Common::Rational((int)(newRate * 1000.0), 1000));
_gearsWereRunning = true;
} else if (_gearsWereRunning) {
// The fortress has stopped. Set its new position
_fortressPosition = (moviePosition + 900) / 1800 % 4;
gears->setRate(0);
if (!_fortressRotationShortMovieWorkaround) {
gears->seek(Audio::Timestamp(0, 1800 * _fortressPosition, 600));
} else {
gears->seek(Audio::Timestamp(0, 1800 * (_fortressPosition % 2), 600));
}
_vm->playSoundBlocking(_fortressRotationSounds[_fortressPosition]);
_gearsWereRunning = false;
}
}