2 * Copyright (C) Volition, Inc. 1999. All rights reserved.
4 * All source code herein is the property of Volition, Inc. You may not sell
5 * or otherwise commercially exploit the source or things you created based on
10 * $Logfile: /Freespace2/code/Particle/Particle.h $
15 * Includes for particle system
18 * Revision 1.2 2002/06/09 04:41:14 relnev
19 * added copyright header
21 * Revision 1.1.1.1 2002/05/03 03:28:12 root
25 * 7 7/21/99 8:10p Dave
26 * First run of supernova effect.
28 * 6 1/29/99 12:47a Dave
29 * Put in sounds for beam weapon. A bunch of interface screens (tech
32 * 5 1/27/99 9:56a Dave
33 * Temporary checkin of beam weapons for Dan to make cool sounds.
35 * 4 1/24/99 11:37p Dave
36 * First full rev of beam weapons. Very customizable. Removed some bogus
37 * Int3()'s in low level net code.
39 * 3 1/21/99 2:06p Dave
40 * Final checkin for multiplayer testing.
42 * 2 10/07/98 10:53a Dave
45 * 1 10/07/98 10:50a Dave
47 * 6 5/13/98 3:25p John
48 * Added code to make explosion impacts not get removed by other
51 * 5 5/11/98 10:06a John
52 * Added new particle for Adam
54 * 4 4/30/98 11:31a Andsager
55 * Added particles to big ship explosions. Modified particle_emit() to
56 * take optional range to increase range at which pariticles are created.
58 * 3 1/29/98 11:48a John
59 * Added new counter measure rendering as model code. Made weapons be
60 * able to have impact explosion.
62 * 2 1/02/98 5:04p John
63 * Several explosion related changes. Made fireballs not be used as
64 * ani's. Made ship spark system expell particles. Took away impact
65 * explosion for weapon hitting ship... this needs to get added to weapon
66 * info and makes shield hit more obvious. Only make sparks when hit
69 * 1 12/23/97 8:26a John
77 //============================================================================
78 //==================== PARTICLE SYSTEM GAME SEQUENCING CODE ==================
79 //============================================================================
81 // Resets particle system. Call between levels.
84 // Moves the particles for each frame
85 void particle_move_all(float frametime);
87 // Renders all the particles
88 void particle_render_all();
90 // kill all active particles
91 void particle_kill_all();
94 //============================================================================
95 //=============== LOW-LEVEL SINGLE PARTICLE CREATION CODE ====================
96 //============================================================================
98 // The different types of particles...
99 #define PARTICLE_DEBUG 0 // A red sphere, no optional data required
100 #define PARTICLE_BITMAP 1 // A bitmap, optional data is the bitmap number. If bitmap is an animation,
101 // lifetime is calculated by the number of frames and fps.
102 #define PARTICLE_FIRE 2 // The vclip used for explosions, optional means nothing
103 #define PARTICLE_SMOKE 3 // The vclip used for smoke, optional means nothing
104 #define PARTICLE_SMOKE2 4 // The vclip used for smoke, optional means nothing
105 #define PARTICLE_BITMAP_PERSISTENT 5 // A bitmap, optional data is the bitmap number. If bitmap is an animation,
106 // lifetime is calculated by the number of frames and fps.
108 // particle creation stuff
109 typedef struct particle_info {
110 // old-style particle info
118 // new-style particle info
120 short attached_objnum; // if these are set, the pos is relative to the pos of the origin of the attached object
121 int attached_sig; // to make sure the object hasn't changed or died. velocity is ignored in this case
122 ubyte reverse; // play any animations in reverse
125 // Creates a single particle. See the PARTICLE_?? defines for types.
126 void particle_create( particle_info *pinfo );
127 void particle_create( vector *pos, vector *vel, float lifetime, float rad, int type, uint optional_data = 0 );
130 //============================================================================
131 //============== HIGH-LEVEL PARTICLE SYSTEM CREATION CODE ====================
132 //============================================================================
134 // Use a structure rather than pass a ton of parameters to particle_emit
135 typedef struct particle_emitter {
136 int num_low; // Lowest number of particles to create
137 int num_high; // Highest number of particles to create
138 vector pos; // Where the particles emit from
139 vector vel; // Initial velocity of all the particles
140 float min_life; // How long the particles live
141 float max_life; // How long the particles live
142 vector normal; // What normal the particle emit arond
143 float normal_variance; // How close they stick to that normal 0=good, 1=360 degree
144 float min_vel; // How fast the slowest particle can move
145 float max_vel; // How fast the fastest particle can move
146 float min_rad; // Min radius
147 float max_rad; // Max radius
150 // Creates a bunch of particles. You pass a structure
151 // rather than a bunch of parameters.
152 void particle_emit( particle_emitter *pe, int type, uint optional_data, float range=1.0 );
154 #endif // _PARTICLE_H