34 static int                      Mc_submodel;    
 
   45 static vec3d            Mc_direction;   
 
   47 static vec3d            **Mc_point_list = NULL;         
 
   49 static float            Mc_edge_time;
 
   54         if (Mc_point_list != NULL) {
 
   66         if (Mc_point_list != NULL) {
 
   73         Verify( Mc_point_list != NULL );
 
   83         if ( hitpos == NULL )   {
 
   93                 vec3d sphere_mod_min, sphere_mod_max;
 
  135         dist = 
fvi_ray_plane(NULL, plane_pnt, plane_norm, &Mc_p0, &Mc_direction, 0.0
f);
 
  137         if ( dist < 0.0
f ) 
return; 
 
  148         if ( 
fvi_point_face(&hit_point, nv, verts, plane_norm, &u,&v, uvl_list ) )      {
 
  208         if ( !
fvi_sphere_plane( &hit_point, &Mc_p0, &Mc_direction, Mc->
radius, plane_norm, plane_pnt, &face_t, &delta_t ) ) {
 
  216         } 
else if (face_t < 0.0
f) {
 
  220                 if ( (face_t + delta_t) < 0.0
f)
 
  242                 if ( 
fvi_point_face(&hit_point, nv, verts, plane_norm, &u, &v, uvl_list) ) {
 
  311                         if ( (Mc->
num_hits==0) || (sphere_time < Mc->hit_dist) ) {
 
  359         ubyte * normcount = p+20;
 
  362         Assert( Mc_point_list != NULL );
 
  364         for (n=0; n<nverts; n++ ) {
 
  365                 Mc_point_list[
n] = 
src;
 
  367                 src += normcount[
n]+1;
 
  377         ubyte * normcount = p+20;
 
  382         Assert( Mc_point_list != NULL );
 
  384         for (n=0; n<nverts; n++ ) {
 
  385                 Mc_point_list[
n] = 
src;
 
  387                 src += normcount[
n]+1;
 
  422         verts = (
short *)(p+44);
 
  425                 points[
i] = Mc_point_list[verts[i*2]];
 
  429                 mc_check_sphereline_face(nv, points, 
vp(p+20), 
fl(p+32), 
vp(p+8), NULL, -1, p, NULL);
 
  431                 mc_check_face(nv, points, 
vp(p+20), 
fl(p+32), 
vp(p+8), NULL, -1, p, NULL);
 
  463         int tmap_num = 
w(p+40);
 
  476                 points[
i] = Mc_point_list[verts[
i].
vertnum];
 
  477                 uvlist[
i].
u = verts[
i].u;
 
  478                 uvlist[
i].
v = verts[
i].v;
 
  482                 mc_check_sphereline_face(nv, points, 
vp(p+20), 
fl(p+32), 
vp(p+8), uvlist, tmap_num, p, NULL);
 
  484                 mc_check_face(nv, points, 
vp(p+20), 
fl(p+32), 
vp(p+8), uvlist, tmap_num, p, NULL);
 
  505         int frontlist = 
w(p+36);
 
  506         int backlist = 
w(p+40);
 
  507         int prelist = 
w(p+44);
 
  508         int postlist = 
w(p+48);
 
  509         int onlist = 
w(p+52);
 
  512         if ( Mc_pm->
version >= 2000 )   {
 
  534         int chunk_type, chunk_size;
 
  540         while (chunk_type != 
OP_EOF)    {
 
  544                 switch (chunk_type) {
 
  560                         mprintf(( 
"Bad chunk type %d, len=%d in model_collide_sub\n", chunk_type, chunk_size ));
 
  574         int tested_leaf = leaf_index;
 
  578         while ( tested_leaf >= 0 ) {
 
  581                 bool flat_poly = 
false;
 
  597                 for ( i = 0; i < nv; ++
i ) {
 
  619                 tested_leaf = leaf->
next;
 
  639                 if ( node->
leaf >= 0 ) {
 
  658         if ( nv < 0 ) 
return;
 
  665         int tmap_num = 
w(p+40);
 
  676         float face_rad = 
fl(p+32);
 
  683         for ( i = 0; i < nv; ++
i ) {
 
  684                 vert_buffer->push_back(verts[i]);
 
  698         if ( nv < 0 ) 
return;
 
  705         verts = (
short *)(p+44);
 
  712         float face_rad = 
fl(p+32);
 
  721         for ( i = 0; i < nv; ++
i ) {
 
  727                 vert_buffer->push_back(vert);
 
  736         int chunk_type = 
w(p);
 
  737         int chunk_size = 
w(p+4);
 
  773         node_buffer.push_back(new_node);
 
  781         while ( i < node_buffer.size() ) {
 
  787                 switch ( chunk_type ) {
 
  789                         if ( version >= 2000 ) {
 
  793                                 node_buffer[
i].min = *min;
 
  794                                 node_buffer[
i].max = *max;
 
  797                         node_buffer[
i].leaf = -1;
 
  798                         node_buffer[
i].front = -1;
 
  799                         node_buffer[
i].back = -1;
 
  802                                 next_chunk_type = 
w(p+
w(p+36));
 
  804                                 if ( next_chunk_type != 
OP_EOF ) {
 
  805                                         node_buffer.push_back(new_node);
 
  806                                         node_buffer[
i].front = (node_buffer.size() - 1);
 
  807                                         bsp_datap[node_buffer[
i].front] = p+
w(p+36);
 
  812                                 next_chunk_type = 
w(p+
w(p+40));
 
  814                                 if ( next_chunk_type != 
OP_EOF ) {
 
  815                                         node_buffer.push_back(new_node);
 
  816                                         node_buffer[
i].back = (node_buffer.size() - 1);
 
  817                                         bsp_datap[node_buffer[
i].back] = p+
w(p+40);
 
  821                         next_p = p + chunk_size;
 
  822                         next_chunk_type = 
w(next_p);
 
  832                         node_buffer[
i].min = *min;
 
  833                         node_buffer[
i].max = *max;
 
  835                         node_buffer[
i].front = -1;
 
  836                         node_buffer[
i].back = -1;
 
  837                         node_buffer[
i].leaf = -1;
 
  839                         next_p = p + chunk_size;
 
  840                         next_chunk_type = 
w(next_p);
 
  841                         next_chunk_size = 
w(next_p+4);
 
  846                                 node_buffer[
i].leaf = leaf_buffer.size();       
 
  848                                 while ( next_chunk_type != 
OP_EOF ) {
 
  853                                                 leaf_buffer.push_back(new_leaf);
 
  855                                                 leaf_buffer.back().next = leaf_buffer.size();
 
  859                                                 leaf_buffer.push_back(new_leaf);
 
  861                                                 leaf_buffer.back().next = leaf_buffer.size();
 
  866                                         next_p += next_chunk_size;
 
  867                                         next_chunk_type = 
w(next_p);
 
  868                                         next_chunk_size = 
w(next_p+4);
 
  871                                 leaf_buffer.back().next = -1;
 
  886         for ( i = 0; i < (size_t)n_verts; ++
i ) {
 
  893         tree->
n_nodes = node_buffer.size();
 
  899         tree->
n_leaves = leaf_buffer.size();
 
  916         float sphere_check_closest_shield_dist = FLT_MAX;
 
  924         for (
int j = 0; j < 3; j++ )
 
  932                 if ( dist < 0.0
f ) 
return false; 
 
  954                 mc_check_sphereline_face(3, points, points[0], 10000.0
f, &tri->
norm, NULL, 0, NULL, NULL);
 
  959                         sphere_check_closest_shield_dist = Mc->
hit_dist;
 
 1006                 for (
unsigned int i = 0; 
i < *num_polygons_p; 
i++)
 
 1034                 for (o=0; o<8; o++ )    {
 
 1060         Assert( mn < Mc_pm->n_models );
 
 1061         if ( (mn < 0) || (mn>=Mc_pm->
n_models) ) 
return;
 
 1083         if (Mc_pm->
detail[0] == mn)     {
 
 1137                                         for (i = Mc->
lod - 1; i >= 0; i--) {
 
 1166         matrix saved_orient = Mc_orient;
 
 1167         vec3d saved_base = Mc_base;
 
 1174                 bool collision_checked;
 
 1183                         blown_off = csm->
blown_off ? 
true : 
false;
 
 1184                         collision_checked = 
false;
 
 1189                 if ( !blown_off && !collision_checked && !csm->
no_collisions )  {
 
 1251         Mc_edge_time = FLT_MAX;
 
 1270                 model_radius = Mc_pm->
submodel[first_submodel].
rad;
 
 1272                 first_submodel = Mc_pm->
detail[0];
 
 1273                 model_radius = Mc_pm->
rad;
 
 1277                 if ( Mc->
radius <= 0.0f ) {
 
 1278                         Warning(
LOCATION, 
"Attempting to collide with a sphere, but the sphere's radius is <= 0.0f!\n\n(model file is %s; submodel is %d, mc_flags are %d)", Mc_pm->
filename, first_submodel, Mc->
flags);
 
 1403         current_orient = *
orient;
 
void model_collide_defpoints(ubyte *p)
 
void model_collide_sortnorm(ubyte *p)
 
void model_collide_parse_bsp_flatpoly(bsp_collision_leaf *leaf, SCP_vector< model_tmap_vert > *vert_buffer, void *model_ptr)
 
void model_collide_parse_bsp(bsp_collision_tree *tree, void *model_ptr, int version)
 
bsp_collision_leaf * leaf_list
 
int fvi_polyedge_sphereline(vec3d *hit_point, const vec3d *xs0, const vec3d *vs, float Rs, int nv, vec3d const *const *verts, float *hit_time)
 
int Cmdline_old_collision_sys
 
void model_find_world_point(vec3d *outpnt, vec3d *mpnt, int model_num, int submodel_num, const matrix *objorient, const vec3d *objpos)
 
matrix * vm_matrix_x_matrix(matrix *dest, const matrix *src0, const matrix *src1)
 
void vm_vec_scale_add(vec3d *dest, const vec3d *src1, const vec3d *src2, float k)
 
void model_collide_tmappoly(ubyte *p)
 
polymodel * model_get(int model_num)
 
void model_collide_bsp_poly(bsp_collision_tree *tree, int leaf_index)
 
matrix * vm_angles_2_matrix(matrix *m, const angles *a)
 
void vm_rotate_matrix_by_angles(matrix *orient, const angles *tangles)
 
GLsizei const GLfloat * points
 
void _cdecl void void _cdecl void _cdecl Warning(char *filename, int line, SCP_FORMAT_STRING const char *format,...) SCP_FORMAT_STRING_ARGS(3
 
int vm_matrix_same(matrix *m1, matrix *m2)
 
#define MAX_MODEL_TEXTURES
 
int detail[MAX_MODEL_DETAIL_LEVELS]
 
model_tmap_vert * vert_list
 
struct vec3d::@225::@227 xyz
 
matrix * vm_copy_transpose(matrix *dest, const matrix *src)
 
vec3d * vm_vec_rotate(vec3d *dest, const vec3d *src, const matrix *m)
 
shield_tri ** shield_tris
 
bsp_collision_tree * model_get_bsp_collision_tree(int tree_index)
 
void model_collide_bsp(bsp_collision_tree *tree, int node_index)
 
void mc_check_subobj(int mn)
 
int details[MAX_MODEL_DETAIL_LEVELS]
 
bsp_collision_leaf * bsp_leaf
 
int model_collide_parse_bsp_defpoints(ubyte *p)
 
int fvi_sphere_plane(vec3d *intersect_point, const vec3d *sphere_center_start, const vec3d *sphere_velocity, float sphere_radius, const vec3d *plane_normal, const vec3d *plane_point, float *hit_time, float *crossing_time)
 
typedef int(SCP_EXT_CALLCONV *SCPDLL_PFVERSION)(SCPDLL_Version *)
 
void model_instance_find_world_point(vec3d *outpnt, vec3d *mpnt, int model_instance_num, int submodel_num, const matrix *objorient, const vec3d *objpos)
 
void vm_vec_add2(vec3d *dest, const vec3d *src)
 
int model_collide_sub(void *model_ptr)
 
GLdouble GLdouble GLdouble r
 
bool mc_check_sldc(int offset)
 
int fvi_point_face(const vec3d *checkp, int nv, vec3d const *const *verts, const vec3d *norm1, float *u_out, float *v_out, const uv_pair *uvls)
 
texture_map maps[MAX_MODEL_TEXTURES]
 
submodel_instance * submodel
 
void model_collide_preprocess(matrix *orient, int model_instance_num, int detail_num)
 
float vm_vec_dist(const vec3d *v0, const vec3d *v1)
 
#define MONITOR(function_name)
 
#define MC_CHECK_SPHERELINE
 
vec3d * vm_vec_unrotate(vec3d *dest, const vec3d *src, const matrix *m)
 
ubyte * shield_collision_tree
 
void model_collide_parse_bsp_tmappoly(bsp_collision_leaf *leaf, SCP_vector< model_tmap_vert > *vert_buffer, void *model_ptr)
 
#define MC_SUBMODEL_INSTANCE
 
int fvi_ray_sphere(vec3d *intp, const vec3d *p0, const vec3d *p1, const vec3d *sphere_pos, float sphere_rad)
 
#define MONITOR_INC(function_name, inc)
 
void model_collide_flatpoly(ubyte *p)
 
void model_collide_allocate_point_list(int n_points)
 
void _cdecl void void _cdecl Error(const char *filename, int line, SCP_FORMAT_STRING const char *format,...) SCP_FORMAT_STRING_ARGS(3
 
void vm_vec_sub(vec3d *dest, const vec3d *src0, const vec3d *src1)
 
int mc_ray_boundingbox(vec3d *min, vec3d *max, vec3d *p0, vec3d *pdir, vec3d *hitpos)
 
polymodel_instance * model_get_instance(int model_instance_num)
 
#define MC_ONLY_BOUND_BOX
 
int fvi_segment_sphere(vec3d *intp, const vec3d *p0, const vec3d *p1, const vec3d *sphere_pos, float sphere_rad)
 
texture_info textures[TM_NUM_TYPES]
 
void model_collide_free_point_list()
 
float vm_vec_dot(const vec3d *v0, const vec3d *v1)
 
bsp_collision_node * node_list
 
void model_collide_preprocess_subobj(vec3d *pos, matrix *orient, polymodel *pm, polymodel_instance *pmi, int subobj_num)
 
float fvi_ray_plane(vec3d *new_pnt, const vec3d *plane_pnt, const vec3d *plane_norm, const vec3d *ray_origin, const vec3d *ray_direction, float rad)
 
int model_collide(mc_info *mc_info_obj)
 
#define MC_CHECK_INVISIBLE_FACES
 
char filename[FILESPEC_LENGTH]
 
int fvi_ray_boundingbox(const vec3d *min, const vec3d *max, const vec3d *p0, const vec3d *pdir, vec3d *hitpt)
 
bool mc_shield_check_common(shield_tri *tri)