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