[Scummvm-git-logs] scummvm master -> 9f7ae73a7b7318311e5cc52d36e451cacfba8a02
grechnik
diamondaz at yandex.ru
Fri Oct 19 23:32:19 CEST 2018
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
9f7ae73a7b LASTEXPRESS: loud train noise when NPC exits car
Commit: 9f7ae73a7b7318311e5cc52d36e451cacfba8a02
https://github.com/scummvm/scummvm/commit/9f7ae73a7b7318311e5cc52d36e451cacfba8a02
Author: Evgeny Grechnikov (diamondaz at yandex.ru)
Date: 2018-10-20T00:32:10+03:00
Commit Message:
LASTEXPRESS: loud train noise when NPC exits car
If Cath stands near the beginning or the end of a car,
looks at a door, and a NPC opens this door,
the volume of train noise is temporarily raised.
Controlled by variables SoundManager::_data{0,1,2},
renamed to be not so mysterious.
Changed paths:
engines/lastexpress/sound/queue.cpp
engines/lastexpress/sound/sound.cpp
engines/lastexpress/sound/sound.h
diff --git a/engines/lastexpress/sound/queue.cpp b/engines/lastexpress/sound/queue.cpp
index 5107383..3a10a7a 100644
--- a/engines/lastexpress/sound/queue.cpp
+++ b/engines/lastexpress/sound/queue.cpp
@@ -86,9 +86,9 @@ void SoundQueue::updateQueue() {
if (!entry || getFlags()->flag_3 || (entry && entry->getTime() > getSound()->getAmbientSoundDuration())) {
getSound()->playAmbientSound(0x45);
} else {
- if (getSound()->getData1() && getSound()->getData2() >= getSound()->getData1()) {
- entry->setVolumeSmoothly((SoundFlag)getSound()->getData0());
- getSound()->setData1(0);
+ if (getSound()->needToChangeAmbientVolume()) {
+ entry->setVolumeSmoothly(getSound()->getChangedAmbientVolume());
+ getSound()->clearAmbientVolumeChange();
}
}
}
diff --git a/engines/lastexpress/sound/sound.cpp b/engines/lastexpress/sound/sound.cpp
index c28b734..597edd3 100644
--- a/engines/lastexpress/sound/sound.cpp
+++ b/engines/lastexpress/sound/sound.cpp
@@ -119,10 +119,8 @@ SoundManager::SoundManager(LastExpressEngine *engine) : _engine(engine) {
memset(&_lastWarning, 0, sizeof(_lastWarning));
- // Initialize unknown data
- _data0 = 0;
- _data1 = 0;
- _data2 = 0;
+ _ambientVolumeChangeTimeMS = _ambientVolumeChangeDelayMS = 0;
+ _ambientScheduledVolume = kVolumeNone;
}
SoundManager::~SoundManager() {
@@ -181,6 +179,10 @@ bool SoundManager::playSoundWithSubtitles(Common::String filename, uint32 flag,
return (entry->getTag() != kSoundTagNone);
}
+bool SoundManager::needToChangeAmbientVolume() {
+ return _ambientScheduledVolume && _engine->_system->getMillis() - _ambientVolumeChangeTimeMS >= _ambientVolumeChangeDelayMS;
+}
+
void SoundManager::playSoundEvent(EntityIndex entity, byte action, byte activateDelay) {
int values[5];
@@ -195,18 +197,20 @@ void SoundManager::playSoundEvent(EntityIndex entity, byte action, byte activate
switch (action) {
case 36: {
- int _param3 = (flag <= 9) ? flag + 7 : 16;
+ uint newVolume = (flag <= kVolumeFull - 7) ? flag + 7 : kVolumeFull;
- if (_param3 > 7) {
- _data0 = (uint)_param3;
- _data1 = _data2 + 2 * activateDelay;
+ if (newVolume > kVolume7) {
+ _ambientScheduledVolume = (SoundFlag)newVolume;
+ _ambientVolumeChangeTimeMS = _engine->_system->getMillis();
+ _ambientVolumeChangeDelayMS = activateDelay * 1000 / 15;
}
break;
}
case 37:
- _data0 = 7;
- _data1 = _data2 + 2 * activateDelay;
+ _ambientScheduledVolume = kVolume7;
+ _ambientVolumeChangeTimeMS = _engine->_system->getMillis();
+ _ambientVolumeChangeDelayMS = activateDelay * 1000 / 15;
break;
case 150:
diff --git a/engines/lastexpress/sound/sound.h b/engines/lastexpress/sound/sound.h
index f832574..e4ffbd9 100644
--- a/engines/lastexpress/sound/sound.h
+++ b/engines/lastexpress/sound/sound.h
@@ -65,13 +65,12 @@ public:
// Accessors
SoundQueue *getQueue() { return _queue; }
- uint32 getData0() { return _data0; }
- int32 getData1() { return _data1; }
- int32 getData2() { return _data2; }
uint32 getAmbientSoundDuration() { return _ambientSoundDuration; }
+ bool needToChangeAmbientVolume();
+ SoundFlag getChangedAmbientVolume() { return _ambientScheduledVolume; }
// Setters
- void setData1(int32 data) { _data1 = data; }
+ void clearAmbientVolumeChange() { _ambientScheduledVolume = kVolumeNone; }
private:
LastExpressEngine *_engine;
@@ -80,13 +79,10 @@ private:
// Compartment warnings by Mertens or Coudert
uint32 _lastWarning[12];
- // Looping sound
+ // Ambient sound
int _ambientSoundDuration;
-
- // Unknown data
- uint32 _data0;
- int32 _data1;
- int32 _data2;
+ uint32 _ambientVolumeChangeTimeMS, _ambientVolumeChangeDelayMS;
+ SoundFlag _ambientScheduledVolume;
};
} // End of namespace LastExpress
More information about the Scummvm-git-logs
mailing list