pmove.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /*
  2. Copyright (C) 1996-1997 Id Software, Inc.
  3. This program is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU General Public License
  5. as published by the Free Software Foundation; either version 2
  6. of the License, or (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. See the GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software
  13. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  14. */
  15. typedef struct
  16. {
  17. vec3_t normal;
  18. float dist;
  19. } pmplane_t;
  20. typedef struct
  21. {
  22. qboolean allsolid; // if true, plane is not valid
  23. qboolean startsolid; // if true, the initial point was in a solid area
  24. qboolean inopen, inwater;
  25. float fraction; // time completed, 1.0 = didn't hit anything
  26. vec3_t endpos; // final position
  27. pmplane_t plane; // surface normal at impact
  28. int ent; // entity the surface is on
  29. } pmtrace_t;
  30. #define MAX_PHYSENTS 32
  31. typedef struct
  32. {
  33. vec3_t origin;
  34. model_t *model; // only for bsp models
  35. vec3_t mins, maxs; // only for non-bsp models
  36. int info; // for client or server to identify
  37. } physent_t;
  38. typedef struct
  39. {
  40. int sequence; // just for debugging prints
  41. // player state
  42. vec3_t origin;
  43. vec3_t angles;
  44. vec3_t velocity;
  45. int oldbuttons;
  46. float waterjumptime;
  47. qboolean dead;
  48. int spectator;
  49. // world state
  50. int numphysent;
  51. physent_t physents[MAX_PHYSENTS]; // 0 should be the world
  52. // input
  53. usercmd_t cmd;
  54. // results
  55. int numtouch;
  56. int touchindex[MAX_PHYSENTS];
  57. } playermove_t;
  58. typedef struct {
  59. float gravity;
  60. float stopspeed;
  61. float maxspeed;
  62. float spectatormaxspeed;
  63. float accelerate;
  64. float airaccelerate;
  65. float wateraccelerate;
  66. float friction;
  67. float waterfriction;
  68. float entgravity;
  69. } movevars_t;
  70. extern movevars_t movevars;
  71. extern playermove_t pmove;
  72. extern int onground;
  73. extern int waterlevel;
  74. extern int watertype;
  75. void PlayerMove (void);
  76. void Pmove_Init (void);
  77. int PM_HullPointContents (hull_t *hull, int num, vec3_t p);
  78. int PM_PointContents (vec3_t point);
  79. qboolean PM_TestPlayerPosition (vec3_t point);
  80. pmtrace_t PM_PlayerMove (vec3_t start, vec3_t stop);