aboutsummaryrefslogtreecommitdiff
path: root/engines/lastexpress/sound/entry.h
diff options
context:
space:
mode:
authorEvgeny Grechnikov2018-10-20 16:35:23 +0300
committerEvgeny Grechnikov2018-10-20 16:35:23 +0300
commitaf580eaa853b2434c0d237cff49f7f273444a06d (patch)
tree295dd4dfb9fadb348bd46bdc8512e16b19555c58 /engines/lastexpress/sound/entry.h
parent9f7ae73a7b7318311e5cc52d36e451cacfba8a02 (diff)
downloadscummvm-rg350-af580eaa853b2434c0d237cff49f7f273444a06d.tar.gz
scummvm-rg350-af580eaa853b2434c0d237cff49f7f273444a06d.tar.bz2
scummvm-rg350-af580eaa853b2434c0d237cff49f7f273444a06d.zip
LASTEXPRESS: save/load sound state
Warning: breaks compatibility with previous savefiles. They were mostly broken anyway, locking any NPC who waited for kActionEndSound when savefile was created.
Diffstat (limited to 'engines/lastexpress/sound/entry.h')
-rw-r--r--engines/lastexpress/sound/entry.h21
1 files changed, 14 insertions, 7 deletions
diff --git a/engines/lastexpress/sound/entry.h b/engines/lastexpress/sound/entry.h
index cb12214d4a..998d1e53e8 100644
--- a/engines/lastexpress/sound/entry.h
+++ b/engines/lastexpress/sound/entry.h
@@ -96,9 +96,13 @@ public:
void open(Common::String name, SoundFlag flag, int priority);
void close();
- void play();
- void kill();
- bool isFinished();
+ // startTime is measured in sound ticks, 30Hz timer
+ // [used for restoring the entry from savefile]
+ void play(uint32 startTime = 0);
+ void kill() {
+ _entity = kEntityPlayer; // no kActionEndSound notifications
+ close();
+ }
void setVolumeSmoothly(SoundFlag newVolume);
// setVolumeSmoothly() treats kVolumeNone in a special way;
// fade() terminates the stream after the transition
@@ -110,18 +114,20 @@ public:
void initDelayedActivate(unsigned activateDelay);
// Subtitles
- void showSubtitle(Common::String filename);
+ void setSubtitles(Common::String filename);
// Serializable
void saveLoadWithSerializer(Common::Serializer &ser);
// Accessors
- void addStatusFlag(SoundFlag flag) { _status |= flag; }
void setEntity(EntityIndex entity) { _entity = entity; }
+ bool needSaving() const {
+ return (_name != "NISSND?" && (_status & kSoundTypeMask) != kSoundTypeMenu);
+ }
uint32 getStatus() { return _status; }
int32 getTag() { return _tag; }
- uint32 getTime() { return _soundStream ? (_soundStream->getTimeMS() * 30 / 1000) : 0; }
+ uint32 getTime() { return _soundStream ? (_soundStream->getTimeMS() * 30 / 1000) + _startTime : 0; }
EntityIndex getEntity() { return _entity; }
uint32 getPriority() { return _priority; }
const Common::String& getName(){ return _name; }
@@ -138,9 +144,10 @@ private:
uint32 _status;
int32 _tag; // member of SoundTag for special sounds, unique value for normal sounds
//byte *_bufferStart, *_bufferEnd, *_decodePointer, *_buffer, *_readPointer;
- // the original game uses uint32 _blocksLeft, _time instead of _totalBlocks
+ // the original game uses uint32 _blocksLeft, _time instead of _blockCount
// we ask the backend for sound time
uint32 _blockCount;
+ uint32 _startTime;
//uint32 _bufferSize;
//union { uint32 _streamPos; enum StreamCloseReason _streamCloseReason; };
Common::SeekableReadStream *_stream; // The file stream