aboutsummaryrefslogtreecommitdiff
path: root/engines/pink
diff options
context:
space:
mode:
Diffstat (limited to 'engines/pink')
-rw-r--r--engines/pink/objects/actions/action_play_with_sfx.cpp14
-rw-r--r--engines/pink/objects/actions/action_play_with_sfx.h3
-rw-r--r--engines/pink/objects/actions/action_sound.cpp1
-rw-r--r--engines/pink/objects/actions/action_talk.cpp5
-rw-r--r--engines/pink/objects/actions/action_talk.h2
5 files changed, 17 insertions, 8 deletions
diff --git a/engines/pink/objects/actions/action_play_with_sfx.cpp b/engines/pink/objects/actions/action_play_with_sfx.cpp
index 3805b8fe3c..c4f07e8b74 100644
--- a/engines/pink/objects/actions/action_play_with_sfx.cpp
+++ b/engines/pink/objects/actions/action_play_with_sfx.cpp
@@ -74,24 +74,28 @@ void ActionPlayWithSfx::updateSound() {
for (uint i = 0; i < _sfxArray.size(); ++i) {
if (_sfxArray[i]->getFrame() == _decoder->getCurFrame())
- _sfxArray[i]->play(_actor->getPage());
+ _sfxArray[i]->play();
}
}
void ActionSfx::deserialize(Pink::Archive &archive) {
_frame = archive.readDWORD();
_volume = archive.readDWORD();
+ assert(_volume <= 100);
_sfxName = archive.readString();
- archive.readObject(); // pointer of ActionPlayWithSfx
+ _sprite = (ActionPlayWithSfx*) archive.readObject();
}
void ActionSfx::toConsole() {
debug("\t\tActionSfx: _sfx = %s, _volume = %u, _frame = %u", _sfxName.c_str(), _volume, _frame);
}
-void ActionSfx::play(Page *page) {
- if (!_sound.isPlaying())
- _sound.play(page->getResourceStream(_sfxName), Audio::Mixer::kSFXSoundType, _volume);
+void ActionSfx::play() {
+ Page *page = _sprite->getActor()->getPage();
+ if (!_sound.isPlaying()) {
+ int8 balance = (_sprite->getDecoder()->getX() * 396875 / 1000000) - 127;
+ _sound.play(page->getResourceStream(_sfxName), Audio::Mixer::kSFXSoundType, _volume, balance);
+ }
}
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_play_with_sfx.h b/engines/pink/objects/actions/action_play_with_sfx.h
index 16a3cada99..fdcb9c9a54 100644
--- a/engines/pink/objects/actions/action_play_with_sfx.h
+++ b/engines/pink/objects/actions/action_play_with_sfx.h
@@ -58,11 +58,12 @@ public:
void toConsole() override;
- void play(Page *page);
+ void play();
uint32 getFrame() { return _frame; }
private:
+ ActionPlayWithSfx *_sprite;
Common::String _sfxName;
Sound _sound;
uint32 _volume;
diff --git a/engines/pink/objects/actions/action_sound.cpp b/engines/pink/objects/actions/action_sound.cpp
index e67717f04a..b7957266e9 100644
--- a/engines/pink/objects/actions/action_sound.cpp
+++ b/engines/pink/objects/actions/action_sound.cpp
@@ -39,6 +39,7 @@ void ActionSound::deserialize(Archive &archive) {
Action::deserialize(archive);
_fileName = archive.readString();
_volume = archive.readDWORD();
+ assert(_volume <= 100);
_isLoop = (bool) archive.readDWORD();
_isBackground = (bool) archive.readDWORD();
}
diff --git a/engines/pink/objects/actions/action_talk.cpp b/engines/pink/objects/actions/action_talk.cpp
index f46afb312c..be64f0b72d 100644
--- a/engines/pink/objects/actions/action_talk.cpp
+++ b/engines/pink/objects/actions/action_talk.cpp
@@ -60,7 +60,10 @@ void ActionTalk::pause(bool paused) {
void ActionTalk::onStart() {
ActionPlay::onStart();
- _sound.play(_actor->getPage()->getResourceStream(_vox), Audio::Mixer::kSpeechSoundType);
+ //sound balance is calculated different than in ActionSfx(probably a bug in original)
+ // 30.0 - x * -0.0625 disasm (0 - 100)
+ int8 balance = (_decoder->getX() * 396875 / 1000000) - 127;
+ _sound.play(_actor->getPage()->getResourceStream(_vox), Audio::Mixer::kSpeechSoundType, 100, balance);
}
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_talk.h b/engines/pink/objects/actions/action_talk.h
index f29dc0f5fc..1b8b60ee96 100644
--- a/engines/pink/objects/actions/action_talk.h
+++ b/engines/pink/objects/actions/action_talk.h
@@ -45,8 +45,8 @@ protected:
void onStart() override;
private:
- Sound _sound;
Common::String _vox;
+ Sound _sound;
};
} // End of namespace Pink