Implement *scpbtn and *_domecheck. The domes can now be opened/closed (not using the sliders).

svn-id: r49208
This commit is contained in:
Matthew Hoops 2010-05-25 03:46:28 +00:00
parent ab540af9f8
commit 4a8841202a
4 changed files with 65 additions and 15 deletions

View File

@ -213,16 +213,39 @@ void RivenExternal::runEndGame(uint16 video) {
_vm->_gameOver = true;
}
void RivenExternal::runDomeButtonMovie() {
// This command just plays the video of the button moving down and up.
_vm->_video->playMovieBlocking(2);
}
void RivenExternal::runDomeCheck() {
// Check if we clicked while the golden frame was showing
VideoHandle video = _vm->_video->findVideoHandle(1);
assert(video != NULL_VID_HANDLE);
int32 curFrame = _vm->_video->getCurFrame(video);
int32 frameCount = _vm->_video->getFrameCount(video);
// The final frame of the video is the 'golden' frame (double meaning: the
// frame that is the magic one is the one with the golden symbol) but we
// give a 3 frame leeway in either direction.
if (frameCount - curFrame < 3 || curFrame < 3)
*_vm->matchVarToString("domecheck") = 1;
}
// ------------------------------------------------------------------------------------
// aspit (Main Menu, Books, Setup) external commands
// ------------------------------------------------------------------------------------
void RivenExternal::xastartupbtnhide(uint16 argc, uint16 *argv) {
// The original game hides the start/setup buttons depending on an ini entry. It's safe to ignore this command.
// The original game hides the start/setup buttons depending on an ini entry.
// It's safe to ignore this command.
}
void RivenExternal::xasetupcomplete(uint16 argc, uint16 *argv) {
// The original game sets an ini entry to disable the setup button and use the start button only. It's safe to ignore this part of the command.
// The original game sets an ini entry to disable the setup button and use the
// start button only. It's safe to ignore this part of the command.
_vm->_sound->stopSound();
_vm->changeToCard(1);
}
@ -627,11 +650,11 @@ void RivenExternal::xbisland190_slidermw(uint16 argc, uint16 *argv) {
}
void RivenExternal::xbscpbtn(uint16 argc, uint16 *argv) {
// TODO: Dome related
runDomeButtonMovie();
}
void RivenExternal::xbisland_domecheck(uint16 argc, uint16 *argv) {
// TODO: Dome related
runDomeCheck();
}
void RivenExternal::xvalvecontrol(uint16 argc, uint16 *argv) {
@ -723,11 +746,11 @@ void RivenExternal::xgisland25_slidermw(uint16 argc, uint16 *argv) {
}
void RivenExternal::xgscpbtn(uint16 argc, uint16 *argv) {
// TODO: Dome related
runDomeButtonMovie();
}
void RivenExternal::xgisland1490_domecheck(uint16 argc, uint16 *argv) {
// TODO: Dome related
runDomeCheck();
}
void RivenExternal::xgplateau3160_dopools(uint16 argc, uint16 *argv) {
@ -978,11 +1001,11 @@ void RivenExternal::xjdome25_slidermw(uint16 argc, uint16 *argv) {
}
void RivenExternal::xjscpbtn(uint16 argc, uint16 *argv) {
// TODO: Dome related
runDomeButtonMovie();
}
void RivenExternal::xjisland3500_domecheck(uint16 argc, uint16 *argv) {
// TODO: Dome related
runDomeCheck();
}
int RivenExternal::jspitElevatorLoop() {
@ -1258,11 +1281,11 @@ void RivenExternal::xpisland990_elevcombo(uint16 argc, uint16 *argv) {
}
void RivenExternal::xpscpbtn(uint16 argc, uint16 *argv) {
// TODO: Dome related
runDomeButtonMovie();
}
void RivenExternal::xpisland290_domecheck(uint16 argc, uint16 *argv) {
// TODO: Dome related
runDomeCheck();
}
void RivenExternal::xpisland25_opencard(uint16 argc, uint16 *argv) {
@ -1457,11 +1480,11 @@ void RivenExternal::xtakeit(uint16 argc, uint16 *argv) {
}
void RivenExternal::xtscpbtn(uint16 argc, uint16 *argv) {
// TODO: Dome related
runDomeButtonMovie();
}
void RivenExternal::xtisland4990_domecheck(uint16 argc, uint16 *argv) {
// TODO: Dome related
runDomeCheck();
}
void RivenExternal::xtisland5056_opencard(uint16 argc, uint16 *argv) {

View File

@ -57,6 +57,8 @@ private:
int jspitElevatorLoop();
void runDemoBoundaryDialog();
void runEndGame(uint16 video);
void runDomeCheck();
void runDomeButtonMovie();
// -----------------------------------------------------
// aspit (Main Menu, Books, Setup) external commands

View File

@ -89,7 +89,7 @@ void VideoManager::playMovieCentered(Common::String filename, bool clearScreen)
void VideoManager::waitUntilMovieEnds(VideoHandle videoHandle) {
bool continuePlaying = true;
while (!_videoStreams[videoHandle]->endOfVideo() && !_vm->shouldQuit() && continuePlaying) {
while (_videoStreams[videoHandle].video && !_videoStreams[videoHandle]->endOfVideo() && !_vm->shouldQuit() && continuePlaying) {
if (updateBackgroundMovies())
_vm->_system->updateScreen();
@ -120,8 +120,8 @@ void VideoManager::waitUntilMovieEnds(VideoHandle videoHandle) {
_vm->_system->delayMillis(10);
}
_videoStreams[videoHandle]->close();
_videoStreams.clear();
delete _videoStreams[videoHandle].video;
memset(&_videoStreams[videoHandle], 0, sizeof(VideoEntry));
}
void VideoManager::playBackgroundMovie(Common::String filename, int16 x, int16 y, bool loop) {
@ -374,4 +374,24 @@ VideoHandle VideoManager::createVideoHandle(Common::String filename, uint16 x, u
return _videoStreams.size() - 1;
}
VideoHandle VideoManager::findVideoHandle(uint16 id) {
for (uint16 i = 0; i < _mlstRecords.size(); i++)
if (_mlstRecords[i].code == id)
for (uint16 j = 0; j < _videoStreams.size(); j++)
if (_videoStreams[j].video && _mlstRecords[i].movieID == _videoStreams[j].id)
return j;
return NULL_VID_HANDLE;
}
int32 VideoManager::getCurFrame(const VideoHandle &handle) {
assert(handle != NULL_VID_HANDLE);
return _videoStreams[handle]->getCurFrame();
}
uint32 VideoManager::getFrameCount(const VideoHandle &handle) {
assert(handle != NULL_VID_HANDLE);
return _videoStreams[handle]->getFrameCount();
}
} // End of namespace Mohawk

View File

@ -92,6 +92,11 @@ public:
// Riven-related variables
Common::Array<MLSTRecord> _mlstRecords;
// Handle functions
VideoHandle findVideoHandle(uint16 id);
int32 getCurFrame(const VideoHandle &handle);
uint32 getFrameCount(const VideoHandle &handle);
private:
MohawkEngine *_vm;