summaryrefslogtreecommitdiff
path: root/src/cgame
diff options
context:
space:
mode:
Diffstat (limited to 'src/cgame')
-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
5 files changed, 50 insertions, 20 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 );
}
}
}