summaryrefslogtreecommitdiff
path: root/src/cgame/cg_weapons.c
diff options
context:
space:
mode:
authorMichael Levin <risujin@fastmail.fm>2009-10-03 11:26:51 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:15:00 +0000
commit0cf04fe37fef2e827a95bb19926a3cbf8e98c581 (patch)
tree93ac01309f47edb27be26fb31e3886f6082579b1 /src/cgame/cg_weapons.c
parentd9709deb95375f2462e5ca9fc98ebf92fd91ce04 (diff)
* Added charge meter to the UI, can be disabled via GUI
* Trample and Lucifer Cannon charging reworked and moved to PMove * Can no longer "cancel" a charging Lucifer Cannon * STAT_MISC2 is now unused, booster and charge information can be inferred elsewhere (STAT_UNUSED) * Trying to fire an empty weapon makes a clicking noise (also a bugfix, apparently the server would spam EV_NOAMMO which did nothing but is now used for the clicking noise -- audible to all players) * Created an alternate, muffled Lucifer Cannon warning noise for other people's Lucifer Cannons * Fixed bug which prevented players from switching to a different player while spectating someone in the spawn queue * Spectators are now properly moved to the lock view position when spectating a player in the spawn queue
Diffstat (limited to 'src/cgame/cg_weapons.c')
-rw-r--r--src/cgame/cg_weapons.c33
1 files changed, 13 insertions, 20 deletions
diff --git a/src/cgame/cg_weapons.c b/src/cgame/cg_weapons.c
index f4c8fbf8..d0968dd9 100644
--- a/src/cgame/cg_weapons.c
+++ b/src/cgame/cg_weapons.c
@@ -872,8 +872,9 @@ void CG_AddPlayerWeapon( refEntity_t *parent, playerState_t *ps, centity_t *cent
// 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 );
+ trap_S_AddLoopingSound( cent->currentState.number, cent->lerpOrigin,
+ vec3_origin, ps ? cgs.media.lCannonWarningSound :
+ cgs.media.lCannonWarningSound2 );
if( !noGunModel )
{
@@ -987,6 +988,9 @@ CG_AddViewWeapon
Add the weapon, and flash for the player's view
==============
*/
+
+#define WEAPON_CLICK_REPEAT 500
+
void CG_AddViewWeapon( playerState_t *ps )
{
refEntity_t hand;
@@ -1072,27 +1076,16 @@ void CG_AddViewWeapon( playerState_t *ps )
VectorMA( hand.origin, cg_gun_y.value, cg.refdef.viewaxis[ 1 ], hand.origin );
VectorMA( hand.origin, ( cg_gun_z.value + fovOffset ), cg.refdef.viewaxis[ 2 ], hand.origin );
- if( weapon == WP_LUCIFER_CANNON )
+ // Lucifer Cannon vibration effect
+ if( weapon == WP_LUCIFER_CANNON && ps->stats[ STAT_MISC ] > 0 )
{
float fraction;
- if( ps->stats[ STAT_MISC ] > 0 )
- {
- // vibration effect
- fraction = (float)ps->stats[ STAT_MISC ] / (float)LCANNON_TOTAL_CHARGE;
- VectorMA( hand.origin, random( ) * fraction, cg.refdef.viewaxis[ 0 ],
- hand.origin );
- VectorMA( hand.origin, random( ) * fraction, cg.refdef.viewaxis[ 1 ],
- hand.origin );
- }
- else if( ps->stats[ STAT_MISC2 ] > 0 )
- {
- // reloading effect
- fraction = (float)ps->stats[ STAT_MISC2 ] / 250.0f;
- fraction = ( fraction > 1.0f ) ? 1.0f : fraction;
- VectorMA( hand.origin, fraction * -3.0f, cg.refdef.viewaxis[ 2 ],
- hand.origin );
- }
+ fraction = (float)ps->stats[ STAT_MISC ] / LCANNON_CHARGE_TIME_MAX;
+ VectorMA( hand.origin, random( ) * fraction, cg.refdef.viewaxis[ 0 ],
+ hand.origin );
+ VectorMA( hand.origin, random( ) * fraction, cg.refdef.viewaxis[ 1 ],
+ hand.origin );
}
AnglesToAxis( angles, hand.axis );