From 6c07d101613ba773c5c8b0d02e8472e058f292c5 Mon Sep 17 00:00:00 2001 From: Tim Angus Date: Tue, 18 Oct 2005 19:12:38 +0000 Subject: * Fix to the multiple sound bug introduced through fixing the missing flamer bug --- src/cgame/cg_event.c | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/cgame/cg_event.c b/src/cgame/cg_event.c index fa46fe36..4d176096 100644 --- a/src/cgame/cg_event.c +++ b/src/cgame/cg_event.c @@ -936,10 +936,13 @@ CG_CheckEvents */ void CG_CheckEvents( centity_t *cent ) { + entity_event_t event; + entity_event_t oldEvent = EV_NONE; + // check for event-only entities if( cent->currentState.eType > ET_EVENTS ) { - entity_event_t event = cent->currentState.eType - ET_EVENTS; + event = cent->currentState.eType - ET_EVENTS; if( cent->previousEvent ) return; // already fired @@ -951,23 +954,31 @@ void CG_CheckEvents( centity_t *cent ) // Move the pointer to the entity that the // event was originally attached to if( cent->currentState.eFlags & EF_PLAYER_EVENT ) + { cent = &cg_entities[ cent->currentState.otherEntityNum ]; - - cent->currentState.event = event; + oldEvent = cent->currentState.event; + cent->currentState.event = event; + } } + else + { + // check for events riding with another entity + if( cent->currentState.event == cent->previousEvent ) + return; - // check for events riding with another entity - if( cent->currentState.event == cent->previousEvent ) - return; - - cent->previousEvent = cent->currentState.event; - if( ( cent->currentState.event & ~EV_EVENT_BITS ) == 0 ) - return; + cent->previousEvent = cent->currentState.event; + if( ( cent->currentState.event & ~EV_EVENT_BITS ) == 0 ) + return; + } // calculate the position at exactly the frame time BG_EvaluateTrajectory( ¢->currentState.pos, cg.snap->serverTime, cent->lerpOrigin ); CG_SetEntitySoundPosition( cent ); CG_EntityEvent( cent, cent->lerpOrigin ); + + // If this was a reattached spilled event, restore the original event + if( oldEvent != EV_NONE ) + cent->currentState.event = oldEvent; } -- cgit