aboutsummaryrefslogtreecommitdiff
path: root/engines/cge/snail.cpp
diff options
context:
space:
mode:
authorStrangerke2011-09-06 19:56:47 +0200
committerStrangerke2011-09-06 19:56:47 +0200
commite46c613e9a06828ede0001b8e4e7db1bef65d433 (patch)
tree451994e84dde79e2463d7717f704fb44fff6ace0 /engines/cge/snail.cpp
parent5bad1a7c7fc14caaa8af7d51addc70c94804e435 (diff)
downloadscummvm-rg350-e46c613e9a06828ede0001b8e4e7db1bef65d433.tar.gz
scummvm-rg350-e46c613e9a06828ede0001b8e4e7db1bef65d433.tar.bz2
scummvm-rg350-e46c613e9a06828ede0001b8e4e7db1bef65d433.zip
CGE: Remove 'count' static variable from snail
Thanks LordHoto for pointing it out
Diffstat (limited to 'engines/cge/snail.cpp')
-rw-r--r--engines/cge/snail.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/engines/cge/snail.cpp b/engines/cge/snail.cpp
index b1fc7629b0..ccdcac3578 100644
--- a/engines/cge/snail.cpp
+++ b/engines/cge/snail.cpp
@@ -771,13 +771,15 @@ void CGEEngine::snKill(Sprite *spr) {
}
}
-void CGEEngine::snSound(Sprite *spr, int wav, int cnt) {
- debugC(1, kCGEDebugEngine, "CGEEngine::snSound(spr, %d, %d)", wav, cnt);
+void CGEEngine::snSound(Sprite *spr, int wav) {
+ debugC(1, kCGEDebugEngine, "CGEEngine::snSound(spr, %d)", wav);
if (wav == -1)
_sound->stop();
else
- _sound->play((*_fx)[wav], (spr) ? ((spr->_x + spr->_w / 2) / (kScrWidth / 16)) : 8, cnt);
+ _sound->play((*_fx)[wav], (spr) ? ((spr->_x + spr->_w / 2) / (kScrWidth / 16)) : 8);
+
+ _sound->setRepeat(1);
}
void CGEEngine::snKeep(Sprite *spr, int stp) {
@@ -785,7 +787,10 @@ void CGEEngine::snKeep(Sprite *spr, int stp) {
selectPocket(-1);
if (spr && ! spr->_flags._kept && _pocket[_pocPtr] == NULL) {
- snSound(spr, 3, 1);
+ int16 oldRepeat = _sound->getRepeat();
+ _sound->setRepeat(1);
+ snSound(spr, 3);
+ _sound->setRepeat(oldRepeat);
_pocket[_pocPtr] = spr;
spr->_cave = 0;
spr->_flags._kept = true;
@@ -926,8 +931,6 @@ void CGEEngine::snMouse(bool on) {
}
void Snail::runCom() {
- static int count = 1;
-
if (_busy)
return;
@@ -1122,11 +1125,10 @@ void Snail::runCom() {
_vm->snReach(spr, snc->_val);
break;
case kSnSound:
- _vm->snSound(spr, snc->_val, count);
- count = 1;
+ _vm->snSound(spr, snc->_val);
break;
case kSnCount:
- count = snc->_val;
+ _sound->setRepeat(snc->_val);
break;
case kSnExec:
switch (snc->_cbType) {