Replace Q3TA player movement with Quake Live's pmove system, decompiled from qagamex64.so via Ghidra MCP. Struct changes: - playerState_t: +12 bytes (field_08c, field_094, field_09c, lastJumpTime, jumped, crouchSlideTimer, forwardmove/rightmove/upmove) - usercmd_t: +4 bytes (field_15, field_16 between weapon and forwardmove) - pmove_t: +16 bytes (field_0dc/0e0/0e4/0f8, removed framecount) - pml_t: +12 bytes (isJumppad, wallContact, isStepJump) - pm_flags: remapped to QL values (21 flags, several moved/new) New physics systems: - Dual VQ3/PQL physics (PMF_PROMODE) - Double jump, crouch slide, chain/ramp/step jump - Wall contact movement, grapple hook physics - 34 server-tunable pmove_* cvars with cgame prediction sync Network protocol updated for new struct fields and usercmd bytes. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
159 lines
4.6 KiB
C
159 lines
4.6 KiB
C
/*
|
|
===========================================================================
|
|
Copyright (C) 1999-2005 Id Software, Inc.
|
|
|
|
This file is part of Quake III Arena source code.
|
|
|
|
Quake III Arena source code 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.
|
|
|
|
Quake III Arena source code 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 Foobar; if not, write to the Free Software
|
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
===========================================================================
|
|
*/
|
|
//
|
|
// bg_local.h -- local definitions for the bg (both games) files
|
|
|
|
#define MIN_WALK_NORMAL 0.7f // can't walk on very steep slopes
|
|
|
|
#define STEPSIZE 18
|
|
|
|
#define JUMP_VELOCITY 270
|
|
|
|
#define TIMER_LAND 130
|
|
#define TIMER_GESTURE (34*66+50)
|
|
|
|
#define OVERCLIP 1.001f
|
|
|
|
// all of the locals will be zeroed before each
|
|
// pmove, just to make damn sure we don't have
|
|
// any differences when running on client or server
|
|
typedef struct {
|
|
vec3_t forward, right, up;
|
|
float frametime;
|
|
|
|
int msec;
|
|
|
|
qboolean walking;
|
|
qboolean groundPlane;
|
|
trace_t groundTrace;
|
|
|
|
// QL additions between groundTrace and impactSpeed
|
|
int isJumppad; // set during crouch step jump
|
|
int wallContact; // PM_CheckWallContact result
|
|
int isStepJump; // set during normal step jump
|
|
|
|
float impactSpeed;
|
|
|
|
vec3_t previous_origin;
|
|
vec3_t previous_velocity;
|
|
int previous_waterlevel;
|
|
} pml_t;
|
|
|
|
extern pmove_t *pm;
|
|
extern pml_t pml;
|
|
|
|
// movement parameters
|
|
extern float pm_stopspeed;
|
|
extern float pm_duckScale;
|
|
extern float pm_swimScale;
|
|
extern float pm_wadeScale;
|
|
|
|
extern float pm_accelerate;
|
|
extern float pm_airaccelerate;
|
|
extern float pm_wateraccelerate;
|
|
extern float pm_flyaccelerate;
|
|
|
|
extern float pm_friction;
|
|
extern float pm_waterfriction;
|
|
extern float pm_flightfriction;
|
|
extern float pm_spectatorfriction;
|
|
|
|
extern int c_pmove;
|
|
|
|
// QL cached cvar globals
|
|
extern float pm_jumpVelocity;
|
|
extern float pm_jumpVelocityMax;
|
|
extern float pm_jumpVelocityScaleAdd;
|
|
extern float pm_jumpVelocityTimeThreshold;
|
|
extern float pm_jumpVelocityTimeThresholdOffset;
|
|
extern float pm_jumpTimeDeltaMin;
|
|
extern int pm_chainJump;
|
|
extern float pm_chainJumpVelocity;
|
|
extern float pm_stepJumpVelocity;
|
|
extern float pm_rampJumpScale;
|
|
extern float pm_stepHeight;
|
|
extern float pm_walkAccel;
|
|
extern float pm_walkFriction;
|
|
extern float pm_strafeAccel;
|
|
extern float pm_circleStrafeFriction;
|
|
extern float pm_crouchSlideFriction;
|
|
extern int pm_crouchSlideTime;
|
|
extern float pm_waterSwimScale;
|
|
extern float pm_waterWadeScale;
|
|
extern int pm_weaponDropTime;
|
|
extern int pm_weaponRaiseTime;
|
|
extern float pm_wishSpeed;
|
|
extern int pm_airSteps;
|
|
extern float pm_airStepFriction;
|
|
extern float pm_airAccel;
|
|
extern float pm_airStopAccel;
|
|
extern float pm_airControl;
|
|
extern int pm_autoHopEnabled;
|
|
extern int pm_bunnyHop;
|
|
extern int pm_stepJumpEnabled;
|
|
extern int pm_crouchStepJump;
|
|
extern int pm_rampJumpEnabled;
|
|
extern int pm_noPlayerClip;
|
|
extern float pm_velocityGh;
|
|
|
|
// QL extern flags
|
|
extern int pmove_globalFlag;
|
|
extern int pmove_rampJumpFlag;
|
|
extern int pmove_stepJumpFlag;
|
|
extern float _DAT_003cfe90;
|
|
extern int DAT_003cfe30;
|
|
|
|
// pmove functions
|
|
void PM_ClipVelocity( vec3_t in, vec3_t normal, vec3_t out, float overbounce );
|
|
void PM_AddTouchEnt( int entityNum );
|
|
void PM_AddEvent( int newEvent );
|
|
|
|
qboolean PM_SlideMove( qboolean gravity );
|
|
void PM_StepSlideMove( qboolean gravity );
|
|
|
|
// QL new functions
|
|
void PM_SetupPhysicsOverrides( void );
|
|
void PM_CheckWallContact( void );
|
|
void PM_CheckDuck( void );
|
|
void PM_DropTimers( void );
|
|
void PM_SetWaterLevel( void );
|
|
void PM_SetMovementDir( void );
|
|
void PM_Friction( void );
|
|
void PM_Accelerate( float wishspeed, float accel, vec3_t wishdir );
|
|
void PM_CmdScale( usercmd_t *cmd, float *scale );
|
|
int PM_BuildWishVelocity( usercmd_t *cmd, float *wishspeed, vec3_t wishdir );
|
|
void PM_Jump( void );
|
|
int PM_CheckJump( int checkDoubleJump );
|
|
int PM_CheckGrapple( void );
|
|
void PM_GrappleMove( void );
|
|
void PM_WaterJumpMove( void );
|
|
void PM_WaterMove( void );
|
|
void PM_AirMove( void );
|
|
void PM_AirControl( void );
|
|
void PM_FlyMove( void );
|
|
void PM_GroundTrace( void );
|
|
void PM_CrashLand( void );
|
|
int PM_FootstepForSurface( void );
|
|
void PM_ContinueLegsAnim( int anim );
|
|
void PM_ForceLegsAnim( int anim );
|
|
int PM_CanJump( void );
|
|
int PM_CanEdgeGrab( void );
|