]> icculus.org git repositories - taylor/freespace2.git/blob - include/shipfx.h
Initial revision
[taylor/freespace2.git] / include / shipfx.h
1 /*
2  * $Logfile: /Freespace2/code/Ship/ShipFX.h $
3  * $Revision$
4  * $Date$
5  * $Author$
6  *
7  * Routines for ship effects (as in special)
8  *
9  * $Log$
10  * Revision 1.1  2002/05/03 03:28:12  root
11  * Initial revision
12  *
13  * 
14  * 10    7/02/99 9:55p Dave
15  * Player engine wash sound.
16  * 
17  * 9     5/24/99 5:45p Dave
18  * Added detail levels to the nebula, with a decent speedup. Split nebula
19  * lightning into its own section.
20  * 
21  * 8     5/18/99 1:30p Dave
22  * Added muzzle flash table stuff.
23  * 
24  * 7     5/09/99 6:00p Dave
25  * Lots of cool new effects. E3 build tweaks.
26  * 
27  * 6     3/23/99 2:29p Andsager
28  * Fix shockwaves for kamikazi and Fred defined.  Collect together
29  * shockwave_create_info struct.
30  * 
31  * 5     2/26/99 4:14p Dave
32  * Put in the ability to have multiple shockwaves for ships.
33  * 
34  * 4     1/27/99 9:56a Dave
35  * Temporary checkin of beam weapons for Dan to make cool sounds.
36  * 
37  * 3     10/20/98 1:39p Andsager
38  * Make so sparks follow animated ship submodels.  Modify
39  * ship_weapon_do_hit_stuff() and ship_apply_local_damage() to add
40  * submodel_num.  Add submodel_num to multiplayer hit packet.
41  * 
42  * 2     10/07/98 10:53a Dave
43  * Initial checkin.
44  * 
45  * 1     10/07/98 10:51a Dave
46  * 
47  * 19    5/22/98 5:32p Andsager
48  * Make big ship explosion sounds play all the way through.  remove
49  * cur_snd from ship struct.
50  * 
51  * 18    5/19/98 8:43p Andsager
52  * Modify sound management (of big ship explosions).  Turn on big ship
53  * explosions for release build.
54  * 
55  * 17    5/12/98 10:54p Andsager
56  * Add new sound manager for big ship sub-explosion sounds
57  * 
58  * 16    4/14/98 11:11p John
59  * Made ships with < 50% hull left show electrical damage arcs.
60  * 
61  * 15    4/14/98 5:43p John
62  * Made large ship blowup system reinit between levels.
63  * 
64  * 14    4/14/98 4:56p John
65  * Hooked in Andsager's large ship exploding code, but it is temporarily
66  * disabled.
67  * 
68  * 13    4/10/98 12:16p Allender
69  * fix ship hit kill and debris packets
70  * 
71  * 12    4/05/98 2:37p John
72  * Made sun on by default.  Fixed some other sun tweaks.
73  * 
74  * 11    1/02/98 5:04p John
75  * Several explosion related changes.  Made fireballs not be used as
76  * ani's.  Made ship spark system expell particles.  Took away impact
77  * explosion for weapon hitting ship... this needs to get added to weapon
78  * info and makes shield hit more obvious.  Only make sparks when hit
79  * hull, not shields.
80  * 
81  * 10    12/17/97 7:53p John
82  * Fixed a bug where gunpoint for flashes were in world coordinates,
83  * should have been object.
84  * 
85  * 9     12/17/97 5:11p John
86  * Added brightening back into fade table.  Added code for doing the fast
87  * dynamic gun flashes and thruster flashes.
88  * 
89  * 8     12/12/97 3:02p John
90  * First Rev of Ship Shadows
91  * 
92  * 7     9/12/97 4:06p John
93  * put in ship warp out effect.
94  * put in dynamic lighting for warp in/out
95  * 
96  * 6     9/09/97 4:52p John
97  * Almost done ship warp in code
98  * 
99  * 5     2/28/97 11:07a John
100  * more fx
101  * 
102  * 4     2/28/97 10:57a John
103  * Made so you can blow off any subsystems, not just radars.
104  * 
105  * 
106  * 3     2/10/97 12:38p John
107  * made all ships blow up into debris pieces when exploded.
108  * 
109  * 2     2/07/97 11:49a John
110  * Some not-final explosions for turrets.
111  * 
112  * 1     2/07/97 10:53a John
113  *
114  * $NoKeywords: $
115  */
116
117
118 #ifndef _SHIPFX_H
119 #define _SHIPFX_H
120
121 struct object;
122 struct ship;
123 struct ship_subsys;
124
125 // Make sparks fly off of ship n
126 // sn = spark number to spark, corrosponding to element in
127 //      ship->hitpos array.  If this isn't -1, it is a just
128 //      got hit by weapon spark, otherwise pick one randomally.
129 void shipfx_emit_spark( int n, int sn );
130
131 // Does the special effects to blow a subsystem off a ship
132 extern void shipfx_blow_off_subsystem(object *ship_obj,ship *ship_p,ship_subsys *subsys, vector *exp_center);
133
134
135 // Creates "ndebris" pieces of debris on random verts of the the "submodel" in the 
136 // ship's model.
137 extern void shipfx_blow_up_model(object *obj,int model, int submodel, int ndebris, vector *exp_center);
138
139 // put here for multiplayer purposes
140 void shipfx_blow_up_hull(object *obj,int model, vector *exp_center );
141
142
143 // =================================================
144 //          SHIP WARP IN EFFECT STUFF
145 // =================================================
146
147 // When a ship warps in, this gets called to start the effect
148 extern void shipfx_warpin_start( object *objp );
149
150 // During a ship warp in, this gets called each frame to move the ship
151 extern void shipfx_warpin_frame( object *objp, float frametime );
152
153 // When a ship warps out, this gets called to start the effect
154 extern void shipfx_warpout_start( object *objp );
155
156 // During a ship warp out, this gets called each frame to move the ship
157 extern void shipfx_warpout_frame( object *objp, float frametime );
158
159 // =================================================
160 //          SHIP SHADOW EFFECT STUFF
161 // =================================================
162
163 // Given point p0, in object's frame of reference, find if 
164 // it can see the sun.
165 int shipfx_point_in_shadow( vector *p0, matrix *src_orient, vector *src_pos, float radius );
166
167 // Given an ship see if it is in a shadow.
168 int shipfx_in_shadow( object * src_obj );
169
170 // Given world point see if it is in a shadow.
171 int shipfx_eye_in_shadow( vector *eye_pos, object *src_obj, int sun_n);
172
173
174 // =================================================
175 //          SHIP GUN FLASH EFFECT STUFF
176 // =================================================
177
178 // Resets the ship flash stuff. Call before
179 // each level.
180 void shipfx_flash_init();
181
182 // Given that a ship fired a weapon, light up the model
183 // accordingly.
184 // Set is_primary to non-zero if this is a primary weapon.
185 // Gun_pos should be in object's frame of reference, not world!!!
186 void shipfx_flash_create(object *objp, ship * shipp, vector *gun_pos, vector *gun_dir, int is_primary, int weapon_info_index);
187
188 // Sets the flash lights in the model used by this
189 // ship to the appropriate values.  There might not
190 // be any flashes linked to this ship in which
191 // case this function does nothing.
192 void shipfx_flash_light_model(object *objp, ship * shipp );
193
194 // Does whatever processing needs to be done each frame.
195 void shipfx_flash_do_frame(float frametime);
196
197
198 // =================================================
199 //          LARGE SHIP EXPLOSION EFFECT STUFF
200 // =================================================
201
202 // Call between levels
203 void shipfx_large_blowup_level_init();
204
205 // Returns 0 if couldn't init
206 int shipfx_large_blowup_init(ship *shipp);
207
208 // Returns 1 when explosion is done
209 int shipfx_large_blowup_do_frame(ship *shipp, float frametime);
210
211 void shipfx_large_blowup_render(ship *shipp);
212
213 // sound manager fore big ship sub explosions sounds
214 void do_sub_expl_sound(float radius, vector* sound_pos, int* sound_handle);
215
216 // do all shockwaves for a ship blowing up
217 void shipfx_do_shockwave_stuff(ship *shipp, shockwave_create_info *sci);
218
219
220 // =================================================
221 //          ELECTRICAL SPARKS ON DAMAGED SHIPS EFFECT STUFF
222 // =================================================
223 void shipfx_do_damaged_arcs_frame( ship *shipp );
224
225
226 // =================================================
227 //                              NEBULA LIGHTNING.
228 // =================================================
229 void shipfx_do_lightning_frame( ship *shipp );
230
231 // engine wash level init
232 void shipfx_engine_wash_level_init();
233
234 // pause engine wash sounds
235 void shipfx_stop_engine_wash_sound();
236
237 #endif
238