Skip to content

Commit

Permalink
cgame: Apply and adjust correctly bubble and dash smoke particles to …
Browse files Browse the repository at this point in the history
…ki boost and ki charge status, events and projectile type weapons to be similar to BFP
  • Loading branch information
LegendaryGuard committed Jan 22, 2024
1 parent 7b3ada8 commit 0f84330
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 26 deletions.
10 changes: 5 additions & 5 deletions source/cgame/cg_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -590,11 +590,11 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) {
vec3_t end = {0, 0, 1};

// Blub, blub, blub...
CG_ParticleBubble( cent, cgs.media.waterBubbleShader, cent->lerpOrigin, end, 0, 20, 0 );
CG_ParticleBubble( cent, cgs.media.waterBubbleShader, cent->lerpOrigin, end, 0, 20, 0 );
CG_ParticleBubble( cent, cgs.media.waterBubbleShader, cent->lerpOrigin, end, 0, 20, 0 );
CG_ParticleBubble( cent, cgs.media.waterBubbleShader, cent->lerpOrigin, end, 0, 20, 0 );
CG_ParticleBubble( cent, cgs.media.waterBubbleShader, cent->lerpOrigin, end, 0, 20, 0 );
CG_ParticleBubble( cent, cgs.media.waterBubbleShader, cent->lerpOrigin, end, 1, 20, 0 );
CG_ParticleBubble( cent, cgs.media.waterBubbleShader, cent->lerpOrigin, end, 1, 20, 0 );
CG_ParticleBubble( cent, cgs.media.waterBubbleShader, cent->lerpOrigin, end, 1, 20, 0 );
CG_ParticleBubble( cent, cgs.media.waterBubbleShader, cent->lerpOrigin, end, 1, 20, 0 );
CG_ParticleBubble( cent, cgs.media.waterBubbleShader, cent->lerpOrigin, end, 1, 20, 0 );
}
break;
case EV_WATER_CLEAR:
Expand Down
37 changes: 20 additions & 17 deletions source/cgame/cg_players.c
Original file line number Diff line number Diff line change
Expand Up @@ -1540,15 +1540,13 @@ static void CG_HasteTrail( centity_t *cent, vec3_t endPos ) { // BFP - Second pa
}
#endif

cent->trailTime += 100;
cent->trailTime += 50; // BFP - Before: += 100
if ( cent->trailTime < cg.time ) {
cent->trailTime = cg.time;
}

// BFP - Apply dash smoke particle for the trail, if the function were used directly, it would generate too many particles than we expected
CG_ParticleDashSmoke( cent, cgs.media.hastePuffShader, endPos );
CG_ParticleDashSmoke( cent, cgs.media.hastePuffShader, endPos );
CG_ParticleDashSmoke( cent, cgs.media.hastePuffShader, endPos );

// BFP - No smoke puff effect
#if 0
Expand Down Expand Up @@ -1888,25 +1886,30 @@ static qboolean CG_PlayerShadow( centity_t *cent, float *shadowPlane ) {

trap_CM_BoxTrace( &trace, cent->lerpOrigin, end, mins, maxs, 0, MASK_PLAYERSOLID );

// no shadow if too high
if ( trace.fraction == 1.0 || trace.startsolid || trace.allsolid ) {
return qfalse;
}

*shadowPlane = trace.endpos[2] + 1;

// BFP - Dash smoke particles when using ki boost on the ground
// BFP - Dash smoke and bubble particles when using ki boost on the ground or above the water
contents = CG_PointContents( trace.endpos, -1 );
if ( ( cent->currentState.eFlags & EF_AURA )
&& !( contents & ( CONTENTS_WATER | CONTENTS_SLIME | CONTENTS_LAVA ) )
&& ( ( cent->currentState.legsAnim & ~ANIM_TOGGLEBIT ) == LEGS_RUN
|| ( cent->currentState.legsAnim & ~ANIM_TOGGLEBIT ) == LEGS_BACK
|| ( cent->currentState.legsAnim & ~ANIM_TOGGLEBIT ) == LEGS_FLYA
|| ( cent->currentState.legsAnim & ~ANIM_TOGGLEBIT ) == LEGS_FLYB )
|| ( cent->currentState.legsAnim & ~ANIM_TOGGLEBIT ) == LEGS_FLYB ) ) {
if ( !( contents & ( CONTENTS_WATER | CONTENTS_SLIME | CONTENTS_LAVA ) )
&& trace.fraction <= 0.70f ) {
CG_HasteTrail( cent, trace.endpos );
CG_HasteTrail( cent, trace.endpos );
} else if ( contents & CONTENTS_WATER ) {
CG_ParticleBubble( cent, cgs.media.waterBubbleShader, end, trace.endpos, 1, 20, 0 );
CG_ParticleBubble( cent, cgs.media.waterBubbleShader, end, trace.endpos, 1, 20, 0 );
CG_ParticleBubble( cent, cgs.media.waterBubbleShader, end, trace.endpos, 1, 20, 0 );
}
}

// no shadow if too high
if ( trace.fraction == 1.0 || trace.startsolid || trace.allsolid ) {
return qfalse;
}

*shadowPlane = trace.endpos[2] + 1;

if ( cg_shadows.integer != 1 ) { // no mark for stencil or projection shadows
return qtrue;
}
Expand Down Expand Up @@ -2354,9 +2357,9 @@ void CG_Player( centity_t *cent ) {

if ( ( cent->currentState.legsAnim & ~ANIM_TOGGLEBIT ) == LEGS_FLYA
|| ( cent->currentState.legsAnim & ~ANIM_TOGGLEBIT ) == LEGS_FLYB ) {
CG_ParticleBubble( cent, cgs.media.waterBubbleShader, bubbleOrigin, trace.endpos, 0, 20, 0 );
CG_ParticleBubble( cent, cgs.media.waterBubbleShader, bubbleOrigin, trace.endpos, 0, 20, 0 );
CG_ParticleBubble( cent, cgs.media.waterBubbleShader, bubbleOrigin, trace.endpos, 0, 20, 0 );
CG_ParticleBubble( cent, cgs.media.waterBubbleShader, bubbleOrigin, trace.endpos, 1, 20, 0 );
CG_ParticleBubble( cent, cgs.media.waterBubbleShader, bubbleOrigin, trace.endpos, 1, 20, 0 );
CG_ParticleBubble( cent, cgs.media.waterBubbleShader, bubbleOrigin, trace.endpos, 1, 20, 0 );
} else if ( ( cent->currentState.legsAnim & ~ANIM_TOGGLEBIT ) == LEGS_CHARGE ) {
bubbleOrigin[2] += -10; // put the origin a little below

Expand Down
9 changes: 5 additions & 4 deletions source/cgame/cg_weapons.c
Original file line number Diff line number Diff line change
Expand Up @@ -326,11 +326,12 @@ static void CG_RocketTrail( centity_t *ent, const weaponInfo_t *wi ) {
ent->trailTime = cg.time;

if ( contents & ( CONTENTS_WATER | CONTENTS_SLIME | CONTENTS_LAVA ) ) {
if ( contents & lastContents & CONTENTS_WATER ) {
if ( ( contents & lastContents & CONTENTS_WATER )
&& cg.frametime > 0.0f ) { // BFP - If paused, don't spawn bubble particles (cg_paused.integer < 1 is another solution, but not good enough for server responses)
// BFP - Apply particle bubble effect in that case
CG_ParticleBubble( ent, cgs.media.waterBubbleShader, origin, lastPos, 0, 20, 0 );
CG_ParticleBubble( ent, cgs.media.waterBubbleShader, origin, lastPos, 0, 20, 0 );
CG_ParticleBubble( ent, cgs.media.waterBubbleShader, origin, lastPos, 0, 20, 0 );
CG_ParticleBubble( ent, cgs.media.waterBubbleShader, origin, lastPos, 1, 20, 0 );
CG_ParticleBubble( ent, cgs.media.waterBubbleShader, origin, lastPos, 1, 20, 0 );
CG_ParticleBubble( ent, cgs.media.waterBubbleShader, origin, lastPos, 1, 20, 0 );
// CG_BubbleTrail( lastPos, origin, 8 );
}
return;
Expand Down

0 comments on commit 0f84330

Please sign in to comment.