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