Skip to content

Commit

Permalink
game: Make player, when flying, stick to the movers while being close…
Browse files Browse the repository at this point in the history
… to them
  • Loading branch information
LegendaryGuard committed Feb 10, 2024
1 parent 8e7cfe3 commit fdeb290
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions source/game/bg_pmove.c
Original file line number Diff line number Diff line change
Expand Up @@ -1246,6 +1246,9 @@ static void PM_GroundTrace( void ) {
// BFP - NOTE: Originally, BFP doesn't stop "groundtracing" until here when the player is flying
// BFP - If flying, prevent from doing a jumping action on flat ground
if ( pm->ps->pm_flags & PMF_FLYING ) {
// BFP - To stick to the movers if the player is near to them
pm->ps->groundEntityNum = trace.entityNum;
PM_AddTouchEnt( trace.entityNum );
return;
}

Expand Down Expand Up @@ -1427,6 +1430,11 @@ static void PM_Footsteps( void ) {
return;
}

// BFP - Hit stun
if ( pm->ps->pm_flags & PMF_FLYING ) {
return;
}

//
// calculate speed and cycle to be used for
// all cyclic walking effects
Expand Down Expand Up @@ -2145,17 +2153,27 @@ Enables/disables flight
*/
static qboolean PM_EnableFlight( void ) { // BFP - Flight

// BFP - Hit stun, avoid enabling flight if the player is in this status
if ( pm->ps->pm_flags & PMF_HITSTUN ) {
return qfalse;
}

if ( !( pm->ps->pm_flags & PMF_FLYING ) ) {
return qfalse;
}

// Handle the PMF flag if it's already flying
if ( ( pm->ps->pm_flags & PMF_FLYING ) && !( pm->ps->pm_flags & PMF_FALLING ) ) {
return qtrue;
}

// do not proceed to the jump event while enables the flight in the charging status
if ( ( pm->ps->pm_flags & PMF_KI_CHARGE ) && ( pm->ps->pm_flags & PMF_FLYING ) ) {
pm->ps->groundEntityNum = ENTITYNUM_NONE;
return qfalse;
}

if ( ( pm->ps->pm_flags & PMF_FLYING ) && !( pm->ps->pm_flags & PMF_HITSTUN ) ) {
if ( pm->ps->pm_flags & PMF_FLYING ) {
if ( ( pml.groundTrace.contents & MASK_PLAYERSOLID ) && pm->ps->groundEntityNum != ENTITYNUM_NONE ) {
// do a smooth jump animation like BFP does
if ( !( pm->cmd.buttons & BUTTON_KI_CHARGE ) ) {
Expand Down Expand Up @@ -2192,7 +2210,10 @@ static void PM_KiCharge( void ) { // BFP - Ki Charge
pm->cmd.buttons &= ~( BUTTON_ATTACK | BUTTON_KI_USE | BUTTON_MELEE | BUTTON_BLOCK | BUTTON_ENABLEFLIGHT );
}

pm->ps->pm_flags |= PMF_FALLING; // Handle PMF_FALLING flag
if ( !( pm->ps->pm_flags & PMF_FLYING ) ) {
pm->ps->pm_flags |= PMF_FALLING; // Handle PMF_FALLING flag
}

if ( ( pm->ps->pm_flags & PMF_KI_CHARGE ) && pm->ps->pm_time <= 0 ) {
pm->ps->stats[STAT_KI]++;
}
Expand Down

0 comments on commit fdeb290

Please sign in to comment.