1/*
2Copyright (C) 1996-1997 Id Software, Inc.
3
4This program is free software; you can redistribute it and/or
5modify it under the terms of the GNU General Public License
6as published by the Free Software Foundation; either version 2
7of the License, or (at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
13See the GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with this program; if not, write to the Free Software
17Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18
19*/
20
21typedef struct
22{
23	vec3_t	normal;
24	float	dist;
25} pmplane_t;
26
27typedef 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
40typedef 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
49typedef 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
74typedef 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
88extern	movevars_t		movevars;
89extern	playermove_t	pmove;
90extern	int		onground;
91extern	int		waterlevel;
92extern	int		watertype;
93
94void PlayerMove (void);
95void Pmove_Init (void);
96
97int PM_HullPointContents (hull_t *hull, int num, vec3_t p);
98
99int PM_PointContents (vec3_t point);
100qboolean PM_TestPlayerPosition (vec3_t point);
101pmtrace_t PM_PlayerMove (vec3_t start, vec3_t stop);
102