From 0c097c244fc8c57fa33524c8c351195826519343 Mon Sep 17 00:00:00 2001 From: IronClawTrem Date: Fri, 21 Feb 2020 13:55:46 +0000 Subject: sounds for zooming in / out with mass driver --- src/cgame/cg_weapons.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'src/cgame/cg_weapons.c') diff --git a/src/cgame/cg_weapons.c b/src/cgame/cg_weapons.c index 9aa9f9d..ca0115f 100644 --- a/src/cgame/cg_weapons.c +++ b/src/cgame/cg_weapons.c @@ -858,6 +858,35 @@ void CG_AddPlayerWeapon( refEntity_t *parent, playerState_t *ps, centity_t *cent trap_S_AddLoopingSound( cent->currentState.number, cent->lerpOrigin, vec3_origin, weapon->readySound ); } + //Zoom in / out sound + if( ( weaponNum == WP_LAS_GUN || weaponNum == WP_MASS_DRIVER ) && + ( cent->currentState.eFlags & EF_ZOOM ) && !cent->zoomed ) + { + trap_S_StartSound( cent->lerpOrigin, cent->currentState.number, + CHAN_AUTO, cgs.media.weaponZoomIn ); + cent->zoomed = qtrue; + + if( cg.snap->ps.pm_flags & PMF_FOLLOW ) + { + cg.zoomed = qtrue; + cg.zoomTime = MIN( cg.time, + cg.time + cg.time - cg.zoomTime - ZOOM_TIME ); + } + } + else if ( ( weaponNum == WP_LAS_GUN || weaponNum == WP_MASS_DRIVER ) && + !( cent->currentState.eFlags & EF_ZOOM ) && cent->zoomed ) + { + trap_S_StartSound( cent->lerpOrigin, cent->currentState.number, + CHAN_AUTO, cgs.media.weaponZoomOut ); + cent->zoomed = qfalse; + if( cg.snap->ps.pm_flags & PMF_FOLLOW ) + { + cg.zoomed = qfalse; + cg.zoomTime = MIN( cg.time, + cg.time + cg.time - cg.zoomTime - ZOOM_TIME ); + } + } + if( !noGunModel ) { CG_PositionEntityOnTag( &gun, parent, parent->hModel, "tag_weapon" ); -- cgit