]> icculus.org git repositories - btb/d2x.git/blob - main/physics.h
replace byte with sbyte
[btb/d2x.git] / main / physics.h
1 /* $Id: physics.h,v 1.3 2004-08-28 23:17:45 schaffner 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  */
20
21
22 #ifndef _PHYSICS_H
23 #define _PHYSICS_H
24
25 #include "vecmat.h"
26 #include "fvi.h"
27
28 //#define FL_NORMAL  0
29 //#define FL_TURBO   1
30 //#define FL_HOVER   2
31 //#define FL_REVERSE 3
32
33 // these global vars are set after a call to do_physics_sim().  Ugly, I know.
34 // list of segments went through
35 extern int phys_seglist[MAX_FVI_SEGS], n_phys_segs;
36
37 // Read contrls and set physics vars
38 void read_flying_controls(object *obj);
39
40 // Simulate a physics object for this frame
41 void do_physics_sim(object *obj);
42
43 // tell us what the given object will do (as far as hiting walls) in
44 // the given time (in seconds) t.  Igores acceleration (sorry)
45 // if check_objects is set, check with objects, else just with walls
46 // returns fate, fills in hit time.  If fate==HIT_NONE, hit_time undefined
47 // Stuff hit_info with fvi data as set by find_vector_intersection.
48 // for fvi_flags, refer to fvi.h for the fvi query flags
49 int physics_lookahead(object *obj, fix t, int fvi_flags, fix *hit_time, fvi_info *hit_info);
50
51 // Applies an instantaneous force on an object, resulting in an instantaneous
52 // change in velocity.
53 void phys_apply_force(object *obj, vms_vector *force_vec);
54 void phys_apply_rot(object *obj, vms_vector *force_vec);
55
56 // this routine will set the thrust for an object to a value that will
57 // (hopefully) maintain the object's current velocity
58 void set_thrust_from_velocity(object *obj);
59
60 #endif /* _PHYSICS_H */