2 * $Logfile: /Freespace2/code/Ship/ShipFX.h $
7 * Routines for ship effects (as in special)
10 * Revision 1.1 2002/05/03 03:28:12 root
14 * 10 7/02/99 9:55p Dave
15 * Player engine wash sound.
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.
21 * 8 5/18/99 1:30p Dave
22 * Added muzzle flash table stuff.
24 * 7 5/09/99 6:00p Dave
25 * Lots of cool new effects. E3 build tweaks.
27 * 6 3/23/99 2:29p Andsager
28 * Fix shockwaves for kamikazi and Fred defined. Collect together
29 * shockwave_create_info struct.
31 * 5 2/26/99 4:14p Dave
32 * Put in the ability to have multiple shockwaves for ships.
34 * 4 1/27/99 9:56a Dave
35 * Temporary checkin of beam weapons for Dan to make cool sounds.
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.
42 * 2 10/07/98 10:53a Dave
45 * 1 10/07/98 10:51a Dave
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.
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.
55 * 17 5/12/98 10:54p Andsager
56 * Add new sound manager for big ship sub-explosion sounds
58 * 16 4/14/98 11:11p John
59 * Made ships with < 50% hull left show electrical damage arcs.
61 * 15 4/14/98 5:43p John
62 * Made large ship blowup system reinit between levels.
64 * 14 4/14/98 4:56p John
65 * Hooked in Andsager's large ship exploding code, but it is temporarily
68 * 13 4/10/98 12:16p Allender
69 * fix ship hit kill and debris packets
71 * 12 4/05/98 2:37p John
72 * Made sun on by default. Fixed some other sun tweaks.
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
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.
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.
89 * 8 12/12/97 3:02p John
90 * First Rev of Ship Shadows
92 * 7 9/12/97 4:06p John
93 * put in ship warp out effect.
94 * put in dynamic lighting for warp in/out
96 * 6 9/09/97 4:52p John
97 * Almost done ship warp in code
99 * 5 2/28/97 11:07a John
102 * 4 2/28/97 10:57a John
103 * Made so you can blow off any subsystems, not just radars.
106 * 3 2/10/97 12:38p John
107 * made all ships blow up into debris pieces when exploded.
109 * 2 2/07/97 11:49a John
110 * Some not-final explosions for turrets.
112 * 1 2/07/97 10:53a John
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 );
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);
135 // Creates "ndebris" pieces of debris on random verts of the the "submodel" in the
137 extern void shipfx_blow_up_model(object *obj,int model, int submodel, int ndebris, vector *exp_center);
139 // put here for multiplayer purposes
140 void shipfx_blow_up_hull(object *obj,int model, vector *exp_center );
143 // =================================================
144 // SHIP WARP IN EFFECT STUFF
145 // =================================================
147 // When a ship warps in, this gets called to start the effect
148 extern void shipfx_warpin_start( object *objp );
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 );
153 // When a ship warps out, this gets called to start the effect
154 extern void shipfx_warpout_start( object *objp );
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 );
159 // =================================================
160 // SHIP SHADOW EFFECT STUFF
161 // =================================================
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 );
167 // Given an ship see if it is in a shadow.
168 int shipfx_in_shadow( object * src_obj );
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);
174 // =================================================
175 // SHIP GUN FLASH EFFECT STUFF
176 // =================================================
178 // Resets the ship flash stuff. Call before
180 void shipfx_flash_init();
182 // Given that a ship fired a weapon, light up the model
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);
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 );
194 // Does whatever processing needs to be done each frame.
195 void shipfx_flash_do_frame(float frametime);
198 // =================================================
199 // LARGE SHIP EXPLOSION EFFECT STUFF
200 // =================================================
202 // Call between levels
203 void shipfx_large_blowup_level_init();
205 // Returns 0 if couldn't init
206 int shipfx_large_blowup_init(ship *shipp);
208 // Returns 1 when explosion is done
209 int shipfx_large_blowup_do_frame(ship *shipp, float frametime);
211 void shipfx_large_blowup_render(ship *shipp);
213 // sound manager fore big ship sub explosions sounds
214 void do_sub_expl_sound(float radius, vector* sound_pos, int* sound_handle);
216 // do all shockwaves for a ship blowing up
217 void shipfx_do_shockwave_stuff(ship *shipp, shockwave_create_info *sci);
220 // =================================================
221 // ELECTRICAL SPARKS ON DAMAGED SHIPS EFFECT STUFF
222 // =================================================
223 void shipfx_do_damaged_arcs_frame( ship *shipp );
226 // =================================================
228 // =================================================
229 void shipfx_do_lightning_frame( ship *shipp );
231 // engine wash level init
232 void shipfx_engine_wash_level_init();
234 // pause engine wash sounds
235 void shipfx_stop_engine_wash_sound();