aboutsummaryrefslogtreecommitdiff
path: root/engines/lastexpress/sound/entry.h
diff options
context:
space:
mode:
authorEvgeny Grechnikov2018-10-16 23:01:26 +0300
committerEvgeny Grechnikov2018-10-16 23:01:26 +0300
commit29f6ce1d9a69663c9a040f5dd091bb07427d1aa7 (patch)
tree0cc5fc4ab0a994620c894414e4ba79740b70e46f /engines/lastexpress/sound/entry.h
parentcc5d858169116c2758c4c3c0eb0cf983b9ccce21 (diff)
downloadscummvm-rg350-29f6ce1d9a69663c9a040f5dd091bb07427d1aa7.tar.gz
scummvm-rg350-29f6ce1d9a69663c9a040f5dd091bb07427d1aa7.tar.bz2
scummvm-rg350-29f6ce1d9a69663c9a040f5dd091bb07427d1aa7.zip
LASTEXPRESS: support for delay-activated sounds
Not very obvious, but noticeable e.g. when knocking on harem doors. I suppose this is the problem that wiki describes as "improper triggering of actions on sound end".
Diffstat (limited to 'engines/lastexpress/sound/entry.h')
-rw-r--r--engines/lastexpress/sound/entry.h20
1 files changed, 13 insertions, 7 deletions
diff --git a/engines/lastexpress/sound/entry.h b/engines/lastexpress/sound/entry.h
index 4769d83d47..fa970cd097 100644
--- a/engines/lastexpress/sound/entry.h
+++ b/engines/lastexpress/sound/entry.h
@@ -54,7 +54,9 @@
uint32 {4} - ??
uint32 {4} - ??
uint32 {4} - ??
- uint32 {4} - ??
+ uint32 {4} - base volume if NIS is playing
+ (the actual volume is reduced in half for non-NIS sounds;
+ this is used to restore the volume after NIS ends)
uint32 {4} - entity
uint32 {4} - ??
uint32 {4} - priority
@@ -91,8 +93,10 @@ public:
bool isFinished();
void update(uint val);
bool updateSound();
- void updateState();
+ void adjustVolumeIfNISPlaying();
void updateEntryFlag(SoundFlag flag);
+ // activateDelay is measured in main ticks, 15Hz timer
+ void initDelayedActivate(unsigned activateDelay);
// Subtitles
void showSubtitle(Common::String filename);
@@ -101,10 +105,9 @@ public:
void saveLoadWithSerializer(Common::Serializer &ser);
// Accessors
- void setStatus(uint32 status) { _status = status; }
+ void addStatusFlag(SoundFlag flag) { _status |= flag; }
void setType(SoundType type) { _type = type; }
void setEntity(EntityIndex entity) { _entity = entity; }
- void setField48(int val) { _field_48 = val; }
uint32 getStatus() { return _status; }
SoundType getType() { return _type; }
@@ -137,9 +140,13 @@ private:
int _field_34;
int _field_38;
int _field_3C;
- int _variant;
+ int _volumeWithoutNIS;
EntityIndex _entity;
- int _field_48;
+ // The original game uses one variable _activateTime = _initTime + _activateDelay
+ // and measures everything in sound ticks (30Hz timer).
+ // We use milliseconds and two variables to deal with possible overflow
+ // (probably paranoid, but nothing really complicated).
+ uint32 _initTimeMS, _activateDelayMS;
uint32 _priority;
Common::String _name1; //char[16];
Common::String _name2; //char[16];
@@ -147,7 +154,6 @@ private:
SubtitleEntry *_subtitle;
// Sound buffer & stream
- bool _queued;
StreamedSound *_soundStream; // the filtered sound stream
void setType(SoundFlag flag);