Debian Codegraph @

common/main/physics.h

raw
1 /*
2 * Portions of this file are copyright Rebirth contributors and licensed as
3 * described in COPYING.txt.
4 * Portions of this file are copyright Parallax Software and licensed
5 * according to the Parallax license below.
6 * See COPYING.txt for license details.
7
8 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
9 SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
10 END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
11 ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
12 IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
13 SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
14 FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
15 CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
16 AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
17 COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
18 */
19
20 /*
21 *
22 * Headers for physics functions and data
23 *
24 */
25
26
27 #ifndef _PHYSICS_H
28 #define _PHYSICS_H
29
30 #include "vecmat.h"
31 #include "fvi.h"
32 #include "fwd-window.h"
33
34 #ifdef __cplusplus
35
36 //#define FL_NORMAL 0
37 //#define FL_TURBO 1
38 //#define FL_HOVER 2
39 //#define FL_REVERSE 3
40
41 // Simulate a physics object for this frame
42 #ifdef DXX_BUILD_DESCENT
43 struct phys_visited_seglist
44 {
45 unsigned nsegs;
46 std::array<segnum_t, MAX_FVI_SEGS> seglist;
47 };
48
49 namespace dcx {
50
51 // Applies an instantaneous force on an object, resulting in an instantaneous
52 // change in velocity.
53 void phys_apply_force(object_base &obj, const vms_vector &force_vec);
54
55 }
56 namespace dsx {
57 window_event_result do_physics_sim(const d_robot_info_array &Robot_info, vmobjptridx_t obj, const vms_vector &obj_previous_position, phys_visited_seglist *phys_segs);
58 void phys_apply_rot(object &obj, const vms_vector &force_vec);
59 }
60
61 // this routine will set the thrust for an object to a value that will
62 // (hopefully) maintain the object's current velocity
63 namespace dcx {
64 void set_thrust_from_velocity(object_base &obj);
65 void check_and_fix_matrix(vms_matrix &m);
66 void physics_turn_towards_vector(const vms_vector &goal_vector, object_base &obj, fix rate);
67 }
68 #endif
69
70 #endif
71
72 #endif /* _PHYSICS_H */