[Scummvm-git-logs] scummvm master -> fba8e81c060eecd423f4678f88f105f013f18134
elasota
noreply at scummvm.org
Sat Apr 29 20:04:25 UTC 2023
This automated email contains information about 7 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
5c50664449 VCRUISE: Add animation skip action.
4247c43e96 VCRUISE: Add exit op (fixes ending).
deca5cd80d VCRUISE: Hide menu in credits.
ffd67b8739 VCRUISE: Refactor mute behavior so toggle mute can be implemented.
76affb89c7 VCRUISE: Add sound keybinds
537a0a16b9 VCRUISE: Add idle animation interaction locks.
fba8e81c06 VCRUISE: Fix volumeDn2 opcode, which should fix many sounds continuing to play after they should be stopped.
Commit: 5c506644499a8ef0bdc02017af09910e653cb3b7
https://github.com/scummvm/scummvm/commit/5c506644499a8ef0bdc02017af09910e653cb3b7
Author: elasota (ejlasota at gmail.com)
Date: 2023-04-29T16:03:47-04:00
Commit Message:
VCRUISE: Add animation skip action.
Changed paths:
engines/vcruise/metaengine.cpp
engines/vcruise/runtime.cpp
engines/vcruise/runtime.h
engines/vcruise/vcruise.cpp
diff --git a/engines/vcruise/metaengine.cpp b/engines/vcruise/metaengine.cpp
index 3db4b06b340..57b5d41a1d7 100644
--- a/engines/vcruise/metaengine.cpp
+++ b/engines/vcruise/metaengine.cpp
@@ -160,6 +160,10 @@ Common::Array<Common::Keymap *> VCruiseMetaEngine::initKeymaps(const char *targe
act->addDefaultInputMapping("F12");
keymap->addAction(act);
+ act = new Common::Action("VCRUISE_SKIP_ANIMATION", _("Skip current animation"));
+ act->setCustomEngineActionEvent(VCruise::kKeymappedEventSkipAnimation);
+ keymap->addAction(act);
+
return Common::Keymap::arrayOf(keymap);
}
diff --git a/engines/vcruise/runtime.cpp b/engines/vcruise/runtime.cpp
index 89502f806d8..4b11e469eb0 100644
--- a/engines/vcruise/runtime.cpp
+++ b/engines/vcruise/runtime.cpp
@@ -188,7 +188,7 @@ const MapScreenDirectionDef *MapDef::getScreenDirection(uint screen, uint direct
ScriptEnvironmentVars::ScriptEnvironmentVars() : lmb(false), lmbDrag(false), esc(false), exitToMenu(false), panInteractionID(0), fpsOverride(0), lastHighlightedItem(0) {
}
-OSEvent::OSEvent() : type(kOSEventTypeInvalid), keyCode(static_cast<Common::KeyCode>(0)) {
+OSEvent::OSEvent() : type(kOSEventTypeInvalid), keyCode(static_cast<Common::KeyCode>(0)), keymappedEvent(kKeymappedEventNone) {
}
void Runtime::RenderSection::init(const Common::Rect ¶mRect, const Graphics::PixelFormat &fmt) {
@@ -1325,6 +1325,8 @@ bool Runtime::runWaitForAnimation() {
_gameState = kGameStateScript;
return true;
}
+ } else if (evt.type == kOSEventTypeKeymappedEvent && evt.keymappedEvent == kKeymappedEventSkipAnimation) {
+ _animFrameRateLock = Fraction(600, 1);
}
}
@@ -3839,6 +3841,14 @@ void Runtime::onKeyDown(Common::KeyCode keyCode) {
queueOSEvent(evt);
}
+void Runtime::onKeymappedEvent(KeymappedEvent kme) {
+ OSEvent evt;
+ evt.type = kOSEventTypeKeymappedEvent;
+ evt.keymappedEvent = kme;
+
+ queueOSEvent(evt);
+}
+
bool Runtime::canSave() const {
return !!_saveGame;
}
diff --git a/engines/vcruise/runtime.h b/engines/vcruise/runtime.h
index 719158e292e..3acefaa438d 100644
--- a/engines/vcruise/runtime.h
+++ b/engines/vcruise/runtime.h
@@ -415,9 +415,13 @@ enum OSEventType {
kOSEventTypeLButtonUp,
kOSEventTypeKeyDown,
+
+ kOSEventTypeKeymappedEvent,
};
enum KeymappedEvent {
+ kKeymappedEventNone,
+
kKeymappedEventHelp,
kKeymappedEventSaveGame,
kKeymappedEventLoadGame,
@@ -430,6 +434,8 @@ enum KeymappedEvent {
kKeymappedEventMusicVolumeUp,
kKeymappedEventSoundVolumeDown,
kKeymappedEventSoundVolumeUp,
+
+ kKeymappedEventSkipAnimation,
};
struct OSEvent {
@@ -438,6 +444,7 @@ struct OSEvent {
OSEventType type;
Common::Point pos;
Common::KeyCode keyCode;
+ KeymappedEvent keymappedEvent;
uint32 timestamp;
};
@@ -461,6 +468,7 @@ public:
void onLButtonUp(int16 x, int16 y);
void onMouseMove(int16 x, int16 y);
void onKeyDown(Common::KeyCode keyCode);
+ void onKeymappedEvent(KeymappedEvent evt);
bool canSave() const;
bool canLoad() const;
diff --git a/engines/vcruise/vcruise.cpp b/engines/vcruise/vcruise.cpp
index 46ea020ec37..9c385869b6f 100644
--- a/engines/vcruise/vcruise.cpp
+++ b/engines/vcruise/vcruise.cpp
@@ -63,6 +63,9 @@ void VCruiseEngine::handleEvents() {
case Common::EVENT_KEYDOWN:
_runtime->onKeyDown(evt.kbd.keycode);
break;
+ case Common::EVENT_CUSTOM_ENGINE_ACTION_START:
+ _runtime->onKeymappedEvent(static_cast<VCruise::KeymappedEvent>(evt.customType));
+ break;
default:
break;
}
Commit: 4247c43e9637ae7d211d2e3b641a1377055f5972
https://github.com/scummvm/scummvm/commit/4247c43e9637ae7d211d2e3b641a1377055f5972
Author: elasota (ejlasota at gmail.com)
Date: 2023-04-29T16:03:47-04:00
Commit Message:
VCRUISE: Add exit op (fixes ending).
Changed paths:
engines/vcruise/runtime.cpp
engines/vcruise/script.cpp
diff --git a/engines/vcruise/runtime.cpp b/engines/vcruise/runtime.cpp
index 4b11e469eb0..3d0ddcd71da 100644
--- a/engines/vcruise/runtime.cpp
+++ b/engines/vcruise/runtime.cpp
@@ -5138,7 +5138,24 @@ void Runtime::scriptOpSave0(ScriptArg_t arg) {
}
void Runtime::scriptOpExit(ScriptArg_t arg) {
- warning("exit op not implemented");
+ _isInGame = false;
+ _saveGame.reset();
+
+ if (_gameID == GID_REAH) {
+ _havePendingScreenChange = true;
+ _forceScreenChange = true;
+
+ _roomNumber = 40;
+ _screenNumber = 0xa1;
+
+ terminateScript();
+
+ changeMusicTrack(0);
+ if (_musicPlayer)
+ _musicPlayer->setVolumeAndBalance(100, 0);
+ } else {
+ error("Don't know what screen to go to on exit");
+ }
}
void Runtime::scriptOpNot(ScriptArg_t arg) {
diff --git a/engines/vcruise/script.cpp b/engines/vcruise/script.cpp
index 93e728abefc..4661241a07b 100644
--- a/engines/vcruise/script.cpp
+++ b/engines/vcruise/script.cpp
@@ -461,7 +461,7 @@ static ScriptNamedInstruction g_namedInstructions[] = {
{"backStart", ProtoOp::kProtoOpScript, ScriptOps::kBackStart},
{"saveAs", ProtoOp::kProtoOpScript, ScriptOps::kSaveAs},
{"save0", ProtoOp::kProtoOpNoop, ScriptOps::kSave0},
- {"exit", ProtoOp::kProtoOpNoop, ScriptOps::kExit},
+ {"exit", ProtoOp::kProtoOpScript, ScriptOps::kExit},
{"allowedSave", ProtoOp::kProtoOpNoop, ScriptOps::kInvalid},
};
Commit: deca5cd80d1023dd6ad7983099f860a856415137
https://github.com/scummvm/scummvm/commit/deca5cd80d1023dd6ad7983099f860a856415137
Author: elasota (ejlasota at gmail.com)
Date: 2023-04-29T16:03:47-04:00
Commit Message:
VCRUISE: Hide menu in credits.
Changed paths:
engines/vcruise/runtime.cpp
diff --git a/engines/vcruise/runtime.cpp b/engines/vcruise/runtime.cpp
index 3d0ddcd71da..d8fdd715c43 100644
--- a/engines/vcruise/runtime.cpp
+++ b/engines/vcruise/runtime.cpp
@@ -3642,7 +3642,7 @@ void Runtime::changeToMenuPage(MenuPage *menuPage) {
void Runtime::checkInGameMenuHover() {
if (_inGameMenuState == kInGameMenuStateInvisible) {
- if (_menuSection.rect.contains(_mousePos)) {
+ if (_menuSection.rect.contains(_mousePos) && _isInGame) {
// Figure out what elements should be visible
// Help
@@ -3669,7 +3669,7 @@ void Runtime::checkInGameMenuHover() {
if (_inGameMenuState == kInGameMenuStateInvisible)
return;
- if (!_menuSection.rect.contains(_mousePos)) {
+ if (!_menuSection.rect.contains(_mousePos) || !_isInGame) {
if (_inGameMenuState != kInGameMenuStateClickingOver && _inGameMenuState != kInGameMenuStateClickingNotOver && _inGameMenuState != kInGameMenuStateClickingInactive) {
dismissInGameMenu();
return;
Commit: ffd67b8739a3c3e0b4e9282fc01aeb5c350966b1
https://github.com/scummvm/scummvm/commit/ffd67b8739a3c3e0b4e9282fc01aeb5c350966b1
Author: elasota (ejlasota at gmail.com)
Date: 2023-04-29T16:03:47-04:00
Commit Message:
VCRUISE: Refactor mute behavior so toggle mute can be implemented.
Changed paths:
engines/vcruise/menu.cpp
engines/vcruise/vcruise.cpp
engines/vcruise/vcruise.h
diff --git a/engines/vcruise/menu.cpp b/engines/vcruise/menu.cpp
index c4f3499cf33..bc1c4f366cd 100644
--- a/engines/vcruise/menu.cpp
+++ b/engines/vcruise/menu.cpp
@@ -619,15 +619,16 @@ void ReahSoundMenuPage::addPageContents() {
if (ConfMan.hasKey("music_volume"))
musVol = ConfMan.getInt("music_volume");
- _soundChecked = (sndVol != 0);
- _musicChecked = (musVol != 0);
+ bool musicMute = false;
+ if (ConfMan.hasKey("vcruise_mute_music"))
+ musicMute = ConfMan.getBool("vcruise_mute_music");
- // Set defaults so clicking the checkbox does something
- if (sndVol == 0)
- sndVol = 3 * Audio::Mixer::kMaxMixerVolume / 4;
+ bool soundMute = false;
+ if (ConfMan.hasKey("vcruise_mute_sound"))
+ soundMute = ConfMan.getBool("vcruise_mute_sound");
- if (musVol == 0)
- musVol = 3 * Audio::Mixer::kMaxMixerVolume / 4;
+ _soundChecked = !musicMute;
+ _musicChecked = !soundMute;
Graphics::Surface *soundGraphics = _menuInterface->getUIGraphic(17);
if (soundGraphics) {
@@ -705,27 +706,21 @@ void ReahSoundMenuPage::onSliderMoved(uint slider) {
}
void ReahSoundMenuPage::applySoundVolume() const {
- int vol = 0;
-
- if (_soundChecked)
- vol = _sliders[kSliderSound]._value * Audio::Mixer::kMaxMixerVolume / _sliders[kSliderSound]._maxValue;
+ int vol = _sliders[kSliderSound]._value * Audio::Mixer::kMaxMixerVolume / _sliders[kSliderSound]._maxValue;
ConfMan.setInt("sfx_volume", vol, ConfMan.getActiveDomainName());
+ ConfMan.setBool("vcruise_mute_sound", !_soundChecked, ConfMan.getActiveDomainName());
- if (g_engine->_mixer)
- g_engine->_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, vol);
+ g_engine->syncSoundSettings();
}
void ReahSoundMenuPage::applyMusicVolume() const {
- int vol = 0;
-
- if (_musicChecked)
- vol = _sliders[kSliderMusic]._value * Audio::Mixer::kMaxMixerVolume / _sliders[kSliderMusic]._maxValue;
+ int vol = _sliders[kSliderMusic]._value * Audio::Mixer::kMaxMixerVolume / _sliders[kSliderMusic]._maxValue;
ConfMan.setInt("music_volume", vol, ConfMan.getActiveDomainName());
+ ConfMan.setBool("vcruise_mute_music", !_musicChecked, ConfMan.getActiveDomainName());
- if (g_engine->_mixer)
- g_engine->_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, vol);
+ g_engine->syncSoundSettings();
}
ReahQuitMenuPage::ReahQuitMenuPage() : ReahMenuBarPage(kMenuBarButtonQuit) {
diff --git a/engines/vcruise/vcruise.cpp b/engines/vcruise/vcruise.cpp
index 9c385869b6f..509780b3653 100644
--- a/engines/vcruise/vcruise.cpp
+++ b/engines/vcruise/vcruise.cpp
@@ -29,6 +29,8 @@
#include "common/algorithm.h"
#include "common/translation.h"
+#include "audio/mixer.h"
+
#include "gui/message.h"
#include "vcruise/runtime.h"
@@ -219,6 +221,44 @@ bool VCruiseEngine::hasFeature(EngineFeature f) const {
};
}
+void VCruiseEngine::syncSoundSettings() {
+ // Sync the engine with the config manager
+ int soundVolumeMusic = ConfMan.getInt("music_volume");
+ int soundVolumeSFX = ConfMan.getInt("sfx_volume");
+ int soundVolumeSpeech = ConfMan.getInt("speech_volume");
+
+ bool mute = false;
+ if (ConfMan.hasKey("mute"))
+ mute = ConfMan.getBool("mute");
+
+ // We need to handle the speech mute separately here. This is because the
+ // engine code should be able to rely on all speech sounds muted when the
+ // user specified subtitles only mode, which results in "speech_mute" to
+ // be set to "true". The global mute setting has precedence over the
+ // speech mute setting though.
+ bool speechMute = mute;
+ if (!speechMute)
+ speechMute = ConfMan.getBool("speech_mute");
+
+ bool muteMusic = false;
+ if (ConfMan.hasKey("vcruise_mute_music"))
+ muteMusic = ConfMan.getBool("vcruise_mute_music");
+
+ bool muteSound = ConfMan.getBool("vcruise_mute_sound");
+ if (ConfMan.hasKey("vcruise_mute_sound"))
+ muteSound = ConfMan.getBool("vcruise_mute_sound");
+
+ _mixer->muteSoundType(Audio::Mixer::kPlainSoundType, mute || muteSound);
+ _mixer->muteSoundType(Audio::Mixer::kMusicSoundType, mute || muteMusic);
+ _mixer->muteSoundType(Audio::Mixer::kSFXSoundType, mute || muteSound);
+ _mixer->muteSoundType(Audio::Mixer::kSpeechSoundType, speechMute || muteSound);
+
+ _mixer->setVolumeForSoundType(Audio::Mixer::kPlainSoundType, Audio::Mixer::kMaxMixerVolume);
+ _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, soundVolumeMusic);
+ _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, soundVolumeSFX);
+ _mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, soundVolumeSpeech);
+}
+
Common::Error VCruiseEngine::saveGameStream(Common::WriteStream *stream, bool isAutosave) {
_runtime->saveGame(stream);
diff --git a/engines/vcruise/vcruise.h b/engines/vcruise/vcruise.h
index ef0e1905d95..a99cee86fbb 100644
--- a/engines/vcruise/vcruise.h
+++ b/engines/vcruise/vcruise.h
@@ -49,7 +49,7 @@ public:
~VCruiseEngine() override;
bool hasFeature(EngineFeature f) const override;
- //void syncSoundSettings() override;
+ void syncSoundSettings() override;
const VCruiseGameDescription *_gameDescription;
Commit: 76affb89c792c3ee4189a1ed94b5220d027f2de6
https://github.com/scummvm/scummvm/commit/76affb89c792c3ee4189a1ed94b5220d027f2de6
Author: elasota (ejlasota at gmail.com)
Date: 2023-04-29T16:03:47-04:00
Commit Message:
VCRUISE: Add sound keybinds
Changed paths:
engines/vcruise/menu.cpp
engines/vcruise/menu.h
engines/vcruise/runtime.cpp
engines/vcruise/runtime.h
diff --git a/engines/vcruise/menu.cpp b/engines/vcruise/menu.cpp
index bc1c4f366cd..9ca2eda7423 100644
--- a/engines/vcruise/menu.cpp
+++ b/engines/vcruise/menu.cpp
@@ -94,7 +94,7 @@ protected:
int _maxValue;
};
-private:
+protected:
void drawButtonInState(uint buttonIndex, ButtonState state) const;
void drawCheckboxInState(uint buttonIndex, CheckboxState state) const;
void drawSlider(uint sliderIndex) const;
@@ -104,7 +104,6 @@ private:
void handleMouseDown(const Common::Point &pt, bool &outChangedState);
void handleMouseUp(const Common::Point &pt, bool &outChangedState);
-protected:
Common::Array<Button> _buttons;
Common::Array<Button> _checkboxes;
Common::Array<Slider> _sliders;
@@ -151,6 +150,7 @@ public:
ReahSoundMenuPage();
void addPageContents() override;
+ void onSettingsChanged() override;
protected:
void eraseSlider(uint sliderIndex) const override;
@@ -627,8 +627,8 @@ void ReahSoundMenuPage::addPageContents() {
if (ConfMan.hasKey("vcruise_mute_sound"))
soundMute = ConfMan.getBool("vcruise_mute_sound");
- _soundChecked = !musicMute;
- _musicChecked = !soundMute;
+ _soundChecked = !soundMute;
+ _musicChecked = !musicMute;
Graphics::Surface *soundGraphics = _menuInterface->getUIGraphic(17);
if (soundGraphics) {
@@ -669,6 +669,45 @@ void ReahSoundMenuPage::addPageContents() {
}
}
+void ReahSoundMenuPage::onSettingsChanged() {
+ int sndVol = 0;
+ if (ConfMan.hasKey("sfx_volume"))
+ sndVol = ConfMan.getInt("sfx_volume");
+
+ int musVol = 0;
+ if (ConfMan.hasKey("music_volume"))
+ musVol = ConfMan.getInt("music_volume");
+
+ bool musicMute = false;
+ if (ConfMan.hasKey("vcruise_mute_music"))
+ musicMute = ConfMan.getBool("vcruise_mute_music");
+
+ bool soundMute = false;
+ if (ConfMan.hasKey("vcruise_mute_sound"))
+ soundMute = ConfMan.getBool("vcruise_mute_sound");
+
+ _soundChecked = !soundMute;
+ _musicChecked = !musicMute;
+
+ eraseSlider(kSliderSound);
+ eraseSlider(kSliderMusic);
+
+ _sliders[kSliderSound]._value = sndVol * kSoundSliderWidth / Audio::Mixer::kMaxMixerVolume;
+ _sliders[kSliderMusic]._value = musVol * kSoundSliderWidth / Audio::Mixer::kMaxMixerVolume;
+
+ drawSlider(kSliderSound);
+ drawSlider(kSliderMusic);
+
+ // Release any active interactions with the checkboxes
+ if ((_interactionState == kInteractionStateClickingOnCheckbox || _interactionState == kInteractionStateClickingOffCheckbox)
+ && (_interactionIndex == kCheckboxMusic || _interactionIndex == kCheckboxSound)) {
+ _interactionState = kInteractionStateNotInteracting;
+ }
+
+ drawCheckboxInState(kCheckboxSound, _soundChecked ? kCheckboxStateOn : kCheckboxStateOff);
+ drawCheckboxInState(kCheckboxMusic, _musicChecked ? kCheckboxStateOn : kCheckboxStateOff);
+}
+
void ReahSoundMenuPage::eraseSlider(uint sliderIndex) const {
Graphics::Surface *soundBG = _menuInterface->getUIGraphic(16);
@@ -870,6 +909,9 @@ void MenuPage::init(const MenuInterface *menuInterface) {
void MenuPage::start() {
}
+void MenuPage::onSettingsChanged() {
+}
+
bool MenuPage::run() {
return false;
}
diff --git a/engines/vcruise/menu.h b/engines/vcruise/menu.h
index 9806f1bedd9..cf9407a37ea 100644
--- a/engines/vcruise/menu.h
+++ b/engines/vcruise/menu.h
@@ -72,6 +72,7 @@ public:
virtual void start();
virtual bool run();
+ virtual void onSettingsChanged();
protected:
const MenuInterface *_menuInterface;
diff --git a/engines/vcruise/runtime.cpp b/engines/vcruise/runtime.cpp
index d8fdd715c43..a77bc71af8c 100644
--- a/engines/vcruise/runtime.cpp
+++ b/engines/vcruise/runtime.cpp
@@ -1935,6 +1935,8 @@ bool Runtime::popOSEvent(OSEvent &evt) {
_lmbReleaseWasClick = !_lmbDragging;
_lmbDown = false;
_lmbDragging = false;
+ } else if (tempEvent.type == kOSEventTypeKeymappedEvent) {
+ processUniversalKeymappedEvents(tempEvent.keymappedEvent);
}
evt = tempEvent;
@@ -1944,6 +1946,63 @@ bool Runtime::popOSEvent(OSEvent &evt) {
return false;
}
+void Runtime::processUniversalKeymappedEvents(KeymappedEvent evt) {
+ const int soundSettingGranularity = 25;
+
+ switch (evt) {
+ case kKeymappedEventMusicToggle:
+ ConfMan.setBool("vcruise_mute_music", !(ConfMan.hasKey("vcruise_mute_music")) || !(ConfMan.getBool("vcruise_mute_music")), ConfMan.getActiveDomainName());
+ g_engine->syncSoundSettings();
+ if (_menuPage)
+ _menuPage->onSettingsChanged();
+ break;
+ case kKeymappedEventMusicVolumeUp: {
+ int newVol = ConfMan.getInt("music_volume") + soundSettingGranularity;
+ if (newVol > Audio::Mixer::kMaxMixerVolume)
+ newVol = Audio::Mixer::kMaxMixerVolume;
+ ConfMan.setInt("music_volume", newVol, ConfMan.getActiveDomainName());
+ g_engine->syncSoundSettings();
+ if (_menuPage)
+ _menuPage->onSettingsChanged();
+ } break;
+ case kKeymappedEventMusicVolumeDown: {
+ int newVol = ConfMan.getInt("music_volume") - soundSettingGranularity;
+ if (newVol < 0)
+ newVol = 0;
+ ConfMan.setInt("music_volume", newVol, ConfMan.getActiveDomainName());
+ g_engine->syncSoundSettings();
+ if (_menuPage)
+ _menuPage->onSettingsChanged();
+ } break;
+ case kKeymappedEventSoundToggle:
+ ConfMan.setBool("vcruise_mute_sound", !(ConfMan.hasKey("vcruise_mute_sound")) || !(ConfMan.getBool("vcruise_mute_sound")), ConfMan.getActiveDomainName());
+ g_engine->syncSoundSettings();
+ if (_menuPage)
+ _menuPage->onSettingsChanged();
+ break;
+ case kKeymappedEventSoundVolumeUp: {
+ int newVol = ConfMan.getInt("sfx_volume") + soundSettingGranularity;
+ if (newVol > Audio::Mixer::kMaxMixerVolume)
+ newVol = Audio::Mixer::kMaxMixerVolume;
+ ConfMan.setInt("sfx_volume", newVol, ConfMan.getActiveDomainName());
+ g_engine->syncSoundSettings();
+ if (_menuPage)
+ _menuPage->onSettingsChanged();
+ } break;
+ case kKeymappedEventSoundVolumeDown: {
+ int newVol = ConfMan.getInt("sfx_volume") - soundSettingGranularity;
+ if (newVol < 0)
+ newVol = 0;
+ ConfMan.setInt("sfx_volume", newVol, ConfMan.getActiveDomainName());
+ g_engine->syncSoundSettings();
+ if (_menuPage)
+ _menuPage->onSettingsChanged();
+ } break;
+ default:
+ break;
+ }
+}
+
void Runtime::queueOSEvent(const OSEvent &evt) {
OSEvent timedEvt = evt;
timedEvt.timestamp = g_system->getMillis();
diff --git a/engines/vcruise/runtime.h b/engines/vcruise/runtime.h
index 3acefaa438d..fac27fdda44 100644
--- a/engines/vcruise/runtime.h
+++ b/engines/vcruise/runtime.h
@@ -676,6 +676,8 @@ private:
bool popOSEvent(OSEvent &evt);
void queueOSEvent(const OSEvent &evt);
+ void processUniversalKeymappedEvents(KeymappedEvent evt);
+
void loadIndex();
void findWaves();
Common::SharedPtr<SoundInstance> loadWave(const Common::String &soundName, uint soundID, const Common::ArchiveMemberPtr &archiveMemberPtr);
Commit: 537a0a16b9cf205c6131335d3b2b94799273b4d7
https://github.com/scummvm/scummvm/commit/537a0a16b9cf205c6131335d3b2b94799273b4d7
Author: elasota (ejlasota at gmail.com)
Date: 2023-04-29T16:03:47-04:00
Commit Message:
VCRUISE: Add idle animation interaction locks.
Changed paths:
engines/vcruise/runtime.cpp
engines/vcruise/runtime.h
diff --git a/engines/vcruise/runtime.cpp b/engines/vcruise/runtime.cpp
index a77bc71af8c..7c9c26df181 100644
--- a/engines/vcruise/runtime.cpp
+++ b/engines/vcruise/runtime.cpp
@@ -849,7 +849,7 @@ Runtime::Runtime(OSystem *system, Audio::Mixer *mixer, const Common::FSNode &roo
_panoramaDirectionFlags(0),
_loadedAnimation(0), _loadedAnimationHasSound(false), _animPendingDecodeFrame(0), _animDisplayingFrame(0), _animFirstFrame(0), _animLastFrame(0), _animStopFrame(0),
_animStartTime(0), _animFramesDecoded(0), _animDecoderState(kAnimDecoderStateStopped),
- _animPlayWhileIdle(false), _idleIsOnInteraction(false), _idleHaveClickInteraction(false), _idleHaveDragInteraction(false), _idleInteractionID(0), _haveIdleStaticAnimation(false),
+ _animPlayWhileIdle(false), _idleLockInteractions(false), _idleIsOnInteraction(false), _idleHaveClickInteraction(false), _idleHaveDragInteraction(false), _idleInteractionID(0), _haveIdleStaticAnimation(false),
_inGameMenuState(kInGameMenuStateInvisible), _inGameMenuActiveElement(0), _inGameMenuButtonActive {false, false, false, false, false},
/*_loadedArea(0), */_lmbDown(false), _lmbDragging(false), _lmbReleaseWasClick(false), _lmbDownTime(0),
_delayCompletionTime(0),
@@ -1175,6 +1175,15 @@ bool Runtime::runIdle() {
_animPlayWhileIdle = false;
sanim.nextStartTime = timestamp + sanim.params.repeatDelay * 1000u;
sanim.currentAlternation = 1 - sanim.currentAlternation;
+
+ if (_idleLockInteractions) {
+ _idleLockInteractions = false;
+ bool changedState = dischargeIdleMouseMove();
+ if (changedState) {
+ drawCompass();
+ return true;
+ }
+ }
}
} else if (_haveIdleAnimations[_direction]) {
// Try to re-trigger
@@ -1183,6 +1192,14 @@ bool Runtime::runIdle() {
const AnimationDef &animDef = sanim.animDefs[sanim.currentAlternation];
changeAnimation(animDef, animDef.firstFrame, false, _animSpeedStaticAnim);
_animPlayWhileIdle = true;
+
+ _idleLockInteractions = sanim.params.lockInteractions;
+ if (_idleLockInteractions) {
+ _panoramaState = kPanoramaStateInactive;
+ bool changedState = dischargeIdleMouseMove();
+ assert(!changedState); // Shouldn't be changing state from this!
+ (void)changedState;
+ }
}
}
@@ -2301,7 +2318,8 @@ void Runtime::returnToIdleState() {
sanim.currentAlternation = 1;
}
}
-
+
+ _idleLockInteractions = false;
_idleIsOnInteraction = false;
_idleHaveClickInteraction = false;
_idleHaveDragInteraction = false;
@@ -2375,7 +2393,7 @@ bool Runtime::dischargeIdleMouseMove() {
bool isOnInteraction = false;
uint interactionID = 0;
- if (sdDef) {
+ if (sdDef && !_idleLockInteractions) {
for (const InteractionDef &idef : sdDef->interactions) {
if (idef.objectType == 1 && idef.rect.contains(relMouse)) {
isOnInteraction = true;
@@ -3351,7 +3369,7 @@ void Runtime::detectPanoramaDirections() {
}
void Runtime::detectPanoramaMouseMovement(uint32 timestamp) {
- if (_panoramaState == kPanoramaStateInactive && _inGameMenuState == kInGameMenuStateInvisible && (_lmbDragging || (_lmbDown && (timestamp - _lmbDownTime) >= 500)))
+ if (_panoramaState == kPanoramaStateInactive && _inGameMenuState == kInGameMenuStateInvisible && (_lmbDragging || (_lmbDown && (timestamp - _lmbDownTime) >= 500)) && !_idleLockInteractions)
panoramaActivate();
}
@@ -4408,14 +4426,17 @@ void Runtime::scriptOpAnim(ScriptArg_t arg) {
_direction = stackArgs[kAnimDefStackArgs + 1];
_havePendingScreenChange = true;
-
- uint cursorID = kCursorArrow;
- if (_scriptEnv.panInteractionID == kPanUpInteraction)
- cursorID = _panCursors[kPanCursorDraggableUp | kPanCursorDirectionUp];
- else if (_scriptEnv.panInteractionID == kPanDownInteraction)
- cursorID = _panCursors[kPanCursorDraggableDown | kPanCursorDirectionDown];
+ if (_loadedAnimationHasSound)
+ changeToCursor(nullptr);
+ else {
+ uint cursorID = kCursorArrow;
+ if (_scriptEnv.panInteractionID == kPanUpInteraction)
+ cursorID = _panCursors[kPanCursorDraggableUp | kPanCursorDirectionUp];
+ else if (_scriptEnv.panInteractionID == kPanDownInteraction)
+ cursorID = _panCursors[kPanCursorDraggableDown | kPanCursorDirectionDown];
- changeToCursor(_cursors[cursorID]);
+ changeToCursor(_cursors[cursorID]);
+ }
}
void Runtime::scriptOpStatic(ScriptArg_t arg) {
diff --git a/engines/vcruise/runtime.h b/engines/vcruise/runtime.h
index fac27fdda44..8c00b9f01f7 100644
--- a/engines/vcruise/runtime.h
+++ b/engines/vcruise/runtime.h
@@ -985,6 +985,7 @@ private:
Common::Array<Common::String> _animDefNames;
Common::HashMap<Common::String, uint> _animDefNameToIndex;
+ bool _idleLockInteractions;
bool _idleIsOnInteraction;
bool _idleHaveClickInteraction;
bool _idleHaveDragInteraction;
Commit: fba8e81c060eecd423f4678f88f105f013f18134
https://github.com/scummvm/scummvm/commit/fba8e81c060eecd423f4678f88f105f013f18134
Author: elasota (ejlasota at gmail.com)
Date: 2023-04-29T16:03:47-04:00
Commit Message:
VCRUISE: Fix volumeDn2 opcode, which should fix many sounds continuing to play after they should be stopped.
Changed paths:
engines/vcruise/runtime.cpp
diff --git a/engines/vcruise/runtime.cpp b/engines/vcruise/runtime.cpp
index 7c9c26df181..d31c08d752c 100644
--- a/engines/vcruise/runtime.cpp
+++ b/engines/vcruise/runtime.cpp
@@ -4945,13 +4945,20 @@ void Runtime::scriptOpVolumeDn2(ScriptArg_t arg) {
TAKE_STACK_INT_NAMED(1, sndParamArgs);
TAKE_STACK_VAR_NAMED(1, sndIDArgs);
- StackInt_t soundID = 0;
- SoundInstance *cachedSound = nullptr;
- resolveSoundByNameOrID(sndIDArgs[0], true, soundID, cachedSound);
+ uint32 durationMSec = static_cast<uint>(sndParamArgs[0]) * 100u;
- // FIXME: Just do this instantly
- if (cachedSound)
- triggerSoundRamp(*cachedSound, 1, sndParamArgs[0], false);
+ if (sndIDArgs[0].type == StackValue::kNumber && sndIDArgs[0].value.i == 0) {
+ // Apply to all sounds
+ for (const Common::SharedPtr<SoundInstance> &sndPtr : _activeSounds)
+ triggerSoundRamp(*sndPtr, durationMSec, 0, true);
+ } else {
+ StackInt_t soundID = 0;
+ SoundInstance *cachedSound = nullptr;
+ resolveSoundByNameOrID(sndIDArgs[0], true, soundID, cachedSound);
+
+ if (cachedSound)
+ triggerSoundRamp(*cachedSound, durationMSec, 0, true);
+ }
}
void Runtime::scriptOpVolumeDn3(ScriptArg_t arg) {
More information about the Scummvm-git-logs
mailing list