aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwhiterandrek2018-03-28 17:16:52 +0300
committerEugene Sandulenko2018-06-28 23:51:32 +0200
commit896511c34ac1a5b0b41fcbd01e81272c219fb8bb (patch)
tree1486e5e29a82de88083ddcbf832fb206894360bd
parent48d34128b25a70c78bdfbcc6f15f673b643e20b1 (diff)
downloadscummvm-rg350-896511c34ac1a5b0b41fcbd01e81272c219fb8bb.tar.gz
scummvm-rg350-896511c34ac1a5b0b41fcbd01e81272c219fb8bb.tar.bz2
scummvm-rg350-896511c34ac1a5b0b41fcbd01e81272c219fb8bb.zip
PINK: hacky implementation of SequenceAudio
-rw-r--r--engines/pink/objects/sequences/sequence.cpp23
-rw-r--r--engines/pink/objects/sequences/sequence.h17
-rw-r--r--engines/pink/objects/sequences/sequencer.cpp2
3 files changed, 33 insertions, 9 deletions
diff --git a/engines/pink/objects/sequences/sequence.cpp b/engines/pink/objects/sequences/sequence.cpp
index 070147a310..c2a0f731ff 100644
--- a/engines/pink/objects/sequences/sequence.cpp
+++ b/engines/pink/objects/sequences/sequence.cpp
@@ -28,6 +28,7 @@
#include "engines/pink/objects/pages/game_page.h"
#include "engines/pink/objects/actors/actor.h"
#include "sequence_context.h"
+#include "pink/sound.h"
namespace Pink {
@@ -135,15 +136,33 @@ void Sequence::skipItemsTo(int index) {
void SequenceAudio::deserialize(Archive &archive) {
Sequence::deserialize(archive);
- archive >> _sound;
+ archive >> _soundName;
}
void SequenceAudio::toConsole() {
- debug("\t\tSequenceAudio %s : _sound = %s", _name.c_str(), _sound.c_str());
+ debug("\t\tSequenceAudio %s : _sound = %s", _name.c_str(), _soundName.c_str());
debug("\t\t\tItems:");
for (int i = 0; i < _items.size(); ++i) {
_items[i]->toConsole();
}
}
+void SequenceAudio::end() {
+ delete _sound;
+ _sound = nullptr;
+ Sequence::end();
+}
+
+void SequenceAudio::update() {
+ // Not Working. In original there is check for current buffer size of wav file
+ Sequence::update();
+}
+
+void SequenceAudio::init(int unk) {
+ _unk2 = 0;
+ _sound = _sequencer->_page->loadSound(_soundName);
+ _sound->play(Audio::Mixer::SoundType::kMusicSoundType, 100, 0);
+ Sequence::init(unk);
+}
+
} // End of namespace Pink \ No newline at end of file
diff --git a/engines/pink/objects/sequences/sequence.h b/engines/pink/objects/sequences/sequence.h
index 1ca40799a8..08d0271aa3 100644
--- a/engines/pink/objects/sequences/sequence.h
+++ b/engines/pink/objects/sequences/sequence.h
@@ -43,11 +43,11 @@ public:
Common::Array<SequenceItem*> &getItems();
void setContext(SequenceContext *context);
- void init(int unk);
+ virtual void init(int unk);
void start(int unk);
- void end();
+ virtual void end();
- void update();
+ virtual void update();
void restart();
void skipToLastSubSequence();
void skipItemsTo(int index);
@@ -57,17 +57,22 @@ public:
Sequencer *_sequencer;
Common::Array<SequenceItem*> _items;
int _unk;
-
};
+class Sound;
+
class SequenceAudio : public Sequence {
public:
virtual void deserialize(Archive &archive);
virtual void toConsole();
+ virtual void init(int unk);
+ virtual void end();
+ virtual void update();
+
private:
- Common::String _sound;
- int _unk1;
+ Common::String _soundName;
+ Sound *_sound;
int _unk2;
};
diff --git a/engines/pink/objects/sequences/sequencer.cpp b/engines/pink/objects/sequences/sequencer.cpp
index 4e59f18746..057603a790 100644
--- a/engines/pink/objects/sequences/sequencer.cpp
+++ b/engines/pink/objects/sequences/sequencer.cpp
@@ -60,7 +60,7 @@ void Sequencer::authorSequence(Sequence *sequence, bool unk) {
_context = new SequenceContext(sequence, this);
//unload array of unknown objects
_currentSequenceName = sequence->getName();
- sequence->start(unk);
+ sequence->init(unk);
}
else _currentSequenceName.clear();
}