Open source remastering of the Freespace 2 engine
objcollide.cpp File Reference
#include "globalincs/linklist.h"
#include "io/timer.h"
#include "object/objcollide.h"
#include "object/object.h"
#include "object/objectdock.h"
#include "ship/ship.h"
#include "weapon/beam.h"
#include "weapon/weapon.h"

Go to the source code of this file.


class  collider_pair


#define MIN_PAIRS   2500
#define PAIRS_BUMP   1000
#define CRW_NO_OBJECT   -1
#define CRW_NO_PAIR   0
#define CRW_IN_PAIR   1
#define CRW_CAN_DELETE   2
#define CRW_MAX_TO_DELETE   4


void obj_pairs_close ()
void obj_all_collisions_retime (int checkdly)
void obj_reset_pairs ()
int reject_obj_pair_on_parent (object *A, object *B)
int reject_due_collision_groups (object *A, object *B)
void obj_add_pair (object *A, object *B, int check_time, int add_to_end)
void obj_check_all_collisions ()
int collide_subdivide (vec3d *p0, vec3d *p1, float prad, vec3d *q0, vec3d *q1, float qrad)
int objects_will_collide (object *A, object *B, float duration, float radius_scale)
int vector_object_collision (vec3d *start_pos, vec3d *end_pos, object *objp, float radius_scale)
int weapon_will_never_hit (object *obj_weapon, object *other, obj_pair *current_pair)
int pp_collide (vec3d *curpos, vec3d *goalpos, object *goalobjp, float radius)
int cpls_aux (vec3d *goal_pos, object *objp2, object *objp)
int collide_predict_large_ship (object *objp, float distance)
void crw_check_weapon (int weapon_num, int collide_next_check)
int collide_remove_weapons ()
void set_hit_struct_info (collision_info_struct *hit, mc_info *mc, int submodel_rot_hit)
void init_collision_info_struct (collision_info_struct *cis)
void obj_add_collider (int obj_index)
void obj_remove_collider (int obj_index)
void obj_reset_colliders ()
void obj_collide_retime_cached_pairs (int checkdly)
void obj_sort_and_collide ()
void obj_find_overlap_colliders (SCP_vector< int > *overlap_list_out, SCP_vector< int > *list, int axis, bool collide)
float obj_get_collider_endpoint (int obj_num, int axis, bool min)
void obj_quicksort_colliders (SCP_vector< int > *list, int left, int right, int axis)
void obj_collide_pair (object *A, object *B)


int Pairs_created = 0
int Num_pairs = 0
int Num_pairs_allocated = 0
int Num_pairs_checked = 0
int pairs_not_created = 0
int Num_pairs_hwm = 0
obj_pairObj_pairs = NULL
obj_pair pair_used_list
obj_pair pair_free_list
SCP_vector< intCollision_sort_list
SCP_unordered_map< uint, collider_pairCollision_cached_pairs
checkobject CheckObjects [MAX_OBJECTS]
int Cmdline_old_collision_sys
int Cmdline_dis_collisions
char crw_status [MAX_WEAPONS]

Macro Definition Documentation

#define CRW_CAN_DELETE   2

Definition at line 1019 of file objcollide.cpp.

#define CRW_IN_PAIR   1

Definition at line 1018 of file objcollide.cpp.

#define CRW_MAX_TO_DELETE   4

Definition at line 1021 of file objcollide.cpp.

#define CRW_NO_OBJECT   -1

Definition at line 1016 of file objcollide.cpp.

#define CRW_NO_PAIR   0

Definition at line 1017 of file objcollide.cpp.

#define MIN_PAIRS   2500

Definition at line 26 of file objcollide.cpp.

#define PAIRS_BUMP   1000

Definition at line 27 of file objcollide.cpp.

Function Documentation

int collide_predict_large_ship ( object objp,
float  distance 

Definition at line 967 of file objcollide.cpp.

int collide_remove_weapons ( void  )

Definition at line 1039 of file objcollide.cpp.

int collide_subdivide ( vec3d p0,
vec3d p1,
float  prad,
vec3d q0,
vec3d q1,
float  qrad 

Definition at line 628 of file objcollide.cpp.

int cpls_aux ( vec3d goal_pos,
object objp2,
object objp 

Definition at line 949 of file objcollide.cpp.

void crw_check_weapon ( int  weapon_num,
int  collide_next_check 

Definition at line 1025 of file objcollide.cpp.

void init_collision_info_struct ( collision_info_struct cis)

Definition at line 1157 of file objcollide.cpp.

void obj_add_collider ( int  obj_index)

Definition at line 1163 of file objcollide.cpp.

void obj_add_pair ( object A,
object B,
int  check_time,
int  add_to_end 

Definition at line 174 of file objcollide.cpp.

void obj_all_collisions_retime ( int  checkdly)

Definition at line 80 of file objcollide.cpp.

void obj_check_all_collisions ( )

Definition at line 530 of file objcollide.cpp.

void obj_collide_pair ( object A,
object B 

Definition at line 1378 of file objcollide.cpp.

void obj_collide_retime_cached_pairs ( int  checkdly)

Definition at line 1209 of file objcollide.cpp.

void obj_find_overlap_colliders ( SCP_vector< int > *  overlap_list_out,
SCP_vector< int > *  list,
int  axis,
bool  collide 

Definition at line 1242 of file objcollide.cpp.

float obj_get_collider_endpoint ( int  obj_num,
int  axis,
bool  min 

Definition at line 1295 of file objcollide.cpp.

void obj_pairs_close ( )

Definition at line 70 of file objcollide.cpp.

void obj_quicksort_colliders ( SCP_vector< int > *  list,
int  left,
int  right,
int  axis 

Definition at line 1342 of file objcollide.cpp.

void obj_remove_collider ( int  obj_index)

Definition at line 1184 of file objcollide.cpp.

void obj_reset_colliders ( )

Definition at line 1203 of file objcollide.cpp.

void obj_reset_pairs ( )

Definition at line 98 of file objcollide.cpp.

void obj_sort_and_collide ( )

Definition at line 1218 of file objcollide.cpp.

int objects_will_collide ( object A,
object B,
float  duration,
float  radius_scale 

Definition at line 672 of file objcollide.cpp.

int pp_collide ( vec3d curpos,
vec3d goalpos,
object goalobjp,
float  radius 

Definition at line 926 of file objcollide.cpp.

int reject_due_collision_groups ( object A,
object B 

Definition at line 165 of file objcollide.cpp.

int reject_obj_pair_on_parent ( object A,
object B 

Definition at line 136 of file objcollide.cpp.

void set_hit_struct_info ( collision_info_struct hit,
mc_info mc,
int  submodel_rot_hit 

Definition at line 1144 of file objcollide.cpp.

int vector_object_collision ( vec3d start_pos,
vec3d end_pos,
object objp,
float  radius_scale 

Definition at line 713 of file objcollide.cpp.

int weapon_will_never_hit ( object obj_weapon,
object other,
obj_pair current_pair 

Definition at line 730 of file objcollide.cpp.

Variable Documentation

checkobject CheckObjects[MAX_OBJECTS]
int Cmdline_dis_collisions

Definition at line 490 of file cmdline.cpp.

int Cmdline_old_collision_sys

Definition at line 489 of file cmdline.cpp.

SCP_unordered_map<uint, collider_pair> Collision_cached_pairs

Definition at line 63 of file objcollide.cpp.

SCP_vector<int> Collision_sort_list

Definition at line 44 of file objcollide.cpp.

char crw_status[MAX_WEAPONS]

Definition at line 1023 of file objcollide.cpp.

int Num_pairs = 0

Removes any occurances of object 'a' from the pairs list.

Definition at line 32 of file objcollide.cpp.

int Num_pairs_allocated = 0

Definition at line 33 of file objcollide.cpp.

int Num_pairs_checked = 0

Definition at line 34 of file objcollide.cpp.

int Num_pairs_hwm = 0

Definition at line 37 of file objcollide.cpp.

obj_pair* Obj_pairs = NULL

Definition at line 39 of file objcollide.cpp.

obj_pair pair_free_list

Definition at line 42 of file objcollide.cpp.

obj_pair pair_used_list

Definition at line 41 of file objcollide.cpp.

int Pairs_created = 0

Definition at line 31 of file objcollide.cpp.

int pairs_not_created = 0

Definition at line 35 of file objcollide.cpp.