From 93b69d92b416efc79766c17d0d28dd282b772880 Mon Sep 17 00:00:00 2001 From: LegendaryGuard Date: Sun, 4 Feb 2024 01:31:33 +0100 Subject: [PATCH] cgame: Add more tweaks for antigrav rock particles when there's a mover (temporary solution), even for dash smoke particles and clean up some unused code in aura status --- source/cgame/cg_particles.c | 18 ++++++++++-------- source/cgame/cg_players.c | 19 +++++++++++-------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/source/cgame/cg_particles.c b/source/cgame/cg_particles.c index 13f732e..9676abd 100644 --- a/source/cgame/cg_particles.c +++ b/source/cgame/cg_particles.c @@ -436,11 +436,11 @@ void CG_AddParticleToScene (cparticle_t *p, vec3_t org, float alpha) { // BFP - To detect if there is something solid trace_t trace; - CG_Trace( &trace, p->org, vec3_origin, vec3_origin, org, -1, CONTENTS_SOLID ); + CG_Trace( &trace, p->org, vec3_origin, vec3_origin, org, -1, MASK_PLAYERSOLID ); // BFP - Make each particle fall when they aren't on ki charging status if ( !( cg.snap->ps.pm_flags & PMF_KI_CHARGE ) && !p->link ) { - p->endtime = timenonscaled + 2000; + p->endtime = timenonscaled + 1650; p->link = qtrue; } @@ -454,13 +454,15 @@ void CG_AddParticleToScene (cparticle_t *p, vec3_t org, float alpha) p->vel[2] -= 30; p->accel[2] -= 200; } - else + else // bouncing { - // bouncing - p->roll--; - p->vel[2] = (p->roll > 0) ? 100 * p->roll : 1; - if (p->roll <= 0) { // stop moving - p->vel[2] = p->accel[2] = 0; + // BFP - TODO: Temporary solution... Make bouncing more interactive when there's a mover moving + if ( trace.fraction <= 0 // if the particle is touching a mover and moves down, so keep bouncing + && cg.snap->ps.groundEntityNum != ENTITYNUM_NONE ) { + p->roll = 10; + } else { + p->vel[2] = p->accel[2] = (p->roll > 0) ? 50 * p->roll : 0; + p->roll--; // that decreases bounces } } } diff --git a/source/cgame/cg_players.c b/source/cgame/cg_players.c index fe3de9f..d3a1045 100644 --- a/source/cgame/cg_players.c +++ b/source/cgame/cg_players.c @@ -1896,8 +1896,10 @@ static qboolean CG_PlayerShadow( centity_t *cent, float *shadowPlane ) { || ( cent->currentState.legsAnim & ~ANIM_TOGGLEBIT ) == LEGS_BACK || ( cent->currentState.legsAnim & ~ANIM_TOGGLEBIT ) == LEGS_FLYA || ( cent->currentState.legsAnim & ~ANIM_TOGGLEBIT ) == LEGS_FLYB ) ) { - if ( !( contents & ( CONTENTS_WATER | CONTENTS_SLIME | CONTENTS_LAVA ) ) - && trace.fraction <= 0.70f ) { + if ( ( !( contents & ( CONTENTS_WATER | CONTENTS_SLIME | CONTENTS_LAVA ) ) + && trace.fraction <= 0.70f ) + // If the player is stepping a mover: + || cg.snap->ps.groundEntityNum != ENTITYNUM_NONE ) { CG_HasteTrail( cent, trace.endpos ); } else if ( waterTrace.fraction >= 0.10f && waterTrace.fraction <= 0.70f ) { CG_ParticleBubble( cent, cgs.media.waterBubbleShader, waterTrace.endpos, end, 1, 0, 0 ); @@ -1905,8 +1907,10 @@ static qboolean CG_PlayerShadow( centity_t *cent, float *shadowPlane ) { CG_ParticleBubble( cent, cgs.media.waterBubbleShader, waterTrace.endpos, end, 1, 0, 0 ); } } else if ( ( cg.snap->ps.pm_flags & PMF_KI_CHARGE ) // BFP - Antigrav rock particles on ki charging status - && !( contents & ( CONTENTS_WATER | CONTENTS_SLIME | CONTENTS_LAVA ) ) - && trace.fraction <= 0.50f ) { + && ( ( !( contents & ( CONTENTS_WATER | CONTENTS_SLIME | CONTENTS_LAVA ) ) + && trace.fraction <= 0.50f ) + // If the player is stepping a mover: + || cg.snap->ps.groundEntityNum != ENTITYNUM_NONE ) ) { // BFP - Spawn randomly the antigrav rock shaders with the particles int shaderIndex = rand() % 3; switch ( shaderIndex ) { @@ -2360,12 +2364,11 @@ void CG_Player( centity_t *cent ) { if ( cent->currentState.eFlags & EF_AURA ) { // BFP - TODO: Create a new function "CG_KiTrail" only when moving to draw ki trail and add the cvar for the length - // BFP - Traces for bubble particles only when moving in the water and charging - int sourceContentType, destContentType; + // BFP - Trace for bubble particles only when moving in the water and charging + int destContentType; vec3_t start; - sourceContentType = trap_CM_PointContents( start, 0 ); - destContentType = trap_CM_PointContents( cent->lerpOrigin, 0 ); + destContentType = CG_PointContents( cent->lerpOrigin, -1 ); // spawning bubble particles if ( destContentType & CONTENTS_WATER ) {