2004-08-21 01:25:48 +00:00
/*
Copyright ( C ) 1996 - 1997 Id Software , Inc .
This program is free software ; you can redistribute it and / or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation ; either version 2
of the License , or ( at your option ) any later version .
This program is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE .
See the GNU General Public License for more details .
You should have received a copy of the GNU General Public License
along with this program ; if not , write to the Free Software
Foundation , Inc . , 59 Temple Place - Suite 330 , Boston , MA 02111 - 1307 , USA .
*/
# define BUTTON_ATTACK 1
# define BUTTON_JUMP 2
typedef enum {
PM_NORMAL , // normal ground movement
PM_OLD_SPECTATOR , // fly, no clip to world (QW bug)
PM_SPECTATOR , // fly, no clip to world
PM_DEAD , // no acceleration
PM_FLY , // fly, bump into walls
PM_NONE , // can't move
2012-02-14 15:50:34 +00:00
PM_FREEZE , // can't move or look around (TODO)
2014-06-21 17:58:17 +00:00
PM_WALLWALK , // sticks to walls. on ground while near one
PM_6DOF // spaceship mode
2004-08-21 01:25:48 +00:00
} pmtype_t ;
2009-05-24 10:37:50 +00:00
# define PMF_JUMP_HELD 1
# define PMF_LADDER 2 //pmove flags. seperate from flags
2019-02-16 19:09:07 +00:00
# define MAX_PHYSENTS 2048
2004-08-21 01:25:48 +00:00
typedef struct
{
vec3_t origin ;
vec3_t angles ;
model_t * model ; // only for bsp models
vec3_t mins , maxs ; // only for non-bsp models
2014-01-13 02:42:25 +00:00
unsigned int info ; // for client or server to identify
qbyte nonsolid ; //contributes to contents, but does not block. FIXME: why not just use the contentsmask directly?
qbyte notouch ; //don't trigger touch events. FIXME: why are these entities even in the list?
qbyte isportal ; //special portal traversion required
2009-03-03 01:52:30 +00:00
unsigned int forcecontentsmask ;
2017-01-29 13:10:53 +00:00
// framestate_t framestate;
# define PE_FRAMESTATE NULLFRAMESTATE //remove this once we start wanting players to interact with ents in different frames.
2004-08-21 01:25:48 +00:00
} physent_t ;
typedef struct
{
// player state
vec3_t origin ;
2021-06-25 18:50:42 +00:00
vec3_t safeorigin ; //valid when safeorigin_known. needed for extrasr4's ladders otherwise they bug out.
2004-08-21 01:25:48 +00:00
vec3_t angles ;
vec3_t velocity ;
2009-03-03 01:52:30 +00:00
vec3_t basevelocity ;
2012-02-14 15:50:34 +00:00
vec3_t gravitydir ;
2004-08-21 01:25:48 +00:00
qboolean jump_held ;
int jump_msec ; // msec since last jump
float waterjumptime ;
int pm_type ;
2014-01-13 02:42:25 +00:00
vec3_t player_mins ;
vec3_t player_maxs ;
2014-09-17 03:04:08 +00:00
qboolean capsule ;
2004-08-21 01:25:48 +00:00
// world state
int numphysent ;
physent_t physents [ MAX_PHYSENTS ] ; // 0 should be the world
// input
usercmd_t cmd ;
qboolean onladder ;
2014-07-12 06:56:17 +00:00
qboolean safeorigin_known ;
2004-08-21 01:25:48 +00:00
// results
2012-02-12 05:18:31 +00:00
int skipent ;
2004-08-21 01:25:48 +00:00
int numtouch ;
int touchindex [ MAX_PHYSENTS ] ;
2012-01-17 07:57:46 +00:00
vec3_t touchvel [ MAX_PHYSENTS ] ;
2004-08-21 01:25:48 +00:00
qboolean onground ;
int groundent ; // index in physents array, only valid
// when onground is true
int waterlevel ;
int watertype ;
2014-01-13 02:42:25 +00:00
struct world_s * world ;
2004-08-21 01:25:48 +00:00
} playermove_t ;
typedef struct {
2017-08-16 02:14:07 +00:00
//standard quakeworld
2006-05-28 21:56:04 +00:00
float gravity ;
float stopspeed ;
float maxspeed ;
float spectatormaxspeed ;
float accelerate ;
float airaccelerate ;
float wateraccelerate ;
float friction ;
float waterfriction ;
2014-06-21 17:58:17 +00:00
float flyfriction ;
2006-05-28 21:56:04 +00:00
float entgravity ;
2017-08-16 02:14:07 +00:00
//extended stuff, sent via serverinfo
2006-05-28 21:56:04 +00:00
float bunnyspeedcap ;
2014-04-06 15:16:39 +00:00
float watersinkspeed ;
2006-05-28 21:56:04 +00:00
float ktjump ;
2018-12-11 00:20:59 +00:00
float edgefriction ; //default 2
2006-05-28 21:56:04 +00:00
int walljump ;
qboolean slidefix ;
qboolean airstep ;
2019-03-01 22:39:30 +00:00
qboolean pground ;
2018-01-22 19:18:04 +00:00
qboolean stepdown ;
2006-05-28 21:56:04 +00:00
qboolean slidyslopes ;
2021-05-09 13:00:30 +00:00
qboolean autobunny ;
2007-06-20 00:02:54 +00:00
int stepheight ;
2017-08-16 02:14:07 +00:00
2021-08-04 21:16:57 +00:00
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.
2018-04-27 16:40:50 +00:00
2017-08-16 02:14:07 +00:00
unsigned int flags ;
2004-08-21 01:25:48 +00:00
} movevars_t ;
2017-08-16 02:14:07 +00:00
# define MOVEFLAG_VALID 0x80000000 //to signal that these are actually known. otherwise reserved.
2019-04-01 10:16:36 +00:00
//#define MOVEFLAG_Q2AIRACCELERATE 0x00000001
2017-08-16 02:14:07 +00:00
# define MOVEFLAG_NOGRAVITYONGROUND 0x00000002 //no slope sliding
2019-04-01 10:16:36 +00:00
//#define MOVEFLAG_GRAVITYUNAFFECTEDBYTICRATE 0x00000004 //apply half-gravity both before AND after the move, which better matches the curve
2017-08-16 02:14:07 +00:00
# define MOVEFLAG_QWEDGEBOX 0x00010000 //calculate edgefriction using tracebox and a buggy start pos
2019-03-23 07:06:37 +00:00
# define MOVEFLAG_QWCOMPAT (MOVEFLAG_NOGRAVITYONGROUND|MOVEFLAG_QWEDGEBOX)
2004-08-21 01:25:48 +00:00
extern movevars_t movevars ;
extern playermove_t pmove ;
2005-03-20 02:57:11 +00:00
void PM_PlayerMove ( float gamespeed ) ;
2004-08-21 01:25:48 +00:00
void PM_Init ( void ) ;
void PM_InitBoxHull ( void ) ;
void PM_CategorizePosition ( void ) ;
int PM_HullPointContents ( hull_t * hull , int num , vec3_t p ) ;
2009-11-04 21:16:50 +00:00
int PM_ExtraBoxContents ( vec3_t p ) ; //Peeks for HL-style water.
2004-08-21 01:25:48 +00:00
int PM_PointContents ( vec3_t point ) ;
2014-07-02 03:20:40 +00:00
qboolean PM_TestPlayerPosition ( vec3_t point , qboolean ignoreportals ) ;
2004-08-21 01:25:48 +00:00
# ifndef __cplusplus
2013-10-29 17:38:22 +00:00
struct trace_s PM_PlayerTrace ( vec3_t start , vec3_t stop , unsigned int solidmask ) ;
2004-08-21 01:25:48 +00:00
# endif
2005-03-18 06:13:36 +00:00