FTEQW
Documentation of the FTE engine source tree.
pmove.h
Go to the documentation of this file.
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
21#define BUTTON_ATTACK 1
22#define BUTTON_JUMP 2
23
24typedef enum {
25 PM_NORMAL, // normal ground movement
26 PM_OLD_SPECTATOR, // fly, no clip to world (QW bug)
27 PM_SPECTATOR, // fly, no clip to world
28 PM_DEAD, // no acceleration
29 PM_FLY, // fly, bump into walls
30 PM_NONE, // can't move
31 PM_FREEZE, // can't move or look around (TODO)
32 PM_WALLWALK, // sticks to walls. on ground while near one
33 PM_6DOF // spaceship mode
35
36#define PMF_JUMP_HELD 1
37#define PMF_LADDER 2 //pmove flags. seperate from flags
38
39#define MAX_PHYSENTS 2048
40typedef struct
41{
44 model_t *model; // only for bsp models
45 vec3_t mins, maxs; // only for non-bsp models
46 unsigned int info; // for client or server to identify
47 qbyte nonsolid; //contributes to contents, but does not block. FIXME: why not just use the contentsmask directly?
48 qbyte notouch; //don't trigger touch events. FIXME: why are these entities even in the list?
49 qbyte isportal; //special portal traversion required
50 unsigned int forcecontentsmask;
51// framestate_t framestate;
52#define PE_FRAMESTATE NULLFRAMESTATE //remove this once we start wanting players to interact with ents in different frames.
53} physent_t;
54
55typedef struct
56{
57 // player state
59 vec3_t safeorigin; //valid when safeorigin_known. needed for extrasr4's ladders otherwise they bug out.
65 int jump_msec; // msec since last jump
71
72 // world state
74 physent_t physents[MAX_PHYSENTS]; // 0 should be the world
75
76 // input
78
81
82 // results
85 int touchindex[MAX_PHYSENTS];
86 vec3_t touchvel[MAX_PHYSENTS];
88 int groundent; // index in physents array, only valid
89 // when onground is true
92
93 struct world_s *world;
95
96typedef struct {
97 //standard quakeworld
98 float gravity;
99 float stopspeed;
100 float maxspeed;
105 float friction;
109
110 //extended stuff, sent via serverinfo
113 float ktjump;
114 float edgefriction; //default 2
122 qboolean bunnyfriction; //force at least one frame of friction when bunnying.
124
125 qbyte coordtype; //FIXME: EZPEXT1_FLOATENTCOORDS should mean 4, but the result does not match ezquake/mvdsv's round-towards-origin which would result in inconsistencies. so player coords are rounded inconsistently.
126
127 unsigned int flags;
128} movevars_t;
129
130#define MOVEFLAG_VALID 0x80000000 //to signal that these are actually known. otherwise reserved.
131//#define MOVEFLAG_Q2AIRACCELERATE 0x00000001
132#define MOVEFLAG_NOGRAVITYONGROUND 0x00000002 //no slope sliding
133//#define MOVEFLAG_GRAVITYUNAFFECTEDBYTICRATE 0x00000004 //apply half-gravity both before AND after the move, which better matches the curve
134#define MOVEFLAG_QWEDGEBOX 0x00010000 //calculate edgefriction using tracebox and a buggy start pos
135#define MOVEFLAG_QWCOMPAT (MOVEFLAG_NOGRAVITYONGROUND|MOVEFLAG_QWEDGEBOX)
136
137extern movevars_t movevars;
138extern playermove_t pmove;
139
140void PM_PlayerMove (float gamespeed);
141void PM_Init (void);
142void PM_InitBoxHull (void);
143
144void PM_CategorizePosition (void);
146
147int PM_ExtraBoxContents (vec3_t p); //Peeks for HL-style water.
148int PM_PointContents (vec3_t point);
149qboolean PM_TestPlayerPosition (vec3_t point, qboolean ignoreportals);
150#ifndef __cplusplus
151struct trace_s PM_PlayerTrace (vec3_t start, vec3_t stop, unsigned int solidmask);
152#endif
153
qboolean
Definition: api_menu.h:34
vec_t vec3_t[3]
Definition: api_menu.h:40
int num
Definition: com_phys_ode.c:314
unsigned char qbyte
Definition: common.h:127
static CONST PIXELFORMATDESCRIPTOR *static int
Definition: gl_vidnt.c:222
static png_size_t start
Definition: image.c:1419
struct trace_s PM_PlayerTrace(vec3_t start, vec3_t stop, unsigned int solidmask)
Definition: pmovetst.c:454
void PM_InitBoxHull(void)
Definition: pmovetst.c:36
void PM_CategorizePosition(void)
Definition: pmove.c:884
qboolean PM_TestPlayerPosition(vec3_t point, qboolean ignoreportals)
Definition: pmovetst.c:364
void PM_PlayerMove(float gamespeed)
Definition: pmove.c:1420
movevars_t movevars
Definition: pmove.c:23
pmtype_t
Definition: pmove.h:24
@ PM_6DOF
Definition: pmove.h:33
@ PM_FREEZE
Definition: pmove.h:31
@ PM_WALLWALK
Definition: pmove.h:32
@ PM_FLY
Definition: pmove.h:29
@ PM_SPECTATOR
Definition: pmove.h:27
@ PM_OLD_SPECTATOR
Definition: pmove.h:26
@ PM_DEAD
Definition: pmove.h:28
@ PM_NORMAL
Definition: pmove.h:25
@ PM_NONE
Definition: pmove.h:30
void PM_Init(void)
Definition: pmove.c:35
int PM_ExtraBoxContents(vec3_t p)
Definition: pmovetst.c:166
int PM_PointContents(vec3_t point)
Definition: pmovetst.c:112
playermove_t pmove
Definition: pmove.c:24
int PM_HullPointContents(hull_t *hull, int num, vec3_t p)
int const void * p
Definition: pr_lua.c:232
evalc_t mins
Definition: pr_menu.c:1354
Definition: gl_model.h:587
Definition: gl_model.h:972
Definition: pmove.h:96
float spectatormaxspeed
Definition: pmove.h:101
int walljump
Definition: pmove.h:115
float accelerate
Definition: pmove.h:102
float watersinkspeed
Definition: pmove.h:112
qboolean slidyslopes
Definition: pmove.h:120
qboolean pground
Definition: pmove.h:118
float bunnyspeedcap
Definition: pmove.h:111
qboolean slidefix
Definition: pmove.h:116
qboolean airstep
Definition: pmove.h:117
qbyte coordtype
Definition: pmove.h:125
float flyfriction
Definition: pmove.h:107
qboolean bunnyfriction
Definition: pmove.h:122
float waterfriction
Definition: pmove.h:106
unsigned int flags
Definition: pmove.h:127
float wateraccelerate
Definition: pmove.h:104
qboolean stepdown
Definition: pmove.h:119
float friction
Definition: pmove.h:105
float entgravity
Definition: pmove.h:108
float edgefriction
Definition: pmove.h:114
qboolean autobunny
Definition: pmove.h:121
float stopspeed
Definition: pmove.h:99
int stepheight
Definition: pmove.h:123
float airaccelerate
Definition: pmove.h:103
float ktjump
Definition: pmove.h:113
float gravity
Definition: pmove.h:98
float maxspeed
Definition: pmove.h:100
Definition: pmove.h:41
vec3_t angles
Definition: pmove.h:43
vec3_t maxs
Definition: pmove.h:45
model_t * model
Definition: pmove.h:44
vec3_t origin
Definition: pmove.h:42
qbyte nonsolid
Definition: pmove.h:47
unsigned int forcecontentsmask
Definition: pmove.h:50
qbyte isportal
Definition: pmove.h:49
qbyte notouch
Definition: pmove.h:48
unsigned int info
Definition: pmove.h:46
Definition: pmove.h:56
int watertype
Definition: pmove.h:91
qboolean onground
Definition: pmove.h:87
float waterjumptime
Definition: pmove.h:66
int pm_type
Definition: pmove.h:67
vec3_t player_mins
Definition: pmove.h:68
int skipent
Definition: pmove.h:83
vec3_t origin
Definition: pmove.h:58
vec3_t player_maxs
Definition: pmove.h:69
usercmd_t cmd
Definition: pmove.h:77
vec3_t velocity
Definition: pmove.h:61
vec3_t safeorigin
Definition: pmove.h:59
int groundent
Definition: pmove.h:88
vec3_t basevelocity
Definition: pmove.h:62
vec3_t gravitydir
Definition: pmove.h:63
int jump_msec
Definition: pmove.h:65
qboolean safeorigin_known
Definition: pmove.h:80
qboolean capsule
Definition: pmove.h:70
vec3_t angles
Definition: pmove.h:60
qboolean jump_held
Definition: pmove.h:64
int numtouch
Definition: pmove.h:84
int numphysent
Definition: pmove.h:73
int waterlevel
Definition: pmove.h:90
qboolean onladder
Definition: pmove.h:79
struct world_s * world
Definition: pmove.h:93
Definition: world.h:61
Definition: protocol.h:1285
Definition: world.h:207