aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorStrangerke2019-10-24 08:13:24 +0200
committerEugene Sandulenko2019-11-13 22:07:08 +0100
commitd87897a5c49b4aded7fd44a5048b0efd37c85bf7 (patch)
tree13f2b0bd506a6ed595e20acab2846adb910550c1 /engines
parent1a1c663ddd3531542610e7d0b2cb941add382916 (diff)
downloadscummvm-rg350-d87897a5c49b4aded7fd44a5048b0efd37c85bf7.tar.gz
scummvm-rg350-d87897a5c49b4aded7fd44a5048b0efd37c85bf7.tar.bz2
scummvm-rg350-d87897a5c49b4aded7fd44a5048b0efd37c85bf7.zip
GRIFFON: make loopseta a local static, reduce size of sfx array, use constants for sfx loading
Diffstat (limited to 'engines')
-rw-r--r--engines/griffon/griffon.cpp1
-rw-r--r--engines/griffon/griffon.h3
-rw-r--r--engines/griffon/sound.cpp40
3 files changed, 22 insertions, 22 deletions
diff --git a/engines/griffon/griffon.cpp b/engines/griffon/griffon.cpp
index aaa69c71e6..d107f4fdfc 100644
--- a/engines/griffon/griffon.cpp
+++ b/engines/griffon/griffon.cpp
@@ -51,7 +51,6 @@ GriffonEngine::GriffonEngine(OSystem *syst) : Engine(syst) {
_musicChannel = -1;
_menuChannel = -1;
- _loopseta = 0;
clouddeg = 0.0f;
// Synchronize the sound settings from ScummVM
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index d82d44b147..af9ef9c6f0 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -486,9 +486,8 @@ private:
DataChunk *_mgardens, *_mgardens2, *_mgardens3, *_mgardens4, *_mboss, *_mmenu, *_mendofgame;
int _musicChannel, _menuChannel;
bool _playingBoss, _playingGardens;
- int _loopseta;
- DataChunk *_sfx[21];
+ DataChunk *_sfx[15];
Audio::SoundHandle _handles[kSoundHandles];
Audio::Mixer *_mixer;
diff --git a/engines/griffon/sound.cpp b/engines/griffon/sound.cpp
index 59e7b075c1..c2de94d619 100644
--- a/engines/griffon/sound.cpp
+++ b/engines/griffon/sound.cpp
@@ -158,38 +158,40 @@ void GriffonEngine::setupAudio() {
_mmenu = cacheSound("music/menu.ogg");
drawProgress(7, 21);
- _sfx[0] = cacheSound("sfx/bite.ogg");
+ _sfx[kSndBite] = cacheSound("sfx/bite.ogg");
drawProgress(8, 21);
- _sfx[1] = cacheSound("sfx/crystal.ogg");
+ _sfx[kSndCrystal] = cacheSound("sfx/crystal.ogg");
drawProgress(9, 21);
- _sfx[2] = cacheSound("sfx/door.ogg");
+ _sfx[kSndDoor] = cacheSound("sfx/door.ogg");
drawProgress(10, 21);
- _sfx[3] = cacheSound("sfx/enemyhit.ogg");
+ _sfx[kSndEnemyHit] = cacheSound("sfx/enemyhit.ogg");
drawProgress(11, 21);
- _sfx[4] = cacheSound("sfx/ice.ogg");
+ _sfx[kSndIce] = cacheSound("sfx/ice.ogg");
drawProgress(12, 21);
- _sfx[5] = cacheSound("sfx/lever.ogg");
+ _sfx[kSndLever] = cacheSound("sfx/lever.ogg");
drawProgress(13, 21);
- _sfx[6] = cacheSound("sfx/lightning.ogg");
+ _sfx[kSndLightning] = cacheSound("sfx/lightning.ogg");
drawProgress(14, 21);
- _sfx[7] = cacheSound("sfx/metalhit.ogg");
+ _sfx[kSndMetalHit] = cacheSound("sfx/metalhit.ogg");
drawProgress(15, 21);
- _sfx[8] = cacheSound("sfx/powerup.ogg");
+ _sfx[kSndPowerUp] = cacheSound("sfx/powerup.ogg");
drawProgress(16, 21);
- _sfx[9] = cacheSound("sfx/rocks.ogg");
+ _sfx[kSndRocks] = cacheSound("sfx/rocks.ogg");
drawProgress(17, 21);
- _sfx[10] = cacheSound("sfx/swordhit.ogg");
+ _sfx[kSndSwordHit] = cacheSound("sfx/swordhit.ogg");
drawProgress(18, 21);
- _sfx[11] = cacheSound("sfx/throw.ogg");
+ _sfx[kSndThrow] = cacheSound("sfx/throw.ogg");
drawProgress(19, 21);
- _sfx[12] = cacheSound("sfx/chest.ogg");
+ _sfx[kSndChest] = cacheSound("sfx/chest.ogg");
drawProgress(20, 21);
- _sfx[13] = cacheSound("sfx/fire.ogg");
+ _sfx[kSndFire] = cacheSound("sfx/fire.ogg");
drawProgress(21, 21);
- _sfx[14] = cacheSound("sfx/beep.ogg");
+ _sfx[kSndBeep] = cacheSound("sfx/beep.ogg");
}
void GriffonEngine::updateMusic() {
+ static int loopseta = 0;
+
DataChunk *iplaysound = NULL;
if (config.music) {
@@ -214,14 +216,14 @@ void GriffonEngine::updateMusic() {
setChannelVolume(_musicChannel, config.musicvol);
} else {
if (!isSoundChannelPlaying(_musicChannel)) {
- _loopseta += 1;
- if (_loopseta == 4)
- _loopseta = 0;
+ loopseta += 1;
+ if (loopseta == 4)
+ loopseta = 0;
if (_playingGardens) {
haltSoundChannel(_musicChannel);
if (_playingGardens) {
- switch (_loopseta) {
+ switch (loopseta) {
case 0:
playSound(_mgardens);
break;