Permalink
Browse files

Initial sliding implementation. Crouch while jumping to slide

  • Loading branch information...
DolceTriade committed Dec 19, 2015
1 parent 8b18d9a commit cda0276835eb05cfe746b5fc8483a4b5f76852b7
Showing with 24 additions and 2 deletions.
  1. +2 −0 src/shared/bg_gameplay.h
  2. +18 −0 src/shared/bg_pmove.cpp
  3. +4 −2 src/shared/bg_public.h
@@ -292,6 +292,8 @@ extern int REACTOR_ATTACK_DAMAGE;
#define HUMAN_BACK_MODIFIER 0.8f
#define HUMAN_SIDE_MODIFIER 0.9f
#define HUMAN_LAND_FRICTION 3.0f
#define HUMAN_SLIDE_FRICTION_MODIFIER 0.05f
#define HUMAN_SLIDE_THRESHOLD 400.0f

#define STAMINA_MAX 30000
#define STAMINA_MEDISTAT_RESTORE 450 // 1/(100 ms). stacks.
@@ -282,6 +282,11 @@ static void PM_Friction()
float stopSpeed = BG_Class( pm->ps->stats[ STAT_CLASS ] )->stopSpeed;
float friction = BG_Class( pm->ps->stats[ STAT_CLASS ] )->friction;

if ( pm->ps->stats[ STAT_STATE ] & SS_SLIDING )
{
friction *= HUMAN_SLIDE_FRICTION_MODIFIER;
}

control = speed < stopSpeed ? stopSpeed : speed;
drop += control * friction * pml.frametime;
}
@@ -1967,6 +1972,19 @@ static void PM_WalkMove()
return;
}

// Slide
if ( pm->cmd.upmove < 0 && VectorLength(pm->ps->velocity) > HUMAN_SLIDE_THRESHOLD )
{
pm->ps->stats[ STAT_STATE ] |= SS_SLIDING;
PM_SlideMove( false );
PM_Friction();
return;
}
else
{
pm->ps->stats[ STAT_STATE ] &= ~SS_SLIDING;
}

// if PM_Land didn't stop the jetpack (e.g. to allow for a jump) but we didn't get away
// from the ground, stop it now
PM_LandJetpack( true );
@@ -249,6 +249,7 @@ typedef enum
#define SCA_ALIENSENSE 0x00000010
#define SCA_CANUSELADDERS 0x00000020
#define SCA_WALLJUMPER 0x00000040
#define SCA_SLIDING 0x00000100

// STAT_STATE fields. 16 bit available
#define SS_WALLCLIMBING BIT(0)
@@ -265,6 +266,7 @@ typedef enum
#define SS_HEALING_2X BIT(11) // humans: medistation
#define SS_HEALING_4X BIT(12) // humans: medikit active
#define SS_HEALING_8X BIT(13)
#define SS_SLIDING BIT(14)

// STAT_STATE2 fields. 16 bit available
#define SS2_JETPACK_ENABLED BIT(0) // whether jets/wings are extended
@@ -1058,7 +1060,7 @@ typedef enum
//implicit
BCT_HEALTH,
BCT_AMMO,

NUM_BEACON_TYPES
} beaconType_t;

@@ -1093,7 +1095,7 @@ typedef struct
qhandle_t icon[ 2 ][ 4 ];
sfxHandle_t inSound;
sfxHandle_t outSound;
#endif
#endif

int decayTime;
} beaconAttributes_t;

0 comments on commit cda0276

Please sign in to comment.