aboutsummaryrefslogtreecommitdiff
path: root/engines/cge2/snail.cpp
diff options
context:
space:
mode:
authoruruk2014-05-24 10:47:07 +0200
committeruruk2014-05-24 10:47:07 +0200
commit3c86aa288b532ddf9370fdcf33f144b43ffab5cc (patch)
tree6b73bfa08858187439b70b923fdacae4c30e05c0 /engines/cge2/snail.cpp
parent4cf5c28fee6d71277a7ca2bea5663aa12e387a68 (diff)
downloadscummvm-rg350-3c86aa288b532ddf9370fdcf33f144b43ffab5cc.tar.gz
scummvm-rg350-3c86aa288b532ddf9370fdcf33f144b43ffab5cc.tar.bz2
scummvm-rg350-3c86aa288b532ddf9370fdcf33f144b43ffab5cc.zip
CGE2: Implement snSound().
Rework the whole Fx class during the process. The intro animation is working now.
Diffstat (limited to 'engines/cge2/snail.cpp')
-rw-r--r--engines/cge2/snail.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/engines/cge2/snail.cpp b/engines/cge2/snail.cpp
index edbc78c7ad..3de42ddfc0 100644
--- a/engines/cge2/snail.cpp
+++ b/engines/cge2/snail.cpp
@@ -29,6 +29,7 @@
#include "cge2/fileio.h"
#include "cge2/hero.h"
#include "cge2/text.h"
+#include "cge2/sound.h"
namespace CGE2 {
@@ -284,7 +285,7 @@ void CommandHandler::runCommand() {
_vm->snReach(spr, tailCmd._val);
break;
case kCmdSound:
- _vm->snSound(spr, tailCmd._val, _count);
+ _vm->snSound(spr, tailCmd._val);
_count = 1;
break;
case kCmdMap:
@@ -462,8 +463,21 @@ void CGE2Engine::snReach(Sprite *spr, int val) {
warning("STUB: CGE2Engine::snReach()");
}
-void CGE2Engine::snSound(Sprite *spr, int val, int cnt) {
- warning("STUB: CGE2Engine::snSound()");
+void CGE2Engine::snSound(Sprite *spr, int wav) {
+ if (wav == -1)
+ _sound->stop();
+ else {
+ if (_sound->_smpinf._counter && wav < 20)
+ return;
+ if (_commandStat._wait && ((wav & 255) > 80))
+ return;
+
+ _commandStat._ref[1] = wav;
+ _commandStat._ref[0] = !_fx->exist(_commandStat._ref[1]);
+ _sound->play(_fx->load(_commandStat._ref[1], _commandStat._ref[0]),
+ (spr) ? (spr->_pos2D.x / (kScrWidth / 16)) : 8);
+ }
+
}
void CGE2Engine::snRoom(Sprite *spr, int val) {