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/Ship/ShipFX.h $
15 * Routines for ship effects (as in special)
18 * Revision 1.2 2002/06/09 04:41:15 relnev
19 * added copyright header
21 * Revision 1.1.1.1 2002/05/03 03:28:12 root
25 * 10 7/02/99 9:55p Dave
26 * Player engine wash sound.
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.
32 * 8 5/18/99 1:30p Dave
33 * Added muzzle flash table stuff.
35 * 7 5/09/99 6:00p Dave
36 * Lots of cool new effects. E3 build tweaks.
38 * 6 3/23/99 2:29p Andsager
39 * Fix shockwaves for kamikazi and Fred defined. Collect together
40 * shockwave_create_info struct.
42 * 5 2/26/99 4:14p Dave
43 * Put in the ability to have multiple shockwaves for ships.
45 * 4 1/27/99 9:56a Dave
46 * Temporary checkin of beam weapons for Dan to make cool sounds.
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.
53 * 2 10/07/98 10:53a Dave
56 * 1 10/07/98 10:51a Dave
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.
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.
66 * 17 5/12/98 10:54p Andsager
67 * Add new sound manager for big ship sub-explosion sounds
69 * 16 4/14/98 11:11p John
70 * Made ships with < 50% hull left show electrical damage arcs.
72 * 15 4/14/98 5:43p John
73 * Made large ship blowup system reinit between levels.
75 * 14 4/14/98 4:56p John
76 * Hooked in Andsager's large ship exploding code, but it is temporarily
79 * 13 4/10/98 12:16p Allender
80 * fix ship hit kill and debris packets
82 * 12 4/05/98 2:37p John
83 * Made sun on by default. Fixed some other sun tweaks.
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
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.
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.
100 * 8 12/12/97 3:02p John
101 * First Rev of Ship Shadows
103 * 7 9/12/97 4:06p John
104 * put in ship warp out effect.
105 * put in dynamic lighting for warp in/out
107 * 6 9/09/97 4:52p John
108 * Almost done ship warp in code
110 * 5 2/28/97 11:07a John
113 * 4 2/28/97 10:57a John
114 * Made so you can blow off any subsystems, not just radars.
117 * 3 2/10/97 12:38p John
118 * made all ships blow up into debris pieces when exploded.
120 * 2 2/07/97 11:49a John
121 * Some not-final explosions for turrets.
123 * 1 2/07/97 10:53a John
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 );
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);
146 // Creates "ndebris" pieces of debris on random verts of the the "submodel" in the
148 extern void shipfx_blow_up_model(object *obj,int model, int submodel, int ndebris, vector *exp_center);
150 // put here for multiplayer purposes
151 void shipfx_blow_up_hull(object *obj,int model, vector *exp_center );
154 // =================================================
155 // SHIP WARP IN EFFECT STUFF
156 // =================================================
158 // When a ship warps in, this gets called to start the effect
159 extern void shipfx_warpin_start( object *objp );
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 );
164 // When a ship warps out, this gets called to start the effect
165 extern void shipfx_warpout_start( object *objp );
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 );
170 // =================================================
171 // SHIP SHADOW EFFECT STUFF
172 // =================================================
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 );
178 // Given an ship see if it is in a shadow.
179 int shipfx_in_shadow( object * src_obj );
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);
185 // =================================================
186 // SHIP GUN FLASH EFFECT STUFF
187 // =================================================
189 // Resets the ship flash stuff. Call before
191 void shipfx_flash_init();
193 // Given that a ship fired a weapon, light up the model
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);
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 );
205 // Does whatever processing needs to be done each frame.
206 void shipfx_flash_do_frame(float frametime);
209 // =================================================
210 // LARGE SHIP EXPLOSION EFFECT STUFF
211 // =================================================
213 // Call between levels
214 void shipfx_large_blowup_level_init();
216 // Returns 0 if couldn't init
217 int shipfx_large_blowup_init(ship *shipp);
219 // Returns 1 when explosion is done
220 int shipfx_large_blowup_do_frame(ship *shipp, float frametime);
222 void shipfx_large_blowup_render(ship *shipp);
224 // sound manager fore big ship sub explosions sounds
225 void do_sub_expl_sound(float radius, vector* sound_pos, int* sound_handle);
227 // do all shockwaves for a ship blowing up
228 void shipfx_do_shockwave_stuff(ship *shipp, shockwave_create_info *sci);
231 // =================================================
232 // ELECTRICAL SPARKS ON DAMAGED SHIPS EFFECT STUFF
233 // =================================================
234 void shipfx_do_damaged_arcs_frame( ship *shipp );
237 // =================================================
239 // =================================================
240 void shipfx_do_lightning_frame( ship *shipp );
242 // engine wash level init
243 void shipfx_engine_wash_level_init();
245 // pause engine wash sounds
246 void shipfx_stop_engine_wash_sound();