summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Levin <risujin@fastmail.fm>2009-10-03 11:20:08 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:14:53 +0000
commitc9083efba65343e9242ab05acd82ee7fcfa17e54 (patch)
tree717e309c90f141ffa600d45da78fbe241dfc0c66 /src
parentb6fd1bffca359783d14cd2000d39cd422ce64eb3 (diff)
* Pulse Rifle has a small impact "particle system" to show impact flash
Lucifer Cannon aesthetic changes: * Secondary fire has a blaster-like trail and impact flash * Primary fire missile sprite and impact particles scale their size with charge strength * Other players can hear Humans overcharge
Diffstat (limited to 'src')
-rw-r--r--src/cgame/cg_ents.c4
-rw-r--r--src/cgame/cg_event.c8
-rw-r--r--src/cgame/cg_local.h9
-rw-r--r--src/cgame/cg_particles.c12
-rw-r--r--src/cgame/cg_weapons.c37
-rw-r--r--src/game/bg_misc.c2
-rw-r--r--src/game/bg_pmove.c6
-rw-r--r--src/game/bg_public.h2
-rw-r--r--src/game/g_missile.c3
9 files changed, 61 insertions, 22 deletions
diff --git a/src/cgame/cg_ents.c b/src/cgame/cg_ents.c
index c6597b6b..e8a217db 100644
--- a/src/cgame/cg_ents.c
+++ b/src/cgame/cg_ents.c
@@ -396,6 +396,7 @@ static void CG_LaunchMissile( centity_t *cent )
{
CG_SetAttachmentCent( &ps->attachment, cent );
CG_AttachToCent( &ps->attachment );
+ ps->charge = es->torsoAnim;
}
}
@@ -466,7 +467,8 @@ static void CG_Missile( centity_t *cent )
if( wim->usesSpriteMissle )
{
ent.reType = RT_SPRITE;
- ent.radius = wim->missileSpriteSize;
+ ent.radius = wim->missileSpriteSize +
+ wim->missileSpriteCharge * es->torsoAnim;
ent.rotation = 0;
ent.customShader = wim->missileSprite;
ent.shaderRGBA[ 0 ] = 0xFF;
diff --git a/src/cgame/cg_event.c b/src/cgame/cg_event.c
index 763d8b77..9b6afbe6 100644
--- a/src/cgame/cg_event.c
+++ b/src/cgame/cg_event.c
@@ -805,19 +805,19 @@ void CG_EntityEvent( centity_t *cent, vec3_t position )
case EV_MISSILE_HIT:
DEBUGNAME( "EV_MISSILE_HIT" );
ByteToDir( es->eventParm, dir );
- CG_MissileHitPlayer( es->weapon, es->generic1, position, dir, es->otherEntityNum );
+ CG_MissileHitPlayer( es->weapon, es->generic1, position, dir, es->otherEntityNum, es->torsoAnim );
break;
case EV_MISSILE_MISS:
DEBUGNAME( "EV_MISSILE_MISS" );
ByteToDir( es->eventParm, dir );
- CG_MissileHitWall( es->weapon, es->generic1, 0, position, dir, IMPACTSOUND_DEFAULT );
+ CG_MissileHitWall( es->weapon, es->generic1, 0, position, dir, IMPACTSOUND_DEFAULT, es->torsoAnim );
break;
case EV_MISSILE_MISS_METAL:
DEBUGNAME( "EV_MISSILE_MISS_METAL" );
ByteToDir( es->eventParm, dir );
- CG_MissileHitWall( es->weapon, es->generic1, 0, position, dir, IMPACTSOUND_METAL );
+ CG_MissileHitWall( es->weapon, es->generic1, 0, position, dir, IMPACTSOUND_METAL, es->torsoAnim );
break;
case EV_HUMAN_BUILDABLE_EXPLOSION:
@@ -877,7 +877,7 @@ void CG_EntityEvent( centity_t *cent, vec3_t position )
case EV_MASS_DRIVER:
DEBUGNAME( "EV_MASS_DRIVER" );
ByteToDir( es->eventParm, dir );
- CG_MissileHitWall( es->weapon, es->generic1, 0, position, dir, IMPACTSOUND_DEFAULT );
+ CG_MissileHitWall( es->weapon, es->generic1, 0, position, dir, IMPACTSOUND_DEFAULT, 0 );
CG_MassDriverFire( es );
break;
diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h
index f14c7b40..b47f7cc9 100644
--- a/src/cgame/cg_local.h
+++ b/src/cgame/cg_local.h
@@ -313,6 +313,8 @@ typedef struct baseParticle_s
qboolean overdrawProtection;
qboolean realLight;
qboolean cullOnStartSolid;
+
+ float scaleWithCharge;
} baseParticle_t;
@@ -354,6 +356,8 @@ typedef struct particleSystem_s
//for PMT_NORMAL
qboolean normalValid;
vec3_t normal;
+
+ int charge;
} particleSystem_t;
@@ -777,6 +781,7 @@ typedef struct weaponInfoMode_s
qboolean usesSpriteMissle;
qhandle_t missileSprite;
int missileSpriteSize;
+ float missileSpriteCharge;
qhandle_t missileParticleSystem;
qhandle_t missileTrailSystem;
qboolean missileRotates;
@@ -1698,8 +1703,8 @@ void CG_RegisterWeapon( int weaponNum );
void CG_FireWeapon( centity_t *cent, weaponMode_t weaponMode );
void CG_MissileHitWall( weapon_t weapon, weaponMode_t weaponMode, int clientNum,
- vec3_t origin, vec3_t dir, impactSound_t soundType );
-void CG_MissileHitPlayer( weapon_t weapon, weaponMode_t weaponMode, vec3_t origin, vec3_t dir, int entityNum );
+ vec3_t origin, vec3_t dir, impactSound_t soundType, int charge );
+void CG_MissileHitPlayer( weapon_t weapon, weaponMode_t weaponMode, vec3_t origin, vec3_t dir, int entityNum, int charge );
void CG_Bullet( vec3_t origin, int sourceEntityNum, vec3_t normal, qboolean flesh, int fleshEntityNum );
void CG_ShotgunFire( entityState_t *es );
void CG_MassDriverFire( entityState_t *es );
diff --git a/src/cgame/cg_particles.c b/src/cgame/cg_particles.c
index 80c4b23a..f38b17d8 100644
--- a/src/cgame/cg_particles.c
+++ b/src/cgame/cg_particles.c
@@ -157,6 +157,8 @@ static particle_t *CG_SpawnNewParticle( baseParticle_t *bp, particleEjector_t *p
p->radius.delay = (int)CG_RandomiseValue( (float)bp->radius.delay, bp->radius.delayRandFrac );
p->radius.initial = CG_RandomiseValue( bp->radius.initial, bp->radius.initialRandFrac );
p->radius.final = CG_RandomiseValue( bp->radius.final, bp->radius.finalRandFrac );
+
+ p->radius.initial += bp->scaleWithCharge * pe->parent->charge;
p->alpha.delay = (int)CG_RandomiseValue( (float)bp->alpha.delay, bp->alpha.delayRandFrac );
p->alpha.initial = CG_RandomiseValue( bp->alpha.initial, bp->alpha.initialRandFrac );
@@ -1349,6 +1351,16 @@ static qboolean CG_ParseParticle( baseParticle_t *bp, char **text_p )
continue;
}
+ else if( !Q_stricmp( token, "scaleWithCharge" ) )
+ {
+ token = COM_Parse( text_p );
+ if( !token )
+ break;
+
+ bp->scaleWithCharge = atof( token );
+
+ continue;
+ }
else if( !Q_stricmp( token, "}" ) )
return qtrue; //reached the end of this particle
else
diff --git a/src/cgame/cg_weapons.c b/src/cgame/cg_weapons.c
index d3c52e13..d0ea8737 100644
--- a/src/cgame/cg_weapons.c
+++ b/src/cgame/cg_weapons.c
@@ -141,6 +141,16 @@ static qboolean CG_ParseWeaponModeSection( weaponInfoMode_t *wim, char **text_p
continue;
}
+ else if( !Q_stricmp( token, "missileSpriteCharge" ) )
+ {
+ token = COM_Parse( text_p );
+ if( !token )
+ break;
+
+ wim->missileSpriteCharge = atof( token );
+
+ continue;
+ }
else if( !Q_stricmp( token, "missileRotates" ) )
{
wim->missileRotates = qtrue;
@@ -859,6 +869,12 @@ void CG_AddPlayerWeapon( refEntity_t *parent, playerState_t *ps, centity_t *cent
trap_S_AddLoopingSound( cent->currentState.number, cent->lerpOrigin, vec3_origin, weapon->readySound );
}
+ // Lucifer cannon charge warning beep
+ if( weaponNum == WP_LUCIFER_CANNON &&
+ ( cent->currentState.eFlags & EF_WARN_CHARGE ) )
+ trap_S_AddLoopingSound( cent->currentState.number, cent->lerpOrigin,
+ vec3_origin, cgs.media.lCannonWarningSound );
+
if( !noGunModel )
{
CG_PositionEntityOnTag( &gun, parent, parent->hModel, "tag_weapon" );
@@ -1005,12 +1021,6 @@ void CG_AddViewWeapon( playerState_t *ps )
if( ( ps->stats[ STAT_BUILDABLE ] & ~SB_VALID_TOGGLEBIT ) > BA_NONE )
CG_GhostBuildable( ps->stats[ STAT_BUILDABLE ] & ~SB_VALID_TOGGLEBIT );
- if( weapon == WP_LUCIFER_CANNON && ps->stats[ STAT_MISC ] > 0 )
- {
- if( ps->stats[ STAT_MISC ] > ( LCANNON_TOTAL_CHARGE - ( LCANNON_TOTAL_CHARGE / 3 ) ) )
- trap_S_AddLoopingSound( ps->clientNum, ps->origin, vec3_origin, cgs.media.lCannonWarningSound );
- }
-
// no gun if in third person view
if( cg.renderingThirdPerson )
return;
@@ -1523,7 +1533,7 @@ Caused by an EV_MISSILE_MISS event, or directly by local bullet tracing
=================
*/
void CG_MissileHitWall( weapon_t weaponNum, weaponMode_t weaponMode, int clientNum,
- vec3_t origin, vec3_t dir, impactSound_t soundType )
+ vec3_t origin, vec3_t dir, impactSound_t soundType, int charge )
{
qhandle_t mark = 0;
qhandle_t ps = 0;
@@ -1581,6 +1591,7 @@ void CG_MissileHitWall( weapon_t weaponNum, weaponMode_t weaponMode, int clientN
CG_SetAttachmentPoint( &partSystem->attachment, origin );
CG_SetParticleSystemNormal( partSystem, dir );
CG_AttachToPoint( &partSystem->attachment );
+ partSystem->charge = charge;
}
}
@@ -1598,7 +1609,7 @@ CG_MissileHitPlayer
=================
*/
void CG_MissileHitPlayer( weapon_t weaponNum, weaponMode_t weaponMode,
- vec3_t origin, vec3_t dir, int entityNum )
+ vec3_t origin, vec3_t dir, int entityNum, int charge )
{
vec3_t normal;
weaponInfo_t *weapon = &cg_weapons[ weaponNum ];
@@ -1612,7 +1623,7 @@ void CG_MissileHitPlayer( weapon_t weaponNum, weaponMode_t weaponMode,
weaponMode = WPM_PRIMARY;
if( weapon->wim[ weaponMode ].alwaysImpact )
- CG_MissileHitWall( weaponNum, weaponMode, 0, origin, dir, IMPACTSOUND_FLESH );
+ CG_MissileHitWall( weaponNum, weaponMode, 0, origin, dir, IMPACTSOUND_FLESH, charge );
}
/*
@@ -1811,7 +1822,7 @@ void CG_Bullet( vec3_t end, int sourceEntityNum, vec3_t normal, qboolean flesh,
if( flesh )
CG_Bleed( end, normal, fleshEntityNum );
else
- CG_MissileHitWall( WP_MACHINEGUN, WPM_PRIMARY, 0, end, normal, IMPACTSOUND_DEFAULT );
+ CG_MissileHitWall( WP_MACHINEGUN, WPM_PRIMARY, 0, end, normal, IMPACTSOUND_DEFAULT, 0 );
}
/*
@@ -1858,11 +1869,11 @@ static void CG_ShotgunPattern( vec3_t origin, vec3_t origin2, int seed, int othe
if( !( tr.surfaceFlags & SURF_NOIMPACT ) )
{
if( cg_entities[ tr.entityNum ].currentState.eType == ET_PLAYER )
- CG_MissileHitPlayer( WP_SHOTGUN, WPM_PRIMARY, tr.endpos, tr.plane.normal, tr.entityNum );
+ CG_MissileHitPlayer( WP_SHOTGUN, WPM_PRIMARY, tr.endpos, tr.plane.normal, tr.entityNum, 0 );
else if( tr.surfaceFlags & SURF_METALSTEPS )
- CG_MissileHitWall( WP_SHOTGUN, WPM_PRIMARY, 0, tr.endpos, tr.plane.normal, IMPACTSOUND_METAL );
+ CG_MissileHitWall( WP_SHOTGUN, WPM_PRIMARY, 0, tr.endpos, tr.plane.normal, IMPACTSOUND_METAL, 0 );
else
- CG_MissileHitWall( WP_SHOTGUN, WPM_PRIMARY, 0, tr.endpos, tr.plane.normal, IMPACTSOUND_DEFAULT );
+ CG_MissileHitWall( WP_SHOTGUN, WPM_PRIMARY, 0, tr.endpos, tr.plane.normal, IMPACTSOUND_DEFAULT, 0 );
}
}
}
diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c
index 45f6281f..1686f172 100644
--- a/src/game/bg_misc.c
+++ b/src/game/bg_misc.c
@@ -5079,7 +5079,7 @@ void BG_PlayerStateToEntityState( playerState_t *ps, entityState_t *s, qboolean
if( s->generic1 <= WPM_NONE || s->generic1 >= WPM_NUM_WEAPONMODES )
s->generic1 = WPM_PRIMARY;
- s->otherEntityNum = ps->otherEntityNum;
+ s->otherEntityNum = ps->otherEntityNum;
}
diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c
index 45cf89e0..3f44debd 100644
--- a/src/game/bg_pmove.c
+++ b/src/game/bg_pmove.c
@@ -2783,6 +2783,12 @@ static void PM_Weapon( void )
qboolean attack2 = qfalse;
qboolean attack3 = qfalse;
+ // Set overcharging flag so other players can hear warning
+ pm->ps->eFlags &= ~EF_WARN_CHARGE;
+ if( pm->ps->weapon == WP_LUCIFER_CANNON &&
+ pm->ps->stats[ STAT_MISC ] > LCANNON_TOTAL_CHARGE * 2 / 3 )
+ pm->ps->eFlags |= EF_WARN_CHARGE;
+
// don't allow attack until all buttons are up
if( pm->ps->pm_flags & PMF_RESPAWNED )
return;
diff --git a/src/game/bg_public.h b/src/game/bg_public.h
index 572430fc..ecc284e3 100644
--- a/src/game/bg_public.h
+++ b/src/game/bg_public.h
@@ -294,7 +294,7 @@ typedef enum
#define EF_VOTED 0x00008000 // already cast a vote
#define EF_TEAMVOTED 0x00010000 // already cast a vote
#define EF_BLOBLOCKED 0x00020000 // caught by a trapper
-#define EF_REAL_LIGHT 0x00040000 // light sprites according to ambient light
+#define EF_WARN_CHARGE 0x00040000 // Lucifer Cannon is about to overcharge
typedef enum
{
diff --git a/src/game/g_missile.c b/src/game/g_missile.c
index 373bf390..2991ec48 100644
--- a/src/game/g_missile.c
+++ b/src/game/g_missile.c
@@ -465,6 +465,9 @@ gentity_t *fire_luciferCannon( gentity_t *self, vec3_t start, vec3_t dir,
bolt->splashMethodOfDeath = MOD_LCANNON_SPLASH;
bolt->clipmask = MASK_SHOT;
bolt->target_ent = NULL;
+
+ // Pass the missile charge through
+ bolt->s.torsoAnim = damage;
bolt->s.pos.trType = TR_LINEAR;
bolt->s.pos.trTime = level.time - MISSILE_PRESTEP_TIME; // move a bit on the very first frame