diff --git a/source/cgame/cg_event.c b/source/cgame/cg_event.c index 35826aa..3f71db2 100644 --- a/source/cgame/cg_event.c +++ b/source/cgame/cg_event.c @@ -593,11 +593,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, 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 ); + CG_ParticleBubble( cent, cgs.media.waterBubbleShader, cent->lerpOrigin, end, 700, 20, 0 ); + CG_ParticleBubble( cent, cgs.media.waterBubbleShader, cent->lerpOrigin, end, 700, 20, 0 ); + CG_ParticleBubble( cent, cgs.media.waterBubbleShader, cent->lerpOrigin, end, 700, 20, 0 ); + CG_ParticleBubble( cent, cgs.media.waterBubbleShader, cent->lerpOrigin, end, 700, 20, 0 ); + CG_ParticleBubble( cent, cgs.media.waterBubbleShader, cent->lerpOrigin, end, 700, 20, 0 ); } break; case EV_WATER_CLEAR: diff --git a/source/cgame/cg_local.h b/source/cgame/cg_local.h index da3e55e..a5accff 100644 --- a/source/cgame/cg_local.h +++ b/source/cgame/cg_local.h @@ -1493,7 +1493,7 @@ void CG_ParticleDust (centity_t *cent, vec3_t origin, vec3_t dir); void CG_ParticleMisc (qhandle_t pshader, vec3_t origin, int size, int duration, float alpha); void CG_ParticleExplosion (char *animStr, vec3_t origin, vec3_t vel, int duration, int sizeStart, int sizeEnd); // BFP - Bubble particle -void CG_ParticleBubble (centity_t *cent, qhandle_t pshader, vec3_t origin, vec3_t origin2, int turb, float range, int snum); +void CG_ParticleBubble (centity_t *cent, qhandle_t pshader, vec3_t origin, vec3_t origin2, int turbtime, float range, int snum); // BFP - Dash smoke particle for ki boost when moving in the ground void CG_ParticleDashSmoke (centity_t *cent, qhandle_t pshader, vec3_t origin); // BFP - Antigrav rock particles for charging diff --git a/source/cgame/cg_particles.c b/source/cgame/cg_particles.c index 9120be8..20e2b49 100644 --- a/source/cgame/cg_particles.c +++ b/source/cgame/cg_particles.c @@ -432,12 +432,6 @@ void CG_AddParticleToScene (cparticle_t *p, vec3_t org, float alpha) p->endtime = timenonscaled + 2500 + (crandom() * 150); p->link = qtrue; } - } else { - if ( !p->link ) - { - p->endtime = timenonscaled + 500 + (crandom() * 150); - p->link = qtrue; - } } } @@ -940,7 +934,7 @@ void CG_AddParticles (void) active_particles = active; } -void CG_ParticleBubble (centity_t *cent, qhandle_t pshader, vec3_t origin, vec3_t origin2, int turb, float range, int snum) +void CG_ParticleBubble (centity_t *cent, qhandle_t pshader, vec3_t origin, vec3_t origin2, int turbtime, float range, int snum) { cparticle_t *p; @@ -955,7 +949,7 @@ void CG_ParticleBubble (centity_t *cent, qhandle_t pshader, vec3_t origin, vec3_ p->time = timenonscaled; // BFP - Add end time to remove particles, if there's no end time the particles will remain there - p->endtime = timenonscaled + 400; + p->endtime = timenonscaled + 600; p->startfade = timenonscaled + 200; p->color = 0; @@ -965,13 +959,20 @@ void CG_ParticleBubble (centity_t *cent, qhandle_t pshader, vec3_t origin, vec3_ p->start = cent->currentState.origin[2]; p->end = cent->currentState.origin2[2]; p->pshader = pshader; - p->height = p->width = 2 + (crandom() * 0.5); + p->height = p->width = (rand() % 2) + 1; - if (turb) + VectorCopy(origin, p->org); + + if (turbtime) { p->type = P_BUBBLE_TURBULENT; // BFP - Apply end time to remove particles in that case, if there's no end time the particles will remain there - p->endtime = timenonscaled + 700; + p->endtime = timenonscaled + turbtime; + p->height = p->width = (rand() % 1) + 2; + + p->org[0] += (rand() % (int)range) + (crandom() * range); + p->org[1] += (rand() % (int)range) + (crandom() * range); + p->org[2] += (rand() % (int)20); VectorSet( p->vel, (rand() % 401) - 200, @@ -980,13 +981,18 @@ void CG_ParticleBubble (centity_t *cent, qhandle_t pshader, vec3_t origin, vec3_ // dispersion VectorSet( p->accel, - crandom() * 20, - crandom() * 20, + crandom() * 10, + crandom() * 10, 300 ); } else { p->type = P_BUBBLE; + + p->org[0] += (crandom() * range); + p->org[1] += (crandom() * range); + p->org[2] += (crandom() * 5); + VectorSet( p->vel, (rand() % 521) - 250, (rand() % 521) - 250, @@ -999,12 +1005,6 @@ void CG_ParticleBubble (centity_t *cent, qhandle_t pshader, vec3_t origin, vec3_ 900 ); } - VectorCopy(origin, p->org); - - p->org[0] += (crandom() * range); - p->org[1] += (crandom() * range); - p->org[2] += (crandom() * 5); - p->snum = 3 - (crandom() * 6); // used to randomize where the bubbles stop when these touches the surface p->link = qfalse; } @@ -1021,6 +1021,15 @@ void CG_BubblesWaterHandling( cparticle_t *p, vec3_t org ) { VectorCopy( org, start ); start[2] += 10; + // BFP - Make move less + if ( p->vel[0] > -0.9 && p->vel[0] < 0.9 ) p->vel[0] = 0; + if ( p->vel[1] > -0.9 && p->vel[1] < 0.9 ) p->vel[1] = 0; + if ( p->vel[0] != 0 ) p->vel[0] *= 0.99; + if ( p->vel[1] != 0 ) p->vel[1] *= 0.99; + + // Decelerate + if ( p->accel[2] > 0 ) p->accel[2]--; + // trace down to find the surface trap_CM_BoxTrace( &trace, start, end, vec3_origin, vec3_origin, 0, CONTENTS_WATER ); @@ -1047,8 +1056,10 @@ void CG_BubblesWaterHandling( cparticle_t *p, vec3_t org ) { VectorClear( p->accel ); // BFP - Make move less - p->vel[0] *= 0.9; - p->vel[1] *= 0.9; + if ( p->vel[0] >= -1 && p->vel[0] <= 0.9 ) p->vel[0] = 0; + else p->vel[0] *= 0.9; + if ( p->vel[1] >= -1 && p->vel[1] <= 0.9 ) p->vel[1] = 0; + else p->vel[1] *= 0.9; } } diff --git a/source/cgame/cg_players.c b/source/cgame/cg_players.c index 1070605..04ed4bc 100644 --- a/source/cgame/cg_players.c +++ b/source/cgame/cg_players.c @@ -1887,15 +1887,20 @@ static qboolean CG_PlayerShadow( centity_t *cent, float *shadowPlane ) { CG_ParticleDashSmoke( cent, cgs.media.particleSmokeShader, trace.endpos ); } + waterTrace.endpos[2] -= 20; // BFP - Put a bit down to make the bubbles move if ( waterTrace.fraction >= 0.10f && waterTrace.fraction <= 0.70f ) { - CG_ParticleBubble( cent, cgs.media.waterBubbleShader, waterTrace.endpos, end, 1, 10, 0 ); - CG_ParticleBubble( cent, cgs.media.waterBubbleShader, waterTrace.endpos, end, 1, 10, 0 ); - CG_ParticleBubble( cent, cgs.media.waterBubbleShader, waterTrace.endpos, end, 1, 10, 0 ); + CG_ParticleBubble( cent, cgs.media.waterBubbleShader, waterTrace.endpos, end, 700, 10, 0 ); + CG_ParticleBubble( cent, cgs.media.waterBubbleShader, waterTrace.endpos, end, 700, 10, 0 ); + CG_ParticleBubble( cent, cgs.media.waterBubbleShader, waterTrace.endpos, end, 700, 10, 0 ); } } if ( ( cent->currentState.legsAnim & ~ANIM_TOGGLEBIT ) == LEGS_CHARGE ) { // BFP - Antigrav rock particles on ki charging status if ( !( contents & ( CONTENTS_WATER | CONTENTS_SLIME | CONTENTS_LAVA ) ) + // if the player isn't moving + && !cent->currentState.pos.trDelta[0] + && !cent->currentState.pos.trDelta[1] + && !cent->currentState.pos.trDelta[2] && ( trace.fraction <= 0.30f // If the player is stepping a mover: || cent->currentState.groundEntityNum != ENTITYNUM_NONE ) ) { @@ -2392,9 +2397,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, 1, 10, 0 ); - CG_ParticleBubble( cent, cgs.media.waterBubbleShader, bubbleOrigin, trace.endpos, 1, 10, 0 ); - CG_ParticleBubble( cent, cgs.media.waterBubbleShader, bubbleOrigin, trace.endpos, 1, 10, 0 ); + CG_ParticleBubble( cent, cgs.media.waterBubbleShader, bubbleOrigin, trace.endpos, 700, 10, 0 ); + CG_ParticleBubble( cent, cgs.media.waterBubbleShader, bubbleOrigin, trace.endpos, 700, 10, 0 ); + CG_ParticleBubble( cent, cgs.media.waterBubbleShader, bubbleOrigin, trace.endpos, 700, 10, 0 ); } else if ( ( cent->currentState.legsAnim & ~ANIM_TOGGLEBIT ) == LEGS_CHARGE ) { bubbleOrigin[2] += -7; // put the origin a little below diff --git a/source/cgame/cg_weapons.c b/source/cgame/cg_weapons.c index 260389d..0f2e243 100644 --- a/source/cgame/cg_weapons.c +++ b/source/cgame/cg_weapons.c @@ -329,9 +329,9 @@ static void CG_RocketTrail( centity_t *ent, const weaponInfo_t *wi ) { 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, 1, 0, 0 ); - CG_ParticleBubble( ent, cgs.media.waterBubbleShader, origin, lastPos, 1, 0, 0 ); - CG_ParticleBubble( ent, cgs.media.waterBubbleShader, origin, lastPos, 1, 0, 0 ); + CG_ParticleBubble( ent, cgs.media.waterBubbleShader, origin, lastPos, 1200, 20, 0 ); + CG_ParticleBubble( ent, cgs.media.waterBubbleShader, origin, lastPos, 1200, 20, 0 ); + CG_ParticleBubble( ent, cgs.media.waterBubbleShader, origin, lastPos, 1200, 20, 0 ); // CG_BubbleTrail( lastPos, origin, 8 ); } return;