mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-22 01:39:57 +00:00
MYST3: Add some sound related plumbering
This commit is contained in:
parent
12de58a4f8
commit
f15222b788
@ -137,6 +137,20 @@ void Menu::goToNode(uint16 node) {
|
||||
_vm->_state->setSaveThumbnail(thumb);
|
||||
big->free();
|
||||
delete big;
|
||||
|
||||
// Reset some sound variables
|
||||
if (_vm->_state->getLocationAge() == 6 && _vm->_state->getSoundEdannaUnk587() == 1 && _vm->_state->getSoundEdannaUnk1031()) {
|
||||
_vm->_state->setSoundEdannaUnk587(0);
|
||||
}
|
||||
if (_vm->_state->getLocationAge() == 10 && _vm->_state->getSoundAmateriaUnk627() == 1 && _vm->_state->getSoundAmateriaUnk930()){
|
||||
_vm->_state->setSoundAmateriaUnk627(0);
|
||||
}
|
||||
if (_vm->_state->getLocationAge() == 7 && _vm->_state->getSoundVoltaicUnk540() == 1 && _vm->_state->getSoundVoltaicUnk1146()) {
|
||||
_vm->_state->setSoundVoltaicUnk540(0);
|
||||
}
|
||||
|
||||
_vm->_sound->stopMusic(60);
|
||||
_vm->_state->setSoundScriptsSuspended(1);
|
||||
}
|
||||
|
||||
_vm->_state->setMenuEscapePressed(0);
|
||||
@ -330,6 +344,10 @@ void Menu::loadMenuLoad() {
|
||||
_vm->_state->setMenuSavedRoom(0);
|
||||
_vm->_state->setMenuSavedNode(0);
|
||||
|
||||
_vm->_sound->stopMusic(15);
|
||||
_vm->_state->setSoundScriptsSuspended(0);
|
||||
_vm->_sound->playEffect(696, 60);
|
||||
|
||||
_vm->goToNode(0, kTransitionFade);
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,7 @@ Myst3Engine::Myst3Engine(OSystem *syst, const Myst3GameDescription *version) :
|
||||
_inputSpacePressed(false), _inputEnterPressed(false),
|
||||
_inputEscapePressed(false), _inputTildePressed(false),
|
||||
_menuAction(0), _projectorBackground(0),
|
||||
_shakeEffect(0), _rotationEffect(0) {
|
||||
_shakeEffect(0), _rotationEffect(0), _backgroundSoundScriptLastRoomId(0) {
|
||||
DebugMan.addDebugChannel(kDebugVariable, "Variable", "Track Variable Accesses");
|
||||
DebugMan.addDebugChannel(kDebugSaveLoad, "SaveLoad", "Track Save/Load Function");
|
||||
DebugMan.addDebugChannel(kDebugScript, "Script", "Track Script Execution");
|
||||
@ -819,6 +819,9 @@ void Myst3Engine::runScriptsFromNode(uint16 nodeID, uint32 roomID, uint32 ageID)
|
||||
}
|
||||
|
||||
void Myst3Engine::runBackgroundSoundScriptsFromNode(uint16 nodeID, uint32 roomID, uint32 ageID) {
|
||||
if (_state->getSoundScriptsSuspended())
|
||||
return;
|
||||
|
||||
if (roomID == 0)
|
||||
roomID = _state->getLocationRoom();
|
||||
|
||||
@ -829,6 +832,24 @@ void Myst3Engine::runBackgroundSoundScriptsFromNode(uint16 nodeID, uint32 roomID
|
||||
|
||||
if (!nodeData) return;
|
||||
|
||||
// Stop previous music when changing room
|
||||
if (_backgroundSoundScriptLastRoomId != roomID) {
|
||||
if (_backgroundSoundScriptLastRoomId != 0
|
||||
&& _backgroundSoundScriptLastRoomId != 901
|
||||
&& _backgroundSoundScriptLastRoomId != 902
|
||||
&& roomID != 0 && roomID != 901 && roomID != 902) {
|
||||
_sound->stopMusic(_state->getSoundScriptFadeOutDelay());
|
||||
|
||||
if (nodeData->backgroundSoundScripts.size() != 0) {
|
||||
_state->setSoundScriptsPaused(1);
|
||||
_state->setSoundScriptsTimer(0);
|
||||
}
|
||||
}
|
||||
|
||||
_backgroundSoundScriptLastRoomId = roomID;
|
||||
}
|
||||
|
||||
|
||||
for (uint j = 0; j < nodeData->backgroundSoundScripts.size(); j++) {
|
||||
if (_state->evaluate(nodeData->backgroundSoundScripts[j].condition)) {
|
||||
if (!_scriptEngine->run(&nodeData->backgroundSoundScripts[j].script))
|
||||
@ -1246,6 +1267,10 @@ Common::Error Myst3Engine::loadGameState(int slot) {
|
||||
_state->setMenuSavedRoom(0);
|
||||
_state->setMenuSavedNode(0);
|
||||
|
||||
_sound->stopMusic(15);
|
||||
_state->setSoundScriptsSuspended(0);
|
||||
_sound->playEffect(696, 60);
|
||||
|
||||
goToNode(0, kTransitionNone);
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
@ -208,6 +208,8 @@ private:
|
||||
bool _inputEscapePressed;
|
||||
bool _inputTildePressed;
|
||||
|
||||
uint32 _backgroundSoundScriptLastRoomId;
|
||||
|
||||
HotSpot *getHoveredHotspot(NodePtr nodeData, uint16 var = 0);
|
||||
void updateCursor();
|
||||
|
||||
|
@ -102,6 +102,9 @@ void Puzzles::run(uint16 id, uint16 arg0, uint16 arg1, uint16 arg2) {
|
||||
case 21:
|
||||
mainMenu(arg0);
|
||||
break;
|
||||
case 22:
|
||||
updateSoundScriptTimer();
|
||||
break;
|
||||
case 23:
|
||||
_vm->loadNodeSubtitles(arg0);
|
||||
break;
|
||||
@ -1626,4 +1629,13 @@ void Puzzles::settingsSave() {
|
||||
ConfMan.flushToDisk();
|
||||
}
|
||||
|
||||
void Puzzles::updateSoundScriptTimer() {
|
||||
int frequency = 15 * ConfMan.getInt("music_frequency") / 100;
|
||||
if (_vm->_state->getSoundScriptsPaused()) {
|
||||
_vm->_state->setSoundScriptsTimer(60 * (20 - frequency));
|
||||
} else {
|
||||
_vm->_state->setSoundScriptsTimer(60 * (frequency + 5));
|
||||
}
|
||||
}
|
||||
|
||||
} // End of namespace Myst3
|
||||
|
@ -87,6 +87,8 @@ private:
|
||||
|
||||
void settingsSave();
|
||||
|
||||
void updateSoundScriptTimer();
|
||||
|
||||
void _drawForVarHelper(int16 var, int32 startValue, int32 endValue);
|
||||
void _drawXFrames(uint16 frames);
|
||||
};
|
||||
|
@ -156,11 +156,15 @@ GameState::GameState(Myst3Engine *vm):
|
||||
VAR(119, AmbiantFadeOutDelay, false)
|
||||
VAR(120, AmbiantPreviousFadeOutDelay, false)
|
||||
VAR(121, AmbientOverrideFadeOutDelay, false)
|
||||
VAR(122, SoundScriptsSuspended, false)
|
||||
|
||||
VAR(124, SoundNextMultipleSounds, false)
|
||||
VAR(125, SoundNextIsChoosen, false)
|
||||
VAR(126, SoundNextId, false)
|
||||
VAR(127, SoundNextIsLast, false)
|
||||
VAR(128, SoundScriptsTimer, false)
|
||||
VAR(129, SoundScriptsPaused, false)
|
||||
VAR(130, SoundScriptFadeOutDelay, false)
|
||||
|
||||
VAR(131, CursorLocked, false)
|
||||
VAR(132, CursorHidden, false)
|
||||
@ -278,6 +282,13 @@ GameState::GameState(Myst3Engine *vm):
|
||||
VAR(502, SymbolCode1LeftSolved, false)
|
||||
VAR(507, SymbolCode1RightSolved, false)
|
||||
|
||||
VAR(540, SoundVoltaicUnk540, false)
|
||||
VAR(587, SoundEdannaUnk587, false)
|
||||
VAR(627, SoundAmateriaUnk627, false)
|
||||
VAR(930, SoundAmateriaUnk930, false)
|
||||
VAR(1031, SoundEdannaUnk1031, false)
|
||||
VAR(1146, SoundVoltaicUnk1146, false)
|
||||
|
||||
VAR(1322, ZipModeEnabled, false)
|
||||
VAR(1323, SubtitlesEnabled, false)
|
||||
VAR(1324, WaterEffects, false)
|
||||
@ -322,28 +333,10 @@ GameState::GameState(Myst3Engine *vm):
|
||||
// Backup var for opcodes 245, 246 => find usage
|
||||
VAR(13, Unk13, true)
|
||||
|
||||
// Sound stuff
|
||||
VAR(122, Unk122, true)
|
||||
VAR(128, Unk128, true)
|
||||
VAR(129, Unk129, true)
|
||||
VAR(130, Unk130, true)
|
||||
|
||||
// ???
|
||||
VAR(147, MovieUnk147, true)
|
||||
VAR(148, MovieUnk148, true)
|
||||
|
||||
// Unknown sound debug thing
|
||||
VAR(539, Unk539, true)
|
||||
|
||||
// Ambiant sound stuff, to reimplement
|
||||
VAR(540, Unk540, true)
|
||||
VAR(587, Unk587, true)
|
||||
VAR(627, Unk627, true)
|
||||
VAR(678, Unk678, true)
|
||||
VAR(930, Unk930, true)
|
||||
VAR(1031, Unk1031, true)
|
||||
VAR(1146, Unk1146, true)
|
||||
|
||||
// Menu stuff does not look like it's too useful
|
||||
VAR(1361, Unk1361, true)
|
||||
VAR(1362, Unk1362, true)
|
||||
@ -644,6 +637,9 @@ void GameState::updateFrameCounters() {
|
||||
|
||||
if (getAmateriaSecondsCounter() > 0)
|
||||
setAmateriaSecondsCounter(getAmateriaSecondsCounter() - 1);
|
||||
|
||||
if (getSoundScriptsTimer() > 0)
|
||||
setSoundScriptsTimer(getSoundScriptsTimer() - 1);
|
||||
}
|
||||
|
||||
if (getSweepEnabled()) {
|
||||
|
@ -130,11 +130,15 @@ public:
|
||||
DECLARE_VAR(119, AmbiantFadeOutDelay)
|
||||
DECLARE_VAR(120, AmbiantPreviousFadeOutDelay)
|
||||
DECLARE_VAR(121, AmbientOverrideFadeOutDelay)
|
||||
DECLARE_VAR(122, SoundScriptsSuspended)
|
||||
|
||||
DECLARE_VAR(124, SoundNextMultipleSounds)
|
||||
DECLARE_VAR(125, SoundNextIsChoosen)
|
||||
DECLARE_VAR(126, SoundNextId)
|
||||
DECLARE_VAR(127, SoundNextIsLast)
|
||||
DECLARE_VAR(128, SoundScriptsTimer)
|
||||
DECLARE_VAR(129, SoundScriptsPaused)
|
||||
DECLARE_VAR(130, SoundScriptFadeOutDelay)
|
||||
|
||||
DECLARE_VAR(131, CursorLocked)
|
||||
DECLARE_VAR(132, CursorHidden)
|
||||
@ -239,6 +243,13 @@ public:
|
||||
DECLARE_VAR(502, SymbolCode1LeftSolved)
|
||||
DECLARE_VAR(507, SymbolCode1RightSolved)
|
||||
|
||||
DECLARE_VAR(540, SoundVoltaicUnk540)
|
||||
DECLARE_VAR(587, SoundEdannaUnk587)
|
||||
DECLARE_VAR(627, SoundAmateriaUnk627)
|
||||
DECLARE_VAR(930, SoundAmateriaUnk930)
|
||||
DECLARE_VAR(1031, SoundEdannaUnk1031)
|
||||
DECLARE_VAR(1146, SoundVoltaicUnk1146)
|
||||
|
||||
DECLARE_VAR(1322, ZipModeEnabled)
|
||||
DECLARE_VAR(1323, SubtitlesEnabled)
|
||||
DECLARE_VAR(1324, WaterEffects)
|
||||
|
Loading…
Reference in New Issue
Block a user