Open source remastering of the Freespace 2 engine
asteroid.h File Reference

Go to the source code of this file.


struct  asteroid_obj
struct  asteroid_split_info
class  asteroid_info
struct  asteroid
struct  asteroid_field


#define MAX_ASTEROIDS   512
#define NUM_DEBRIS_SIZES   3
#define NUM_DEBRIS_POFS   3
#define AF_USED   (1<<0)


typedef struct asteroid_obj asteroid_obj
typedef struct asteroid_split_info asteroid_split_info
typedef struct asteroid asteroid
typedef struct asteroid_field asteroid_field


enum  debris_genre_t { DG_ASTEROID, DG_SHIP }
enum  field_type_t { FT_ACTIVE, FT_PASSIVE }


void asteroid_init ()
void asteroid_level_init ()
void asteroid_level_close ()
void asteroid_create_all ()
void asteroid_render_DEPRECATED (object *asteroid_objp)
void asteroid_render (object *obj, draw_list *scene)
void asteroid_delete (object *asteroid_objp)
void asteroid_process_pre (object *asteroid_objp)
void asteroid_process_post (object *asteroid_objp)
int asteroid_check_collision (object *asteroid_objp, object *other_obj, vec3d *hitpos, collision_info_struct *asteroid_hit_info=NULL)
void asteroid_hit (object *pasteroid_objp, object *other_objp, vec3d *hitpos, float damage)
int asteroid_count ()
int asteroid_collide_objnum (object *asteroid_objp)
float asteroid_time_to_impact (object *asteroid_objp)
void asteroid_show_brackets ()
void asteroid_target_closest_danger ()
int asteroid_get_random_in_cone (vec3d *pos, vec3d *dir, float ang, int danger=0)
void asteroid_sub_create (object *parent_objp, int asteroid_type, vec3d *relvec)
void asteroid_frame ()


asteroid_obj Asteroid_obj_list
SCP_vector< asteroid_infoAsteroid_info
asteroid Asteroids [MAX_ASTEROIDS]
asteroid_field Asteroid_field
int Num_asteroids
int Asteroids_enabled
char Asteroid_icon_closeup_model [NAME_LENGTH]
vec3d Asteroid_icon_closeup_position
float Asteroid_icon_closeup_zoom

Macro Definition Documentation

#define AF_USED   (1<<0)

Definition at line 96 of file asteroid.h.


Definition at line 31 of file asteroid.h.


Definition at line 30 of file asteroid.h.


Definition at line 29 of file asteroid.h.


Definition at line 34 of file asteroid.h.


Definition at line 37 of file asteroid.h.

#define MAX_ASTEROIDS   512

Definition at line 24 of file asteroid.h.

#define NUM_DEBRIS_POFS   3

Definition at line 27 of file asteroid.h.

#define NUM_DEBRIS_SIZES   3

Definition at line 26 of file asteroid.h.

Typedef Documentation

typedef struct asteroid asteroid
typedef struct asteroid_obj asteroid_obj

Enumeration Type Documentation


Definition at line 115 of file asteroid.h.


Definition at line 121 of file asteroid.h.

Function Documentation

int asteroid_check_collision ( object asteroid_objp,
object other_obj,
vec3d hitpos,
collision_info_struct asteroid_hit_info = NULL 

Definition at line 918 of file asteroid.cpp.

int asteroid_collide_objnum ( object asteroid_objp)

Find the object number of the object the asteroid is about to impact

the object number that the asteroid is about to impact

Definition at line 1781 of file asteroid.cpp.

int asteroid_count ( )

Return the number of active asteroids

Definition at line 1473 of file asteroid.cpp.

void asteroid_create_all ( )

Create all the asteroids for the mission

Definition at line 529 of file asteroid.cpp.

void asteroid_delete ( object obj)

Delete asteroid from Asteroid_used_list

Definition at line 826 of file asteroid.cpp.

void asteroid_frame ( )

Definition at line 2122 of file asteroid.cpp.

int asteroid_get_random_in_cone ( vec3d pos,
vec3d dir,
float  ang,
int  danger = 0 

Definition at line 1600 of file asteroid.cpp.

void asteroid_hit ( object pasteroid_obj,
object other_obj,
vec3d hitpos,
float  damage 

Upon asteroid asteroid_obj being hit. Apply damage and maybe make it break into smaller asteroids.

pasteroid_objpointer to asteroid object getting hit
other_objobject that hit asteroid, can be NULL if asteroid hit by area effect
hitposworld position asteroid was hit, can be NULL if hit by area effect
damageamount of damage to apply to asteroid

Definition at line 1368 of file asteroid.cpp.

void asteroid_init ( )

Called once, at game start. Do any one-time initializations here

Definition at line 2140 of file asteroid.cpp.

void asteroid_level_close ( )

De-init asteroids, called from game_level_close()

Definition at line 1423 of file asteroid.cpp.

void asteroid_level_init ( )

Init asteriod system for the level, called from game_level_init()

Definition at line 628 of file asteroid.cpp.

void asteroid_process_post ( object asteroid_objp)

Definition at line 1750 of file asteroid.cpp.

void asteroid_process_pre ( object asteroid_objp)

Definition at line 908 of file asteroid.cpp.

void asteroid_render ( object obj,
draw_list scene 

Definition at line 1189 of file asteroid.cpp.

void asteroid_render_DEPRECATED ( object asteroid_objp)

Definition at line 1170 of file asteroid.cpp.

void asteroid_show_brackets ( )

Draw brackets around on-screen asteroids that are about to collide, otherwise draw an offscreen indicator

Definition at line 2150 of file asteroid.cpp.

void asteroid_sub_create ( object parent_objp,
int  asteroid_type,
vec3d relvec 

Create asteroids when parent_objp blows up.

Definition at line 405 of file asteroid.cpp.

void asteroid_target_closest_danger ( )

Target the closest danger asteroid to the player

Definition at line 2192 of file asteroid.cpp.

float asteroid_time_to_impact ( object asteroid_objp)

Find the time until asteroid will collide with object

the time until the asteroid will impact its collide_objnum

Definition at line 1790 of file asteroid.cpp.

Variable Documentation

asteroid_field Asteroid_field

Definition at line 64 of file asteroid.cpp.

char Asteroid_icon_closeup_model[NAME_LENGTH]

Definition at line 69 of file asteroid.cpp.

vec3d Asteroid_icon_closeup_position

Definition at line 70 of file asteroid.cpp.

float Asteroid_icon_closeup_zoom

Definition at line 71 of file asteroid.cpp.

SCP_vector< asteroid_info > Asteroid_info

Definition at line 62 of file asteroid.cpp.

asteroid_obj Asteroid_obj_list

Definition at line 50 of file asteroid.cpp.

asteroid Asteroids[MAX_ASTEROIDS]

Definition at line 63 of file asteroid.cpp.

int Asteroids_enabled

Definition at line 57 of file asteroid.cpp.

int Num_asteroids

Definition at line 58 of file asteroid.cpp.