FS2_Open
Open source remastering of the Freespace 2 engine
shiphit.h
Go to the documentation of this file.
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 the
6  * source.
7  *
8 */
9 
10 
11 
12 #ifndef _SHIPHIT_H
13 #define _SHIPHIT_H
14 
15 struct vec3d;
16 class ship;
17 class ship_subsys;
18 class object;
19 
20 #define NO_SPARKS 0
21 #define CREATE_SPARKS 1
22 
23 #define MISS_SHIELDS -1
24 
25 // ===================== NOTE!! =========================
26 // To apply damage to a ship, call either ship_apply_local_damage or ship_apply_global_damage.
27 // These replace the old calls to ship_hit and ship_do_damage...
28 // These functions do nothing to the ship's physics; that is the responsibility
29 // of whoever is calling these functions. These functions are strictly
30 // for damaging ship's hulls, shields, and subsystems. Nothing more.
31 
32 // function to destroy a subsystem. Called internally and from multiplayer messaging code
33 extern void do_subobj_destroyed_stuff( ship *ship_p, ship_subsys *subsys, vec3d *hitpos, bool no_explosion = false );
34 
35 // Goober5000
36 extern void ship_apply_tag(int ship_num, int tag_level, float tag_time, object *target, vec3d *start, int ssm_index, int ssm_team);
37 
38 // This gets called to apply damage when something hits a particular point on a ship.
39 // This assumes that whoever called this knows if the shield got hit or not.
40 // hitpos is in world coordinates.
41 // if quadrant is not -1, then that part of the shield takes damage properly.
42 void ship_apply_local_damage(object *ship_obj, object *other_obj, vec3d *hitpos, float damage, int quadrant, bool create_spark=true, int submodel_num=-1, vec3d *hit_normal=0 /*NULL*/);
43 
44 // This gets called to apply damage when a damaging force hits a ship, but at no
45 // point in particular. Like from a shockwave. This routine will see if the
46 // shield got hit and if so, apply damage to it.
47 // You can pass force_center==NULL if you the damage doesn't come from anywhere,
48 // like for debug keys to damage an object or something. It will
49 // assume damage is non-directional and will apply it correctly.
50 void ship_apply_global_damage(object *ship_obj, object *other_obj, vec3d *force_center, float damage );
51 
52 // like above, but does not apply damage to shields
53 void ship_apply_wash_damage(object *ship_obj, object *other_obj, float damage);
54 
55 // next routine needed for multiplayer
56 void ship_hit_kill( object *ship_obj, object *other_obj, float percent_killed, int self_destruct);
57 
58 void ship_self_destruct( object *objp );
59 
60 // Call this instead of physics_apply_whack directly to
61 // deal with two docked ships properly.
62 void ship_apply_whack(vec3d *force, vec3d *hit_pos, object *objp);
63 
64 // externed for code in missionparse to create sparks on a ship with < 100% hull integrity.
65 void ship_hit_sparks_no_rotate(object *ship_obj, vec3d *hitpos);
66 
67 // externed so that ships which self destruct have the proper things done to them in multiplayer
68 void ship_generic_kill_stuff( object *objp, float percent_killed );
69 
70 // find the max number of sparks allowed for ship
71 // limited for fighter by hull % others by radius.
72 int get_max_sparks(object* ship_obj);
73 
74 // player pain
75 void ship_hit_pain(float damage, int quadrant);
76 
77 
78 #endif //_SHIPHIT_H
void do_subobj_destroyed_stuff(ship *ship_p, ship_subsys *subsys, vec3d *hitpos, bool no_explosion=false)
Definition: shiphit.cpp:108
Definition: pstypes.h:88
void ship_apply_local_damage(object *ship_obj, object *other_obj, vec3d *hitpos, float damage, int quadrant, bool create_spark=true, int submodel_num=-1, vec3d *hit_normal=0)
Definition: shiphit.cpp:2359
object * objp
Definition: lua.cpp:3105
void ship_apply_whack(vec3d *force, vec3d *hit_pos, object *objp)
Definition: shiphit.cpp:1740
hull_check submodel_num
Definition: lua.cpp:5048
void ship_generic_kill_stuff(object *objp, float percent_killed)
Definition: shiphit.cpp:1371
void ship_hit_sparks_no_rotate(object *ship_obj, vec3d *hitpos)
Definition: shiphit.cpp:1030
Definition: ship.h:534
void ship_hit_pain(float damage, int quadrant)
Definition: shiphit.cpp:2562
Definition: object.h:141
int get_max_sparks(object *ship_obj)
Definition: shiphit.cpp:1054
GLuint start
Definition: Gl.h:1502
void ship_apply_wash_damage(object *ship_obj, object *other_obj, float damage)
Definition: shiphit.cpp:2532
GLenum target
Definition: Glext.h:6872
void ship_apply_tag(int ship_num, int tag_level, float tag_time, object *target, vec3d *start, int ssm_index, int ssm_team)
Definition: shiphit.cpp:2324
void ship_apply_global_damage(object *ship_obj, object *other_obj, vec3d *force_center, float damage)
Definition: shiphit.cpp:2476
void ship_hit_kill(object *ship_obj, object *other_obj, float percent_killed, int self_destruct)
Definition: shiphit.cpp:1542
void ship_self_destruct(object *objp)
Definition: shiphit.cpp:1697