Subversion Repositories Games.Descent

Rev

Blame | Last modification | View Log | Download | RSS feed

  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. #if defined(DXX_BUILD_DESCENT_I) || defined(DXX_BUILD_DESCENT_II)
  43. struct phys_visited_seglist
  44. {
  45.         unsigned nsegs;
  46.         std::array<segnum_t, MAX_FVI_SEGS> seglist;
  47. };
  48.  
  49. #ifdef dsx
  50. namespace dsx {
  51. window_event_result do_physics_sim(vmobjptridx_t obj, const vms_vector &obj_previous_position, phys_visited_seglist *phys_segs);
  52.  
  53. }
  54. #endif
  55. namespace dcx {
  56.  
  57. // Applies an instantaneous force on an object, resulting in an instantaneous
  58. // change in velocity.
  59. void phys_apply_force(object_base &obj, const vms_vector &force_vec);
  60.  
  61. }
  62. namespace dsx {
  63. void phys_apply_rot(object &obj, const vms_vector &force_vec);
  64. }
  65.  
  66. // this routine will set the thrust for an object to a value that will
  67. // (hopefully) maintain the object's current velocity
  68. namespace dcx {
  69. void set_thrust_from_velocity(object_base &obj);
  70. }
  71. void check_and_fix_matrix(vms_matrix &m);
  72. namespace dcx {
  73. void physics_turn_towards_vector(const vms_vector &goal_vector, object_base &obj, fix rate);
  74. }
  75. #endif
  76.  
  77. #endif
  78.  
  79. #endif /* _PHYSICS_H */
  80.