mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-14 13:50:13 +00:00
MYST3: Add yet another sound opcode
This commit is contained in:
parent
cd8af78b6b
commit
b33003dce7
@ -237,6 +237,7 @@ Script::Script(Myst3Engine *vm):
|
||||
OP_0(201, ambientApply );
|
||||
OP_1(202, ambientApplyWithFadeDelay, kEvalValue );
|
||||
OP_0(203, soundPlayBadClick );
|
||||
OP_5(204, soundPlayBlocking, kEvalValue, kEvalValue, kEvalValue, kEvalValue, kValue );
|
||||
OP_1(205, soundPlay, kEvalValue );
|
||||
OP_2(206, soundPlayVolume, kEvalValue, kEvalValue );
|
||||
OP_3(207, soundPlayVolumeDirection, kEvalValue, kEvalValue, kEvalValue );
|
||||
@ -2052,8 +2053,7 @@ void Script::drawXFrames(Context &c, const Opcode &cmd) {
|
||||
void Script::drawWhileCond(Context &c, const Opcode &cmd) {
|
||||
debugC(kDebugScript, "Opcode %d: While condition %d, draw", cmd.op, cmd.args[0]);
|
||||
|
||||
// TODO: Skippable with Escape
|
||||
while (_vm->_state->evaluate(cmd.args[0])) {
|
||||
while (_vm->_state->evaluate(cmd.args[0]) && !_vm->inputEscapePressed()) {
|
||||
_vm->processInput(true);
|
||||
_vm->drawFrame();
|
||||
}
|
||||
@ -2432,6 +2432,26 @@ void Script::soundPlayBadClick(Context &c, const Opcode &cmd) {
|
||||
_vm->_sound->playEffect(697, 5);
|
||||
}
|
||||
|
||||
void Script::soundPlayBlocking(Context &c, const Opcode &cmd) {
|
||||
debugC(kDebugScript, "Opcode %d: Play skippable sound %d", cmd.op, cmd.args[0]);
|
||||
|
||||
int16 soundId = cmd.args[0];
|
||||
int32 volume = _vm->_state->valueOrVarValue(cmd.args[1]);
|
||||
int32 heading = _vm->_state->valueOrVarValue(cmd.args[2]);
|
||||
int32 att = _vm->_state->valueOrVarValue(cmd.args[3]);
|
||||
bool nonBlocking = _vm->_state->valueOrVarValue(cmd.args[4]);
|
||||
_vm->_sound->playEffect(soundId, volume, heading, att);
|
||||
|
||||
if (nonBlocking || !_vm->_sound->isPlaying(soundId)) {
|
||||
return;
|
||||
}
|
||||
|
||||
while (_vm->_sound->isPlaying(soundId) && !_vm->inputEscapePressed()) {
|
||||
_vm->processInput(true);
|
||||
_vm->drawFrame();
|
||||
}
|
||||
}
|
||||
|
||||
void Script::soundPlay(Context &c, const Opcode &cmd) {
|
||||
debugC(kDebugScript, "Opcode %d: Play sound %d", cmd.op, cmd.args[0]);
|
||||
|
||||
|
@ -285,6 +285,7 @@ private:
|
||||
DECLARE_OPCODE(ambientApply);
|
||||
DECLARE_OPCODE(ambientApplyWithFadeDelay);
|
||||
DECLARE_OPCODE(soundPlayBadClick);
|
||||
DECLARE_OPCODE(soundPlayBlocking);
|
||||
DECLARE_OPCODE(soundPlay);
|
||||
DECLARE_OPCODE(soundPlayVolume);
|
||||
DECLARE_OPCODE(soundPlayVolumeDirection);
|
||||
|
@ -253,6 +253,12 @@ int32 Sound::playedFrames(uint32 id) {
|
||||
return channel->playedFrames();
|
||||
}
|
||||
|
||||
bool Sound::isPlaying(uint32 id) {
|
||||
bool soundPlaying;
|
||||
getChannelForSound(id, kAny, &soundPlaying);
|
||||
return soundPlaying;
|
||||
}
|
||||
|
||||
void Sound::setupNextSound(SoundNextCommand command, int16 controlVar, int16 startSoundId, int16 soundCount,
|
||||
int32 soundMinDelay, int32 soundMaxDelay, int32 controlSoundId, int32 controlSoundMaxPosition) {
|
||||
|
||||
|
@ -118,6 +118,7 @@ public:
|
||||
|
||||
void stopMusic(uint32 fadeDelay);
|
||||
|
||||
bool isPlaying(uint32 id);
|
||||
int32 playedFrames(uint32 id);
|
||||
|
||||
void update();
|
||||
|
Loading…
Reference in New Issue
Block a user