Open source remastering of the Freespace 2 engine
debris.cpp File Reference
#include "cmdline/cmdline.h"
#include "debris/debris.h"
#include "fireball/fireballs.h"
#include "freespace2/freespace.h"
#include "gamesnd/gamesnd.h"
#include "globalincs/linklist.h"
#include "io/timer.h"
#include "network/multi.h"
#include "network/multimsgs.h"
#include "network/multiutil.h"
#include "object/objcollide.h"
#include "object/objectsnd.h"
#include "particle/particle.h"
#include "radar/radar.h"
#include "radar/radarsetup.h"
#include "render/3d.h"
#include "ship/ship.h"
#include "ship/shipfx.h"
#include "species_defs/species_defs.h"
#include "weapon/weapon.h"

Go to the source code of this file.


#define MAX_LIFE   10.0f
#define DEBRIS_SOUND_DELAY   2000
#define MAX_DEBRIS_DIST   10000.0f
#define DEBRIS_DISTANCE_CHECK_TIME   (10*1000)
#define DEBRIS_INDEX(dp)   (dp-Debris)
#define MAX_SPEED_BIG_DEBRIS   150
#define DEBRIS_ROTVEL_SCALE   5.0f


void debris_init ()
void debris_page_in ()
void debris_render_DEPRECATED (object *obj)
void debris_clear_expired_flag (debris *db)
void debris_delete (object *obj)
void maybe_delete_debris (debris *db)
void debris_process_post (object *obj, float frame_time)
int debris_find_oldest ()
void calc_debris_physics_properties (physics_info *pi, vec3d *min, vec3d *max)
objectdebris_create (object *source_obj, int model_num, int submodel_num, vec3d *pos, vec3d *exp_center, int hull_flag, float exp_force)
void debris_hit (object *debris_obj, object *other_obj, vec3d *hitpos, float damage)
int debris_check_collision (object *pdebris, object *other_obj, vec3d *hitpos, collision_info_struct *debris_hit_info)
int debris_get_team (object *objp)
void debris_render (object *obj, draw_list *scene)


int Num_hull_pieces
debris Hull_debris_list
debris Debris [MAX_DEBRIS_PIECES]
int Num_debris_pieces = 0
int Debris_inited = 0
int Debris_model = -1
int Debris_vaporize_model = -1
int Debris_num_submodels = 0

Macro Definition Documentation

#define DEBRIS_DISTANCE_CHECK_TIME   (10*1000)

Definition at line 51 of file debris.cpp.

#define DEBRIS_INDEX (   dp)    (dp-Debris)

Definition at line 52 of file debris.cpp.

#define DEBRIS_ROTVEL_SCALE   5.0f

Definition at line 448 of file debris.cpp.

#define DEBRIS_SOUND_DELAY   2000

Definition at line 35 of file debris.cpp.

#define MAX_DEBRIS_DIST   10000.0f

Definition at line 50 of file debris.cpp.


Definition at line 36 of file debris.cpp.

#define MAX_LIFE   10.0f

Definition at line 33 of file debris.cpp.

#define MAX_SPEED_BIG_DEBRIS   150

Definition at line 55 of file debris.cpp.


Definition at line 56 of file debris.cpp.


Definition at line 54 of file debris.cpp.


Definition at line 34 of file debris.cpp.

Function Documentation

void calc_debris_physics_properties ( physics_info pi,
vec3d mins,
vec3d maxs 

Fills in debris physics properties when created, specifically mass and moment of inertia

Definition at line 1075 of file debris.cpp.

int debris_check_collision ( object pdebris,
object other_obj,
vec3d hitpos,
collision_info_struct debris_hit_info 

See if poor debris object *obj got whacked by evil *other_obj at point *hitpos. NOTE: debris_hit_info pointer NULL for debris:weapon collision, otherwise debris:ship collision.

true if hit, else return false.

Definition at line 808 of file debris.cpp.

void debris_clear_expired_flag ( debris db)

Removed the DEBRIS_EXPIRE flag, and remove item from Hull_debris_list

Definition at line 208 of file debris.cpp.

object* debris_create ( object source_obj,
int  model_num,
int  submodel_num,
vec3d pos,
vec3d exp_center,
int  hull_flag,
float  exp_force 

Create debris from an object

source_objSource object
model_numModel number
submodel_numSub-model number
posPosition in vector space
exp_centerExplosion center in vector space
hull_flagHull flag settings
exp_forceExplosion force, used to assign velocity to pieces. 1.0f assigns velocity like before. 2.0f assigns twice as much to non-inherited part of velocity

Definition at line 462 of file debris.cpp.

void debris_delete ( object obj)

Delete the debris object. This is only ever called via obj_delete(). Do not call directly. Use debris_start_death_roll() if you want to force a debris piece to die.

Definition at line 225 of file debris.cpp.

int debris_find_oldest ( )

Locate the oldest hull debris chunk. Search through the Hull_debris_list, which is a list of all the hull debris chunks.

Definition at line 429 of file debris.cpp.

int debris_get_team ( object objp)

Return the team field for a debris object

Definition at line 1065 of file debris.cpp.

void debris_hit ( object debris_obj,
object other_obj,
vec3d hitpos,
float  damage 

Alas, poor debris_obj got whacked. Fortunately, we know who did it, where and how hard, so we can do something about it.

Definition at line 751 of file debris.cpp.

void debris_init ( )

This will get called at the start of each level.

Definition at line 87 of file debris.cpp.

void debris_page_in ( )

Page in debris bitmaps at level load

Definition at line 114 of file debris.cpp.

void debris_process_post ( object obj,
float  frame_time 

Do various updates to debris: check if time to die, start fireballs Maybe delete debris if it's very far away from player.

objpointer to debris object
frame_timetime elapsed since last debris_move() called

Definition at line 284 of file debris.cpp.

void debris_render ( object obj,
draw_list scene 

Definition at line 1099 of file debris.cpp.

void debris_render_DEPRECATED ( object obj)

Render debris

Definition at line 150 of file debris.cpp.

void maybe_delete_debris ( debris db)

If debris piece *db is far away from all players, make it go away very soon. In single player game, delete if MAX_DEBRIS_DIST from player. In multiplayer game, delete if MAX_DEBRIS_DIST from all players.

Definition at line 250 of file debris.cpp.

Variable Documentation

Definition at line 41 of file debris.cpp.

int Debris_inited = 0

Definition at line 44 of file debris.cpp.

int Debris_model = -1

Definition at line 46 of file debris.cpp.

int Debris_num_submodels = 0

Definition at line 48 of file debris.cpp.

int Debris_vaporize_model = -1

Definition at line 47 of file debris.cpp.

debris Hull_debris_list

Definition at line 39 of file debris.cpp.

int Num_debris_pieces = 0

Definition at line 43 of file debris.cpp.

int Num_hull_pieces

Definition at line 38 of file debris.cpp.