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