1 /* $Id: fvi.h,v 1.3 2004-08-28 23:17:45 schaffner Exp $ */
3 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
4 SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
5 END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
6 ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
7 IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
8 SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
9 FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
10 CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
11 AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
12 COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
29 //return values for find_vector_intersection() - what did we hit?
30 #define HIT_NONE 0 //we hit nothing
31 #define HIT_WALL 1 //we hit - guess - a wall
32 #define HIT_OBJECT 2 //we hit an object - which one? no way to tell...
33 #define HIT_BAD_P0 3 //start point not is specified segment
35 #define MAX_FVI_SEGS 100
37 //this data structure gets filled in by find_vector_intersection()
38 typedef struct fvi_info {
39 int hit_type; //what sort of intersection
40 vms_vector hit_pnt; //where we hit
41 int hit_seg; //what segment hit_pnt is in
42 int hit_side; //if hit wall, which side
43 int hit_side_seg; //what segment the hit side is in
44 int hit_object; //if object hit, which object
45 vms_vector hit_wallnorm; //if hit wall, ptr to its surface normal
46 int n_segs; //how many segs we went through
47 int seglist[MAX_FVI_SEGS]; //list of segs vector went through
51 #define FQ_CHECK_OBJS 1 //check against objects?
52 #define FQ_TRANSWALL 2 //go through transparent walls
53 #define FQ_TRANSPOINT 4 //go through trans wall if hit point is transparent
54 #define FQ_GET_SEGLIST 8 //build a list of segments
55 #define FQ_IGNORE_POWERUPS 16 //ignore powerups
57 //this data contains the parms to fvi()
58 typedef struct fvi_query {
67 //Find out if a vector intersects with anything.
68 //Fills in hit_data, an fvi_info structure (see above).
70 // p0 & startseg describe the start of the vector
71 // p1 the end of the vector
72 // rad the radius of the cylinder
73 // thisobjnum used to prevent an object with colliding with itself
74 // ingore_obj_list NULL, or ptr to a list of objnums to ignore, terminated with -1
75 // check_obj_flag determines whether collisions with objects are checked
76 //Returns the hit_data->hit_type
77 int find_vector_intersection(fvi_query *fq,fvi_info *hit_data);
79 //finds the uv coords of the given point on the given seg & side
80 //fills in u & v. if l is non-NULL fills it in also
81 void find_hitpoint_uv(fix *u,fix *v,fix *l, vms_vector *pnt,segment *seg,int sidenum,int facenum);
83 //Returns true if the object is through any walls
84 int object_intersects_wall(object *objp);