]> icculus.org git repositories - btb/d2x.git/blob - main/physics.h
fix off-by-one error in ogl_urect, right and bottom are inclusive not exclusive ...
[btb/d2x.git] / main / physics.h
1 /* $Id: physics.h,v 1.2 2003-10-10 09:36:35 btb Exp $ */
2 /*
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.
13 */
14
15 /*
16  *
17  * Headers for physics functions and data
18  *
19  * Old Log:
20  * Revision 1.2  1995/08/23  21:33:04  allender
21  * fix mcc compiler warnings
22  *
23  * Revision 1.1  1995/05/16  16:00:56  allender
24  * Initial revision
25  *
26  * Revision 2.0  1995/02/27  11:33:06  john
27  * New version 2.0, which has no anonymous unions, builds with
28  * Watcom 10.0, and doesn't require parsing BITMAPS.TBL.
29  *
30  * Revision 1.29  1995/02/06  19:47:18  matt
31  * New function (untested), set_thrust_from_velocity()
32  *
33  * Revision 1.28  1994/12/04  22:14:20  mike
34  * apply instantaneous rotation to an object due to a force blow.
35  *
36  * Revision 1.27  1994/08/01  13:29:42  matt
37  * Made fvi() check holes in transparent walls, and changed fvi() calling
38  * parms to take all input data in query structure.
39  *
40  * Revision 1.26  1994/07/28  12:35:22  matt
41  * Added prototype
42  *
43  * Revision 1.25  1994/07/13  21:48:05  matt
44  * FVI() and physics now keep lists of segments passed through which the
45  * trigger code uses.
46  *
47  * Revision 1.24  1994/06/30  19:01:55  matt
48  * Moved flying controls code from physics.c to controls.c
49  *
50  * Revision 1.23  1994/06/16  14:14:20  mike
51  * Change physics_lookahead to return hit_info.
52  *
53  * Revision 1.22  1994/06/09  09:58:43  matt
54  * Moved find_vector_intersection() from physics.c to new file fvi.c
55  *
56  * Revision 1.21  1994/05/20  16:11:07  matt
57  * Added new parm, ignore_obj, to find_vector_intersection()
58  *
59  * Revision 1.20  1994/05/20  15:16:58  matt
60  * Added new fvi return type; took out some troublesome (and troubling) asserts
61  *
62  *
63  *
64  */
65
66
67 #ifndef _PHYSICS_H
68 #define _PHYSICS_H
69
70 #include "vecmat.h"
71 #include "fvi.h"
72
73 //#define FL_NORMAL  0
74 //#define FL_TURBO   1
75 //#define FL_HOVER   2
76 //#define FL_REVERSE 3
77
78 // these global vars are set after a call to do_physics_sim().  Ugly, I know.
79 // list of segments went through
80 extern int phys_seglist[MAX_FVI_SEGS], n_phys_segs;
81
82 // Read contrls and set physics vars
83 void read_flying_controls(object *obj);
84
85 // Simulate a physics object for this frame
86 void do_physics_sim(object *obj);
87
88 // tell us what the given object will do (as far as hiting walls) in
89 // the given time (in seconds) t.  Igores acceleration (sorry)
90 // if check_objects is set, check with objects, else just with walls
91 // returns fate, fills in hit time.  If fate==HIT_NONE, hit_time undefined
92 // Stuff hit_info with fvi data as set by find_vector_intersection.
93 // for fvi_flags, refer to fvi.h for the fvi query flags
94 int physics_lookahead(object *obj, fix t, int fvi_flags, fix *hit_time, fvi_info *hit_info);
95
96 // Applies an instantaneous force on an object, resulting in an instantaneous
97 // change in velocity.
98 void phys_apply_force(object *obj, vms_vector *force_vec);
99 void phys_apply_rot(object *obj, vms_vector *force_vec);
100
101 // this routine will set the thrust for an object to a value that will
102 // (hopefully) maintain the object's current velocity
103 void set_thrust_from_velocity(object *obj);
104
105 #endif /* _PHYSICS_H */