1 /* GemRB - Infinity Engine Emulator
2 * Copyright (C) 2006 The GemRB Project
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 * Declares Particles class implementing weather and spark effects
38 //global phase for the while spark structure
43 // this structure holds data for a single particle element
51 * Class holding information about particles and rendering them.
54 #define SP_TYPE_POINT 0
55 #define SP_TYPE_LINE 1
56 #define SP_TYPE_CIRCLE 2
57 #define SP_TYPE_BITMAP 3
59 #define SP_PATH_FALL 0 //free falling
60 #define SP_PATH_FOUNT 1 //going up and down
61 #define SP_PATH_FLIT 2 //flitting
62 #define SP_PATH_RAIN 3 //falling and vanishing quickly
63 #define SP_PATH_EXPL 4 //explosion (mostly used with fragments)
65 #define SP_SPAWN_NONE 0 //don't create new sparks
66 #define SP_SPAWN_FULL 1 //fill all at setup, then switch to none
67 #define SP_SPAWN_SOME 2 //add some new elements regularly
69 #define SPARK_COLOR_BLUE 0
70 #define SPARK_COLOR_GOLD 1
71 #define SPARK_COLOR_PURPLE 2
72 #define SPARK_COLOR_ICE 3
73 #define SPARK_COLOR_STONE 4
74 #define SPARK_COLOR_BLACK 5
75 #define SPARK_COLOR_CHROM 6
76 #define SPARK_COLOR_RED 7
77 #define SPARK_COLOR_GREEN 8
78 #define SPARK_COLOR_WHITE 9
79 #define SPARK_COLOR_MAGENTA 10
80 #define SPARK_COLOR_ORANGE 11
81 #define SPARK_COLOR_CUSTOM 12
83 #define MAX_SPARK_COLOR 13
84 #define MAX_SPARK_PHASE 5
86 class GEM_EXPORT Particles
{
91 void SetBitmap(unsigned int FragAnimID
);
92 void SetPhase(ieByte ph
) { phase
= ph
; }
93 int GetPhase() const { return phase
; }
94 bool MatchPos(const Point
&p
) const { return pos
.x
==p
.x
&& pos
.y
==p
.y
; }
95 void SetType(ieByte t
, ieByte p
=SP_PATH_FALL
, ieByte st
=SP_SPAWN_NONE
)
101 void SetRegion(int x
, int y
, int w
, int h
)
108 void SetTimeToLive(int ttl
) { timetolive
= ttl
; }
109 void SetColor(ieByte c
) { color
=c
; }
110 void SetOwner(Scriptable
*o
) { owner
=o
; }
111 /* returns true if it cannot add new elements */
112 bool AddNew(const Point
&point
);
113 void Draw(const Region
&screen
);
114 void AddParticles(int count
);
115 /* returns true if it could be destroyed (didn't draw anything) */
117 int GetHeight() const { return pos
.y
+pos
.h
; }
121 ieDword target
; //could be 0, in that case target is pos
122 ieWord size
; //spark number
123 ieWord last_insert
;//last spark idx added
124 Scriptable
*owner
; //could be area or game or actor
126 ieByte phase
; //global phase
127 ieByte type
; //draw type (snow, rain)
128 ieByte path
; //path type
129 ieByte color
; //general spark color
131 //use char animations for the fragment animations
132 //1. the cycles are loaded only when needed
133 //2. the fragments ARE avatar animations in the original IE (for some unknown reason)
134 CharAnimations
*fragments
;
137 #endif // ! PARTICLES_H