Skip to content

Commit 226bfac

Browse files
committed
Change gas grenade hallucination effects
* Fixed radius check to avoid sqrt * Changed max effect to 10 seconds from 22s * Minimum now 4s from 12s * Client effect sped up to accommodate for the server side changes. * Removed blinding flash effect for smoother transitions.
1 parent 264b9f9 commit 226bfac

2 files changed

Lines changed: 23 additions & 16 deletions

File tree

code/cgame/cg_view.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,8 @@ static void CG_Q3F_GasEffect( void )
401401
cg.gasTime = cg.gasEndTime;
402402
memcpy( cg.gasColour, cg.gasEndColour, sizeof(cg.gasColour) );
403403
}
404-
cg.gasEndTime = cg.time + 3450 + ETF_random() * 3450;
404+
// Speed up the effect cycle for the shorter 10s duration
405+
cg.gasEndTime = cg.time + 1500 + ETF_random() * 1500;
405406
if( (cg.time + 3450) >= gastime || cg.gasEndTime >= gastime )
406407
{
407408
// Effect is ending
@@ -420,7 +421,7 @@ static void CG_Q3F_GasEffect( void )
420421
cg.gasEndColour[0] = ETF_random();
421422
cg.gasEndColour[1] = ETF_random();
422423
cg.gasEndColour[2] = ETF_random();
423-
cg.gasEndColour[3] = 0.34 + ETF_random() * 0.3 * (((float)(gastime - cg.time)) / 20000);
424+
cg.gasEndColour[3] = 0.34 + ETF_random() * 0.3 * (((float)(gastime - cg.time)) / 10000);
424425
if( cg.gasEndColour[3] > 0.7f )
425426
cg.gasEndColour[3] = 0.7f;
426427

@@ -449,15 +450,15 @@ static void CG_Q3F_GasEffect( void )
449450
}
450451
}
451452
}
452-
cg.gasFlashTime = cg.time + 100; // Long enough to assure a 'solid' flash
453+
//cg.gasFlashTime = cg.time + 100; // Long enough to assure a 'solid' flash
453454
}
454455

455456
// Calculate a smooth transition from start to end
456457
curr = 0.5 - 0.5 * sin( M_PI * (((float)(cg.gasEndTime - cg.time)) / ((float)(cg.gasEndTime - cg.gasTime)) - 0.5) );
457458
for( index = 0; index < 4; index++ ) // Screen colour (used later in frame render)
458459
cg.gasCurrColour[index] = cg.gasColour[index] + curr * (cg.gasEndColour[index] - cg.gasColour[index]);
459-
if( cg.gasFlashTime > cg.time )
460-
cg.gasCurrColour[3] = 1; // "Flash" the screen to opaque this frame
460+
//if( cg.gasFlashTime > cg.time )
461+
// cg.gasCurrColour[3] = 1; // "Flash" the screen to opaque this frame
461462
}
462463

463464
// Golliwog: A pretty effect to handle 'vibration'.

code/game/g_q3f_grenades.c

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -681,16 +681,20 @@ void HallucinogenicBurnThink( gentity_t * gasgren )
681681
gasgren->nextthink = level.time + 300;
682682
}
683683

684+
#define GASGREN_LIFETIME 6000
685+
#define GREN_GAS_RADIUS_SQ (GREN_GAS_RADIUS*GREN_GAS_RADIUS)
686+
684687

685688
void HallucinogenicExplodeThink( gentity_t *ent )
686689
{
687690
// Let's gas
688691

689692
gentity_t *player;
690-
int distance, time;
693+
int time;
694+
float distanceSq;
691695
vec3_t distancevec;
692696

693-
if( (ent->s.time + 6000) < level.time )
697+
if( (ent->s.time + GASGREN_LIFETIME) < level.time )
694698
{
695699
G_FreeEntity( ent );
696700
return;
@@ -702,8 +706,8 @@ void HallucinogenicExplodeThink( gentity_t *ent )
702706
if( !(player->inuse && player->client && player->health > 0 && !Q3F_IsSpectator( player->client ) && !player->client->noclip) )
703707
continue;
704708
VectorSubtract( player->s.pos.trBase, ent->s.pos.trBase, distancevec );
705-
distance = VectorLength( distancevec );
706-
if ( distance >= GREN_GAS_RADIUS )
709+
distanceSq = VectorLengthSquared( distancevec );
710+
if ( distanceSq >= GREN_GAS_RADIUS_SQ )
707711
continue;
708712

709713
if( player == ent->activator || level.friendlyFire == FF_Q3F_FULL || level.friendlyFire == FF_Q3F_HALF || !G_Q3F_IsAllied( ent->activator, player ) )
@@ -723,13 +727,15 @@ void HallucinogenicExplodeThink( gentity_t *ent )
723727
// Gas them
724728

725729
time = player->client->ps.powerups[PW_Q3F_GAS] - level.time;
726-
if( player->client->ps.persistant[PERS_CURRCLASS] == Q3F_CLASS_PARAMEDIC )
727-
time /= 0.66;
728-
time += 5000;
729-
if( time < 12000 )
730-
time = 12000;
731-
if( time > 22000 )
732-
time = 22000;
730+
if (time < 0)
731+
time = 0;
732+
//if( player->client->ps.persistant[PERS_CURRCLASS] == Q3F_CLASS_PARAMEDIC )
733+
// time /= 0.66;
734+
time += 2500;
735+
if( time < 4000 )
736+
time = 4000;
737+
if( time > 10000 )
738+
time = 10000;
733739
if( player->client->ps.persistant[PERS_CURRCLASS] == Q3F_CLASS_PARAMEDIC )
734740
time *= 0.66;
735741
player->client->ps.powerups[PW_Q3F_GAS] = level.time + time;

0 commit comments

Comments
 (0)