MYST3: Add the last sound opcode

This commit is contained in:
Bastien Bouclet 2014-03-09 20:23:10 +01:00
parent b98e019990
commit 9968bb1de0
7 changed files with 39 additions and 1 deletions

View File

@ -378,6 +378,19 @@ bool SimpleMovie::update() {
return !_bink.endOfVideo() && _bink.getCurFrame() < _endFrame;
}
void SimpleMovie::playStartupSound() {
int32 soundId = _vm->_state->getMovieStartSoundId();
if (soundId) {
uint32 volume = _vm->_state->getMovieStartSoundVolume();
uint32 heading = _vm->_state->getMovieStartSoundHeading();
uint32 attenuation = _vm->_state->getMovieStartSoundAttenuation();
_vm->_sound->playEffect(soundId, volume, heading, attenuation);
_vm->_state->setMovieStartSoundId(0);
}
}
SimpleMovie::~SimpleMovie() {
}

View File

@ -143,6 +143,8 @@ public:
bool update();
void playStartupSound();
void setSynchronized(bool b) { _synchronized = b; }
private:
bool _synchronized;

View File

@ -948,6 +948,8 @@ void Myst3Engine::playSimpleMovie(uint16 id, bool fullframe) {
movie.setPosV(0);
}
movie.playStartupSound();
_drawables.push_back(&movie);
bool skip = false;

View File

@ -49,7 +49,6 @@ Script::Script(Myst3Engine *vm):
// TODO: Implement these remaining opcodes
// 5: I'm pretty sure it's useless
// 144: drawTransition
// 236: setupSoundForMovie
// 247: quit
OP_0( 0, badOpcode );
@ -266,6 +265,7 @@ Script::Script(Myst3Engine *vm):
OP_2(232, runSoundScriptNodeRoom, kEvalValue, kEvalValue );
OP_3(233, runSoundScriptNodeRoomAge, kEvalValue, kEvalValue, kEvalValue );
OP_1(234, soundStopMusic, kEvalValue );
OP_2(236, movieSetStartupSound, kEvalValue, kEvalValue );
OP_0(239, drawOneFrame );
OP_0(240, cursorHide );
OP_0(241, cursorShow );
@ -2706,6 +2706,18 @@ void Script::soundStopMusic(Context &c, const Opcode &cmd) {
_vm->_sound->stopMusic(fadeOutDuration);
}
void Script::movieSetStartupSound(Context &c, const Opcode &cmd) {
debugC(kDebugScript, "Opcode %d: Set movie startup sound %d", cmd.op, cmd.args[0]);
int32 soundId = _vm->_state->valueOrVarValue(cmd.args[0]);
int32 volume = _vm->_state->valueOrVarValue(cmd.args[1]);
_vm->_state->setMovieStartSoundId(soundId);
_vm->_state->setMovieStartSoundVolume(volume);
_vm->_state->setMovieStartSoundHeading(0);
_vm->_state->setMovieStartSoundAttenuation(0);
}
void Script::drawOneFrame(Context &c, const Opcode &cmd) {
debugC(kDebugScript, "Opcode %d: Draw one frame", cmd.op);

View File

@ -312,6 +312,7 @@ private:
DECLARE_OPCODE(runSoundScriptNodeRoom);
DECLARE_OPCODE(runSoundScriptNodeRoomAge);
DECLARE_OPCODE(soundStopMusic);
DECLARE_OPCODE(movieSetStartupSound);
DECLARE_OPCODE(drawOneFrame);
DECLARE_OPCODE(cursorHide);
DECLARE_OPCODE(cursorShow);

View File

@ -185,6 +185,10 @@ GameState::GameState(Myst3Engine *vm):
VAR(171, MovieUnk171, true)
VAR(172, MovieUnk172, true)
VAR(173, MoviePlayingVar, true)
VAR(174, MovieStartSoundId, true)
VAR(175, MovieStartSoundVolume, true)
VAR(176, MovieStartSoundHeading, true)
VAR(177, MovieStartSoundAttenuation, true)
VAR(178, MovieUseBackground, false)
VAR(179, CameraSkipAnimation, true)

View File

@ -157,6 +157,10 @@ public:
DECLARE_VAR(167, MovieOverridePosU)
DECLARE_VAR(168, MovieOverridePosV)
DECLARE_VAR(173, MoviePlayingVar)
DECLARE_VAR(174, MovieStartSoundId)
DECLARE_VAR(175, MovieStartSoundVolume)
DECLARE_VAR(176, MovieStartSoundHeading)
DECLARE_VAR(177, MovieStartSoundAttenuation)
DECLARE_VAR(178, MovieUseBackground)
DECLARE_VAR(179, CameraSkipAnimation)