1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * aint32 with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  *
22  * Based on the original sources
23  *   Faery Tale II -- The Halls of the Dead
24  *   (c) 1993-1996 The Wyrmkeep Entertainment Co.
25  */
26 
27 #include "saga2/saga2.h"
28 #include "saga2/spelshow.h"
29 
30 namespace Saga2 {
31 
32 // ------------------------------------------------------------------
33 // Spell Status functions
34 //   These routines are checked each display cycle to see if a  given
35 //     effectron should still be shown
36 //   Return values
37 //     0 : show normally
38 //     effectronHidden: hide but don't remove effectron
39 //     effectronDead : permanently hide effectron. when all
40 //       effectrons have this status the effect ends
41 //
42 
43 /* ===================================================================== *
44    Effect specific code
45  * ===================================================================== */
46 
47 // null spell
48 
SPELLSTATUSFUNCTION(invisibleSpellSta)49 SPELLSTATUSFUNCTION(invisibleSpellSta) {
50 	return effectronDead;
51 }
52 
53 // semi permanent aura
54 
SPELLSTATUSFUNCTION(auraSpellSta)55 SPELLSTATUSFUNCTION(auraSpellSta) {
56 	if (effectron->stepNo > effectron->totalSteps)
57 		return effectronDead;
58 	return 0;
59 }
60 
SPELLSTATUSFUNCTION(wallSpellSta)61 SPELLSTATUSFUNCTION(wallSpellSta) {
62 	if (effectron->stepNo > effectron->totalSteps)
63 		return effectronDead;
64 	return 0;
65 }
66 
67 // projectile spell ( also used as first half of exploding spells
68 
SPELLSTATUSFUNCTION(projectileSpellSta)69 SPELLSTATUSFUNCTION(projectileSpellSta) {
70 	if (effectron->stepNo > effectron->totalSteps)
71 		return effectronDead;
72 	return 0;
73 }
74 
75 
SPELLSTATUSFUNCTION(exchangeSpellSta)76 SPELLSTATUSFUNCTION(exchangeSpellSta) {
77 	if (effectron->stepNo < effectron->partno / 2)
78 		return effectronHidden;
79 	if (effectron->stepNo >= effectron->totalSteps)
80 		return effectronDead;
81 	return 0;
82 }
83 
SPELLSTATUSFUNCTION(boltSpellSta)84 SPELLSTATUSFUNCTION(boltSpellSta) {
85 	if (effectron->stepNo - (effectron->partno / 9) > effectron->totalSteps)
86 		return effectronDead;
87 	if ((effectron->partno / 9) >= effectron->stepNo)
88 		return effectronHidden;
89 	return 0;
90 }
91 
SPELLSTATUSFUNCTION(beamSpellSta)92 SPELLSTATUSFUNCTION(beamSpellSta) {
93 	if ((effectron->partno > effectron->totalSteps) ||
94 	        (effectron->stepNo > effectron->totalSteps))
95 		return effectronDead;
96 	return 0;
97 }
98 
SPELLSTATUSFUNCTION(coneSpellSta)99 SPELLSTATUSFUNCTION(coneSpellSta) {
100 	if (effectron->stepNo - (effectron->partno / 9) > effectron->totalSteps)
101 		return effectronDead;
102 	if (effectron->partno / 9 >= effectron->stepNo)
103 		return effectronHidden;
104 	return 0;
105 }
106 
SPELLSTATUSFUNCTION(waveSpellSta)107 SPELLSTATUSFUNCTION(waveSpellSta) {
108 	if (effectron->stepNo - (effectron->partno / 17) > effectron->totalSteps)
109 		return effectronDead;
110 	if (effectron->partno / 17 < effectron->stepNo)
111 		return effectronHidden;
112 	return 0;
113 }
114 
SPELLSTATUSFUNCTION(ballSpellSta)115 SPELLSTATUSFUNCTION(ballSpellSta) {
116 	if (effectron->isBumped() ||
117 	        effectron->stepNo > effectron->totalSteps)
118 		return effectronDead;
119 	return 0;
120 }
121 
SPELLSTATUSFUNCTION(squareSpellSta)122 SPELLSTATUSFUNCTION(squareSpellSta) {
123 	if (effectron->isBumped() ||
124 	        effectron->stepNo > effectron->totalSteps)
125 		return effectronDead;
126 	return 0;
127 }
128 
SPELLSTATUSFUNCTION(stormSpellSta)129 SPELLSTATUSFUNCTION(stormSpellSta) {
130 	if (effectron->isBumped() ||
131 	        effectron->stepNo > effectron->totalSteps)
132 		return effectronDead;
133 	return 0;
134 }
135 
136 } // end of namespace Saga2
137