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