Skip to content

Commit

Permalink
cgame: Add more tweaks for antigrav rock particles when there's a mov…
Browse files Browse the repository at this point in the history
…er (temporary solution), even for dash smoke particles and clean up some unused code in aura status
  • Loading branch information
LegendaryGuard committed Feb 4, 2024
1 parent 4ccee2b commit 93b69d9
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 16 deletions.
18 changes: 10 additions & 8 deletions source/cgame/cg_particles.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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
}
}
}
Expand Down
19 changes: 11 additions & 8 deletions source/cgame/cg_players.c
Original file line number Diff line number Diff line change
Expand Up @@ -1896,17 +1896,21 @@ 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 );
CG_ParticleBubble( cent, cgs.media.waterBubbleShader, waterTrace.endpos, end, 1, 0, 0 );
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 ) {
Expand Down Expand Up @@ -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 ) {
Expand Down

0 comments on commit 93b69d9

Please sign in to comment.