FS2_Open
Open source remastering of the Freespace 2 engine
debris.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 _DEBRIS_H
13 #define _DEBRIS_H
14 
15 #include "globalincs/pstypes.h"
16 
17 class object;
18 struct CFILE;
19 class draw_list;
20 
21 #define MAX_DEBRIS_ARCS 8 // Must be less than MAX_ARC_EFFECTS in model.h
22 
23 typedef struct debris {
24  debris *next, *prev; // used for a linked list of the hull debris chunks
25  int flags; // See DEBRIS_??? defines
26  int source_objnum; // What object this came from
27  int source_sig; // Signature of the source object
28  int damage_type_idx; // Damage type of this debris
29  int ship_info_index; // Ship info index of the ship type debris came from
30  int team; // Team of the ship where the debris came from
31  int objnum; // What object this is linked to
32  float lifeleft; // When 0 or less object dies
33  int must_survive_until; //WMC - timestamp of earliest point that it can be murthered.
34  int model_num; // What model this uses
35  int submodel_num; // What submodel this uses
36  int next_fireball; // When to start a fireball
37  int is_hull; // indicates a large hull chunk of debris
38  int species; // What species this is from. -1 if don't care.
39  int fire_timeout; // timestamp that holds time for fireballs to stop appearing
40  int sound_delay; // timestamp to signal when sound should start
41  fix time_started; // time when debris was created
42  int next_distance_check; // timestamp to determine whether to delete this piece of debris.
43 
44  vec3d arc_pts[MAX_DEBRIS_ARCS][2]; // The endpoints of each arc
45  int arc_timestamp[MAX_DEBRIS_ARCS]; // When this times out, the spark goes away. -1 is not used
46  int arc_frequency; // Starts at 0, gets bigger
48  float damage_mult;
49 
50 } debris;
51 
52 
53 // flags for debris pieces
54 #define DEBRIS_USED (1<<0)
55 #define DEBRIS_EXPIRE (1<<1) // debris can expire (ie hull chunks from small ships)
56 
57 #define MAX_DEBRIS_PIECES 64
58 
60 
61 extern int Num_debris_pieces;
62 
64 
65 void debris_init();
66 void debris_render_DEPRECATED( object * obj );
67 void debris_render(object * obj, draw_list *scene);
68 void debris_delete( object * obj );
69 void debris_process_post( object * obj, float frame_time);
70 object *debris_create( object * source_obj, int model_num, int submodel_num, vec3d *pos, vec3d *exp_center, int hull_flag, float exp_force );
71 int debris_check_collision( object * obj, object * other_obj, vec3d * hitpos, collision_info_struct *debris_hit_info=NULL );
72 void debris_hit( object * debris_obj, object * other_obj, vec3d * hitpos, float damage );
73 int debris_get_team(object *objp);
75 
76 #endif // _DEBRIS_H
int arc_frequency
Definition: debris.h:46
debris Debris[MAX_DEBRIS_PIECES]
Definition: debris.cpp:41
int next_distance_check
Definition: debris.h:42
fix time_started
Definition: debris.h:41
int source_sig
Definition: debris.h:27
Definition: pstypes.h:88
object * debris_create(object *source_obj, int model_num, int submodel_num, vec3d *pos, vec3d *exp_center, int hull_flag, float exp_force)
Definition: debris.cpp:462
vec3d arc_pts[MAX_DEBRIS_ARCS][2]
Definition: debris.h:44
int model_num
Definition: debris.h:34
Definition: cfile.h:28
int damage_type_idx
Definition: debris.h:28
void debris_delete(object *obj)
Definition: debris.cpp:225
object * objp
Definition: lua.cpp:3105
#define MAX_DEBRIS_PIECES
Definition: debris.h:57
hull_check submodel_num
Definition: lua.cpp:5048
int debris_get_team(object *objp)
Definition: debris.cpp:1065
int submodel_num
Definition: debris.h:35
int debris_check_collision(object *obj, object *other_obj, vec3d *hitpos, collision_info_struct *debris_hit_info=NULL)
Definition: debris.cpp:808
int fire_timeout
Definition: debris.h:39
int is_hull
Definition: debris.h:37
Definition: debris.h:23
int team
Definition: debris.h:30
debris * prev
Definition: debris.h:24
float damage_mult
Definition: debris.h:48
int flags
Definition: debris.h:25
float lifeleft
Definition: debris.h:32
int ship_info_index
Definition: debris.h:29
debris * next
Definition: debris.h:24
int source_objnum
Definition: debris.h:26
long fix
Definition: pstypes.h:54
Definition: object.h:141
int sound_delay
Definition: debris.h:40
int Num_debris_pieces
Definition: debris.cpp:43
int parent_alt_name
Definition: debris.h:47
void debris_render(object *obj, draw_list *scene)
Definition: debris.cpp:1099
int objnum
Definition: debris.h:31
int species
Definition: debris.h:38
int must_survive_until
Definition: debris.h:33
float frame_time
Definition: multi.cpp:1426
#define MAX_DEBRIS_ARCS
Definition: debris.h:21
void debris_process_post(object *obj, float frame_time)
Definition: debris.cpp:284
void debris_init()
Definition: debris.cpp:87
struct debris debris
int arc_timestamp[MAX_DEBRIS_ARCS]
Definition: debris.h:45
int next_fireball
Definition: debris.h:36
hull_check pos
Definition: lua.cpp:5050
GLsizei GLsizei GLuint * obj
Definition: Glext.h:5619
void debris_render_DEPRECATED(object *obj)
Definition: debris.cpp:150
void debris_clear_expired_flag(debris *db)
Definition: debris.cpp:208
int model_num
Definition: lua.cpp:4996
void debris_hit(object *debris_obj, object *other_obj, vec3d *hitpos, float damage)
Definition: debris.cpp:751