1 /*
2  * Copyright 2011-2013 Arx Libertatis Team (see the AUTHORS file)
3  *
4  * This file is part of Arx Libertatis.
5  *
6  * Arx Libertatis is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * Arx Libertatis is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with Arx Libertatis.  If not, see <http://www.gnu.org/licenses/>.
18  */
19 /* Based on:
20 ===========================================================================
21 ARX FATALIS GPL Source Code
22 Copyright (C) 1999-2010 Arkane Studios SA, a ZeniMax Media company.
23 
24 This file is part of the Arx Fatalis GPL Source Code ('Arx Fatalis Source Code').
25 
26 Arx Fatalis Source Code is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
27 License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
28 
29 Arx Fatalis Source Code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
30 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
31 
32 You should have received a copy of the GNU General Public License along with Arx Fatalis Source Code.  If not, see
33 <http://www.gnu.org/licenses/>.
34 
35 In addition, the Arx Fatalis Source Code is also subject to certain additional terms. You should have received a copy of these
36 additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Arx
37 Fatalis Source Code. If not, please request a copy in writing from Arkane Studios at the address below.
38 
39 If you have questions concerning this license or the applicable additional terms, you may contact in writing Arkane Studios, c/o
40 ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
41 ===========================================================================
42 */
43 // Copyright (c) 1999-2001 ARKANE Studios SA. All rights reserved
44 
45 #ifndef ARX_GRAPHICS_SPELLS_SPELLS01_H
46 #define ARX_GRAPHICS_SPELLS_SPELLS01_H
47 
48 #include "graphics/effects/SpellEffects.h"
49 
50 // Done By : Didier Pédreno
51 class CMagicMissile : public CSpellFx {
52 
53 public:
54 
55 	bool bExplo;
56 	bool bMove;
57 	int iLength;
58 	int	iBezierPrecision;
59 	Color3f fColor;
60 	float fTrail;
61 	float fOneOnBezierPrecision;
62 	Vec3f eSrc;
63 	Vec3f eCurPos;
64 	Anglef angles;
65 	TextureContainer * tex_mm;
66 	TexturedVertex pathways[6];
67 	audio::SourceId snd_loop;
68 
69 	CMagicMissile();
70 	~CMagicMissile();
71 
72 	// accesseurs
73 	void SetTTL(unsigned long);
74 	void SetColor(Color3f);
75 
76 	// surcharge
77 	void Create(const Vec3f &, const Anglef &);
78 	void Update(unsigned long);
79 	float Render();
80 
81 };
82 
83 class CMultiMagicMissile : public CSpellFx {
84 
85 private:
86 
87 	CMagicMissile ** pTab;
88 	unsigned int uiNumber;
89 
90 public:
91 
92 	explicit CMultiMagicMissile(long nb);
93 	~CMultiMagicMissile();
94 
95 	void CheckCollision();
96 
97 	void Create();
98 	void Update(unsigned long);
99 	float Render();
100 
101 };
102 
103 // Done By : Sébastien Scieux
104 class CIgnit : public CSpellFx {
105 
106 private:
107 
108 	Vec3f pos;
109 	float perimetre;
110 	short key;
111 	int duration;
112 	int currduration;
113 	float interp;
114 
115 	TextureContainer * tp;
116 	Color3f rgb;
117 	int mask;
118 
119 	struct T_LINKLIGHTTOFX {
120 		Vec3f poslight;
121 		Vec3f posfx;
122 		int actif;
123 		int idl;
124 		int iLightNum;
125 	};
126 
127 public:
128 
129 	unsigned char nblight;
130 	T_LINKLIGHTTOFX tablight[256];
131 
132 	CIgnit();
133 	~CIgnit();
134 
GetDuration(void)135 	unsigned long GetDuration(void) {
136 		return this->duration;
137 	};
138 
139 	void Create(Vec3f * posc, float perim, int speed);
140 	void Update(unsigned long time);
141 	float Render();
142 	void Kill();
143 	void AddLight(int iLight);
144 	void Action(int mode);
145 
ChangeRGBMask(float r,float g,float b,int mask)146 	void ChangeRGBMask(float r, float g, float b, int mask) {
147 		rgb = Color3f(r, g, b);
148 		this->mask = mask;
149 	}
150 
ChangeTexture(TextureContainer * tc)151 	void	ChangeTexture(TextureContainer * tc) {
152 		this->tp = tc;
153 	}
154 
GetPerimetre(void)155 	float	GetPerimetre(void) {
156 		return this->perimetre;
157 	}
158 
159 };
160 
161 // Done By : Sébastien Scieux
162 class CDoze: public CIgnit {
163 
164 public:
165 
166 	void CreateDoze(Vec3f * posc, float perim, int speed);
167 
168 	void AddLightDoze(int iLight);
169 
170 };
171 
172 // Done By : Sébastien Scieux
173 class CPortal: public CSpellFx {
174 
175 private:
176 
177 	short key;
178 	int duration;
179 	int currduration, currframe;
180 	Vec3f pos;
181 	float r;
182 	TextureContainer * tp, * te;
183 
184 	struct T_ECLAIR {
185 		short actif, nbseg;
186 		int duration;
187 		int currduration;
188 		int numpt;
189 		Vec3f * seg;
190 	};
191 
192 	int timeneweclair;
193 	int nbeclair; // eclair
194 	T_ECLAIR tabeclair[256];
195 
196 	Vec3f sphereposdep;
197 	Vec3f sphereposend;
198 	Vec3f * spherevertex;
199 	unsigned short * sphereind;
200 	int spherenbpt;
201 	int spherenbfaces;
202 	float spherealpha;
203 	TexturedVertex * sphered3d;
204 
205 public:
206 
207 	~CPortal();
208 
GetDuration(void)209 	unsigned long GetDuration(void) {
210 		return this->duration;
211 	};
212 
213 	void AddNewEclair(Vec3f * endpos, int nbseg, int duration, int numpt);
214 	void DrawAllEclair();
215 	void Update(unsigned long);
216 	float Render();
217 
218 };
219 
220 #endif // ARX_GRAPHICS_SPELLS_SPELLS01_H
221