@@ -373,13 +373,13 @@ static void PM_Friction( void ) {
373373
374374 // apply water friction even if just wading
375375 if ( pm -> waterlevel
376- && !( pm -> ps -> eFlags & EF_FLIGHT ) ) { // BFP - Don't apply on flight
376+ && !( pm -> ps -> eFlags & EF_FLIGHT ) && !( pm -> cmd . buttons & BUTTON_ENABLEFLIGHT ) ) { // BFP - Don't apply on flight
377377 drop += speed * pm_waterfriction * pm -> waterlevel * pml .frametime ;
378378 }
379379
380380 // apply flying friction
381381 // BFP - Flight
382- if ( pm -> ps -> eFlags & EF_FLIGHT ) {
382+ if ( ( pm -> ps -> eFlags & EF_FLIGHT ) || ( pm -> cmd . buttons & BUTTON_ENABLEFLIGHT ) ) {
383383 control = speed < pm_stopspeed ? pm_stopspeed : speed ;
384384 drop += control * pm_flightfriction * pml .frametime ;
385385 }
@@ -1138,14 +1138,9 @@ static void PM_AirMove( void ) {
11381138
11391139 PM_StepSlideMove ( qtrue );
11401140
1141- // BFP - TODO: Avoid being pressed. Some lurker may have problems issues doing that on gameplay, I suggest not to do it
1142- if ( ( !( pm -> ps -> eFlags & EF_FLIGHT ) && ( pm -> cmd .buttons & BUTTON_ENABLEFLIGHT ) ) // handle the flight button if it's being pressed, that avoids jittering
1143- && !( pml .groundTrace .contents & MASK_PLAYERSOLID ) ) {
1144- return ;
1145- }
1146-
11471141 // BFP - Handle gravity, make the player heavier
1148- if ( !( pm -> ps -> pm_flags & PMF_STOP_AIR_FLY ) ) {
1142+ if ( !( pm -> ps -> pm_flags & PMF_STOP_AIR_FLY )
1143+ && !( pm -> ps -> pm_flags & PMF_RESPAWNED ) ) {
11491144 PM_SlideMove ( qtrue );
11501145 return ;
11511146 }
@@ -1597,7 +1592,7 @@ PM_ControlJumpOnGround
15971592static void PM_ControlJumpOnGround ( void ) { // BFP - A control to handle user movement intentions when jumping off the ground
15981593 if ( pm -> ps -> weaponstate != WEAPON_STUN
15991594 && pm -> ps -> groundEntityNum != ENTITYNUM_NONE
1600- && !( pm -> ps -> eFlags & EF_FLIGHT )
1595+ && !( pm -> ps -> eFlags & EF_FLIGHT ) && !( pm -> cmd . buttons & BUTTON_ENABLEFLIGHT )
16011596 && ( pm -> cmd .upmove > 0 || ( pm -> ps -> pm_flags & PMF_JUMP_HELD ) )
16021597 && ( pm -> cmd .forwardmove > 0 || pm -> cmd .forwardmove < 0
16031598 || pm -> cmd .rightmove > 0 || pm -> cmd .rightmove < 0 ) ) {
@@ -1720,7 +1715,7 @@ static void PM_GroundTrace( void ) {
17201715 }
17211716
17221717 // BFP - Make sure to handle the PMF flags when the player isn't flying
1723- if ( !( pm -> ps -> eFlags & EF_FLIGHT ) ) {
1718+ if ( !( pm -> ps -> eFlags & EF_FLIGHT ) && !( pm -> cmd . buttons & BUTTON_ENABLEFLIGHT ) ) {
17241719 pm -> ps -> pm_flags |= PMF_FALLING ;
17251720 pm -> ps -> pm_flags &= ~PMF_NEARGROUND ;
17261721 }
@@ -1737,7 +1732,7 @@ static void PM_GroundTrace( void ) {
17371732 pml .walking = qfalse ;
17381733
17391734 // BFP - If flying, prevent from doing a jumping action on slopes
1740- if ( pm -> ps -> eFlags & EF_FLIGHT ) {
1735+ if ( ( pm -> ps -> eFlags & EF_FLIGHT ) || ( pm -> cmd . buttons & BUTTON_ENABLEFLIGHT ) ) {
17411736 return ;
17421737 }
17431738
@@ -1770,7 +1765,7 @@ static void PM_GroundTrace( void ) {
17701765
17711766 // BFP - NOTE: Originally, BFP doesn't stop "groundtracing" until here when the player is flying
17721767 // BFP - If flying, prevent from doing a jumping action on flat ground
1773- if ( pm -> ps -> eFlags & EF_FLIGHT ) {
1768+ if ( ( pm -> ps -> eFlags & EF_FLIGHT ) || ( pm -> cmd . buttons & BUTTON_ENABLEFLIGHT ) ) {
17741769 // BFP - To stick to the movers if the player is near to them
17751770 pm -> ps -> groundEntityNum = trace .entityNum ;
17761771 PM_AddTouchEnt ( trace .entityNum );
@@ -1795,7 +1790,7 @@ static void PM_GroundTrace( void ) {
17951790
17961791 // BFP - Handle when the player isn't flying
17971792 if ( pm -> ps -> groundEntityNum == ENTITYNUM_NONE
1798- && !( pm -> ps -> eFlags & EF_FLIGHT ) ) {
1793+ && !( pm -> ps -> eFlags & EF_FLIGHT ) && !( pm -> cmd . buttons & BUTTON_ENABLEFLIGHT ) ) {
17991794 // just hit the ground
18001795 if ( pm -> debugLevel ) {
18011796 Com_Printf ("%i:Land\n" , c_pmove );
@@ -2137,7 +2132,7 @@ static void PM_WaterEvents( void ) { // FIXME?
21372132 //
21382133 if (!pml .previous_waterlevel && pm -> waterlevel ) {
21392134 if ( !( cont & MASK_WATER )
2140- && !( pm -> ps -> eFlags & EF_FLIGHT )
2135+ && !( pm -> ps -> eFlags & EF_FLIGHT ) && !( pm -> cmd . buttons & BUTTON_ENABLEFLIGHT )
21412136 && pm -> cmd .upmove > 0 ) {
21422137 PM_AddEvent ( EV_FOOTSPLASH ); // BFP - Play a different and smooth sound
21432138 return ;
@@ -2151,13 +2146,13 @@ static void PM_WaterEvents( void ) { // FIXME?
21512146 //
21522147 if (pml .previous_waterlevel && !pm -> waterlevel ) {
21532148 if ( !( cont & MASK_WATER )
2154- && !( pm -> ps -> eFlags & EF_FLIGHT )
2149+ && !( pm -> ps -> eFlags & EF_FLIGHT ) && !( pm -> cmd . buttons & BUTTON_ENABLEFLIGHT )
21552150 && pm -> cmd .upmove > 0 ) {
21562151 PM_AddEvent ( EV_FOOTSPLASH ); // BFP - Play a different and smooth sound
21572152 } else {
21582153 PM_AddEvent ( EV_WATER_LEAVE );
21592154 }
2160- if ( !( pm -> ps -> eFlags & EF_FLIGHT )
2155+ if ( !( pm -> ps -> eFlags & EF_FLIGHT ) && !( pm -> cmd . buttons & BUTTON_ENABLEFLIGHT )
21612156 && !( pm -> cmd .buttons & BUTTON_KI_CHARGE )
21622157 && !( pm -> ps -> pm_flags & PMF_KI_CHARGE )
21632158 && !( pm -> ps -> pm_flags & PMF_MELEE )
@@ -2262,7 +2257,7 @@ static void PM_TorsoAnimation( void ) {
22622257
22632258 if ( ( cont & MASK_WATER )
22642259 && pm -> waterlevel <= 2
2265- && !( pm -> ps -> eFlags & EF_FLIGHT )
2260+ && !( pm -> ps -> eFlags & EF_FLIGHT ) && !( pm -> cmd . buttons & BUTTON_ENABLEFLIGHT )
22662261 && pm -> cmd .upmove > 0 ) {
22672262 pm -> ps -> velocity [2 ] = 200 ;
22682263 // Control the player depending their moves
@@ -2325,7 +2320,7 @@ static void PM_TorsoAnimation( void ) {
23252320
23262321 // BFP - Falling distantly from the ground
23272322 if ( trace .fraction == 1.0 && !( pm -> ps -> pm_flags & PMF_NEARGROUND )
2328- && !( pm -> ps -> eFlags & EF_FLIGHT ) ) {
2323+ && !( pm -> ps -> eFlags & EF_FLIGHT ) && !( pm -> cmd . buttons & BUTTON_ENABLEFLIGHT ) ) {
23292324 pm -> ps -> pm_flags |= PMF_NEARGROUND ;
23302325 PM_ForceJumpAnim ();
23312326 PM_TorsoStatusAnim ( TORSO_STAND );
@@ -2339,7 +2334,7 @@ static void PM_TorsoAnimation( void ) {
23392334 // Handle the player movement animation when stopping to fly and falling near to the ground
23402335 // that happens when PMF_FALLING flag isn't handled correctly
23412336 if ( ( pml .groundTrace .contents & MASK_PLAYERSOLID )
2342- && !( pm -> ps -> eFlags & EF_FLIGHT )
2337+ && !( pm -> ps -> eFlags & EF_FLIGHT ) && !( pm -> cmd . buttons & BUTTON_ENABLEFLIGHT )
23432338 && !( pm -> ps -> pm_flags & PMF_FALLING )
23442339 && ( pm -> ps -> pm_flags & PMF_NEARGROUND ) ) {
23452340 pm -> ps -> pm_flags |= PMF_FALLING ;
@@ -2348,7 +2343,7 @@ static void PM_TorsoAnimation( void ) {
23482343
23492344 // BFP - That happens when the player is landing nearly
23502345 if ( !( pm -> ps -> pm_flags & PMF_NEARGROUND )
2351- && !( pm -> ps -> eFlags & EF_FLIGHT )
2346+ && !( pm -> ps -> eFlags & EF_FLIGHT ) && !( pm -> cmd . buttons & BUTTON_ENABLEFLIGHT )
23522347 && pm -> ps -> groundEntityNum == ENTITYNUM_NONE // hasn't touched the ground yet
23532348 && ( pml .groundTrace .contents & MASK_PLAYERSOLID ) ) {
23542349 PM_SlopesNeargroundAnim ( 0 );
@@ -2390,15 +2385,9 @@ static void PM_FlightStart( void ) { // BFP - Start flight handling
23902385 pm -> trace ( & trace , pm -> ps -> origin , pm -> mins , pm -> maxs , point , pm -> ps -> clientNum , pm -> tracemask );
23912386 pml .groundTrace = trace ;
23922387
2393- // BFP - Avoid when the flight key is being pressed all time
2394- if ( !( pm -> ps -> eFlags & EF_FLIGHT )
2395- && ( pml .groundTrace .contents & MASK_PLAYERSOLID )
2396- && ( pm -> ps -> pm_flags & PMF_FLIGHT_ACTIVE ) ) {
2397- if ( pm -> cmd .buttons & BUTTON_ENABLEFLIGHT ) {
2398- return ;
2399- } else {
2400- pm -> ps -> pm_flags &= ~PMF_FLIGHT_ACTIVE ;
2401- }
2388+ // BFP - Avoid when the flight key is being pressed all time, they want to do it, their flight is still enabled
2389+ if ( !( pm -> ps -> eFlags & EF_FLIGHT ) ) {
2390+ pm -> ps -> pm_flags &= ~PMF_FLIGHT_ACTIVE ;
24022391 }
24032392
24042393 // BFP - If the player is in the ground, then jump!
@@ -2448,7 +2437,8 @@ static void PM_FlightAnimation( void ) { // BFP - Flight
24482437 return ;
24492438 }
24502439
2451- if ( ( pm -> ps -> eFlags & EF_FLIGHT ) && pm -> ps -> pm_time <= 0 ) {
2440+ if ( ( ( pm -> ps -> eFlags & EF_FLIGHT ) || ( pm -> cmd .buttons & BUTTON_ENABLEFLIGHT ) )
2441+ && pm -> ps -> pm_time <= 0 ) {
24522442
24532443 // make sure to handle the PMF flags
24542444 pm -> ps -> pm_flags &= ~PMF_FALLING ;
@@ -2462,7 +2452,7 @@ static void PM_FlightAnimation( void ) { // BFP - Flight
24622452 // Handle the player movement animation if trying to change quickly the direction of forward or backward
24632453 if ( !( pml .groundTrace .contents & MASK_PLAYERSOLID )
24642454 && !( pm -> ps -> pm_flags & PMF_FALLING )
2465- && !( pm -> ps -> eFlags & EF_FLIGHT ) ) {
2455+ && !( pm -> ps -> eFlags & EF_FLIGHT ) && !( pm -> cmd . buttons & BUTTON_ENABLEFLIGHT ) ) {
24662456
24672457 // stops entering again here and don't change the animation to backwards/forward
24682458 pm -> ps -> pm_flags |= PMF_FALLING ;
@@ -2495,7 +2485,7 @@ static void PM_KiChargeAnimation( void ) { // BFP - Ki Charge
24952485 pm -> ps -> pm_time = 0 ;
24962486 // do jump animation if it's falling
24972487 if ( !( pml .groundTrace .contents & MASK_PLAYERSOLID )
2498- && !( pm -> ps -> eFlags & EF_FLIGHT )
2488+ && !( pm -> ps -> eFlags & EF_FLIGHT ) && !( pm -> cmd . buttons & BUTTON_ENABLEFLIGHT )
24992489 && ( pm -> ps -> pm_flags & PMF_FALLING )
25002490 && pm -> waterlevel <= 1 ) { // Don't force inside the water
25012491 pm -> ps -> pm_flags &= ~PMF_FALLING ; // Handle PMF_FALLING when falling
@@ -3133,17 +3123,19 @@ static qboolean PM_EnableFlight( void ) { // BFP - Flight
31333123 return qfalse ;
31343124 }
31353125
3136- if ( !( pm -> ps -> eFlags & EF_FLIGHT ) ) {
3126+ if ( !( pm -> ps -> eFlags & EF_FLIGHT ) && !( pm -> cmd . buttons & BUTTON_ENABLEFLIGHT ) ) {
31373127 return qfalse ;
31383128 }
31393129
31403130 // Handle the PMF flag if it's already flying
3141- if ( ( pm -> ps -> eFlags & EF_FLIGHT ) && !( pm -> ps -> pm_flags & PMF_FALLING ) ) {
3131+ if ( ( ( pm -> ps -> eFlags & EF_FLIGHT ) || ( pm -> cmd .buttons & BUTTON_ENABLEFLIGHT ) )
3132+ && !( pm -> ps -> pm_flags & PMF_FALLING ) ) {
31423133 return qtrue ;
31433134 }
31443135
31453136 // do not proceed to the jump event while enables the flight in the charging status
3146- if ( ( pm -> ps -> pm_flags & PMF_KI_CHARGE ) && ( pm -> ps -> eFlags & EF_FLIGHT ) ) {
3137+ if ( ( pm -> ps -> pm_flags & PMF_KI_CHARGE )
3138+ && ( ( pm -> ps -> eFlags & EF_FLIGHT ) || ( pm -> cmd .buttons & BUTTON_ENABLEFLIGHT ) ) ) {
31473139 pm -> ps -> groundEntityNum = ENTITYNUM_NONE ;
31483140 return qfalse ;
31493141 }
@@ -3178,7 +3170,7 @@ static void PM_KiCharge( void ) { // BFP - Ki Charge
31783170 }
31793171
31803172 // BFP - Smoothing horizontal and forward/backward fall while ki charging
3181- if ( !( pm -> ps -> eFlags & EF_FLIGHT ) ) {
3173+ if ( !( pm -> ps -> eFlags & EF_FLIGHT ) && !( pm -> cmd . buttons & BUTTON_ENABLEFLIGHT ) ) {
31823174 float speed = VectorLength ( pm -> ps -> velocity );
31833175 if ( speed > 0 ) {
31843176 float control = speed < pm_stopspeed ? pm_stopspeed : speed ;
@@ -3259,7 +3251,6 @@ void PmoveSingle (pmove_t *pmove) {
32593251 // BFP - TODO: Set to the first selected weapon
32603252 pm -> ps -> pm_flags &= ~PMF_STOP_AIR_FLY ; // BFP - Stop air gravity
32613253 pm -> ps -> pm_flags |= PMF_FALLING ;
3262- pm -> ps -> pm_flags |= PMF_FLIGHT_ACTIVE ; // BFP - Flight active status
32633254 }
32643255
32653256 // BFP - No flight
0 commit comments