1 /*
2 	pmove.h
3 
4 	(description)
5 
6 	Copyright (C) 1996-1997  Id Software, Inc.
7 
8 	This program is free software; you can redistribute it and/or
9 	modify it under the terms of the GNU General Public License
10 	as published by the Free Software Foundation; either version 2
11 	of the License, or (at your option) any later version.
12 
13 	This program is distributed in the hope that it will be useful,
14 	but WITHOUT ANY WARRANTY; without even the implied warranty of
15 	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16 
17 	See the GNU General Public License for more details.
18 
19 	You should have received a copy of the GNU General Public License
20 	along with this program; if not, write to:
21 
22 		Free Software Foundation, Inc.
23 		59 Temple Place - Suite 330
24 		Boston, MA  02111-1307, USA
25 
26 */
27 
28 #ifndef _PMOVE_H
29 #define _PMOVE_H
30 
31 #include "qw/protocol.h"
32 #include "QF/mathlib.h"
33 #include "QF/model.h"
34 
35 #include "world.h"
36 
37 //FIXME location
38 #define STOP_EPSILON 0.1
39 
40 #define	MAX_PHYSENTS	(MAX_CLIENTS + MAX_PACKET_ENTITIES)
41 typedef struct {
42 	vec3_t	origin;
43 	vec3_t	angles;
44 	model_t	*model;		// only for bsp models
45 	vec3_t	mins, maxs;	// only for non-bsp models
46 	hull_t	*hull;		// hey, magic :)
47 	int		info;		// for client or server to identify
48 } physent_t;
49 
50 
51 typedef struct {
52 	int         sequence;	// just for debugging prints
53 
54 	// player state
55 	vec3_t      origin;
56 	vec3_t      angles;
57 	vec3_t      velocity;
58 	int         oldbuttons;
59 	int         oldonground;
60 	float       waterjumptime;
61 	qboolean    dead;
62 	qboolean    flying;
63 	qboolean    add_grav;
64 	int         spectator;
65 
66 	// world state
67 	int         numphysent;
68 	physent_t   physents[MAX_PHYSENTS];	// 0 should be the world
69 
70 	// input
71 	usercmd_t   cmd;
72 
73 	// results
74 	int         numtouch;
75 	physent_t  *touchindex[MAX_PHYSENTS];
76 } playermove_t;
77 
78 typedef struct {
79 	float	gravity;
80 	float	stopspeed;
81 	float	maxspeed;
82 	float	spectatormaxspeed;
83 	float	accelerate;
84 	float	airaccelerate;
85 	float	wateraccelerate;
86 	float	friction;
87 	float	waterfriction;
88 	float	entgravity;
89 } movevars_t;
90 
91 extern	struct cvar_s	*no_pogo_stick;
92 extern	movevars_t		movevars;
93 extern	playermove_t	pmove;
94 extern	int		onground;
95 extern	int		waterlevel;
96 extern	int		watertype;
97 
98 extern vec3_t	player_mins;
99 extern vec3_t	player_maxs;
100 
101 void PM_Accelerate (vec3_t wishdir, float wishspeed, float accel);
102 void PM_CategorizePosition (void);
103 void PM_InitBoxHull (void);
104 
105 void PlayerMove (void);
106 void Pmove_Init (void);
107 void Pmove_Init_Cvars (void);
108 
109 int PM_HullPointContents (hull_t *hull, int num, const vec3_t p);
110 
111 int PM_PointContents (const vec3_t point);
112 qboolean PM_TestPlayerPosition (const vec3_t point);
113 trace_t PM_PlayerMove (const vec3_t start, const vec3_t stop);
114 
115 #endif // _PMOVE_H
116