aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorStrangerke2019-10-28 20:38:43 +0100
committerEugene Sandulenko2019-11-13 22:07:08 +0100
commitd384cc83e7d83f8fbd0eea3b622b665c7ef67a5e (patch)
tree76d71f86d57a36abcfd3e3f9f00af58eafc32775 /engines
parentf69cce13e5fecc88284716f42b8e3ad801d4fc53 (diff)
downloadscummvm-rg350-d384cc83e7d83f8fbd0eea3b622b665c7ef67a5e.tar.gz
scummvm-rg350-d384cc83e7d83f8fbd0eea3b622b665c7ef67a5e.tar.bz2
scummvm-rg350-d384cc83e7d83f8fbd0eea3b622b665c7ef67a5e.zip
GRIFFON: Refactor castSpell()
Diffstat (limited to 'engines')
-rw-r--r--engines/griffon/combat.cpp52
1 files changed, 30 insertions, 22 deletions
diff --git a/engines/griffon/combat.cpp b/engines/griffon/combat.cpp
index c2aeee28b6..925a83c529 100644
--- a/engines/griffon/combat.cpp
+++ b/engines/griffon/combat.cpp
@@ -434,25 +434,35 @@ void GriffonEngine::castSpell(int spellnum, float homex, float homey, float enem
spellinfo[i].strength = 1.5f;
}
- // set earthslide vars
- if (spellnum == 2) {
+ switch(spellnum) {
+ case 1:
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndThrow]);
+ setChannelVolume(snd, config.effectsvol);
+ }
+ break;
+ case 2:
+ // set earthslide vars
for (int f = 0; f <= 8; f++) {
spellinfo[i].rocky[f] = 0;
spellinfo[i].rockimg[f] = (int)(RND() * 4);
spellinfo[i].rockdeflect[f] = ((int)(RND() * 128) - 64) * 1.5;
}
- }
-
- // set fire vars
- if (spellnum == 3) {
- for (int f = 0; f <= 4; f++) {
+ break;
+ case 3:
+ // set fire vars
+ for (int f = 0; f <= 4; f++)
spellinfo[i].legalive[f] = 32;
- }
- }
-
- // room fireball vars
- if (spellnum == 6) {
+ break;
+ case 5:
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndCrystal]);
+ setChannelVolume(snd, config.effectsvol);
+ }
+ break;
+ case 6: {
+ // room fireball vars
int nballs = 0;
for (int x = 0; x <= 19; x++) {
for (int y = 0; y <= 14; y++) {
@@ -471,19 +481,17 @@ void GriffonEngine::castSpell(int spellnum, float homex, float homey, float enem
}
}
spellinfo[i].nfballs = nballs;
- }
-
- if (config.effects) {
- if (spellnum == 1) {
- int snd = playSound(_sfx[kSndThrow]);
- setChannelVolume(snd, config.effectsvol);
- } else if (spellnum == 5) {
- int snd = playSound(_sfx[kSndCrystal]);
- setChannelVolume(snd, config.effectsvol);
- } else if (spellnum == 8 || spellnum == 9) {
+ }
+ break;
+ case 8:
+ case 9:
+ if (config.effects) {
int snd = playSound(_sfx[kSndLightning]);
setChannelVolume(snd, config.effectsvol);
}
+ break;
+ default:
+ break;
}
return;