In do animation event on the server, make sure the client who you're 
dispatching it on, is filtered out.

I apparently have two versions of it.

//hl2mp_player.cpp
void TE_PlayerAnimEvent( CBasePlayer *pPlayer, PlayerAnimEvent_t event, int 
nData )
{
        CPVSFilter filter( (const Vector&)pPlayer->EyePosition() );

        //Tony; use prediction rules.
        filter.UsePredictionRules();

        g_TEPlayerAnimEvent.m_hPlayer = pPlayer;
        g_TEPlayerAnimEvent.m_iEvent = event;
        g_TEPlayerAnimEvent.m_nData = nData;
        g_TEPlayerAnimEvent.Create( filter, 0 );
}

//sdk_player.cpp
void TE_PlayerAnimEvent( CBasePlayer *pPlayer, PlayerAnimEvent_t event, int 
nData )
{
        CPVSFilter filter( (const Vector&)pPlayer->EyePosition() );

        //Tony; pull the player who is doing it out of the recipientlist, this 
is predicted!!
        filter.RemoveRecipient( pPlayer );

        g_TEPlayerAnimEvent.m_hPlayer = pPlayer;
        g_TEPlayerAnimEvent.m_iEvent = event;
        g_TEPlayerAnimEvent.m_nData = nData;
        g_TEPlayerAnimEvent.Create( filter, 0 );
}

Probably because I was working on them each at different times. Hjehe

-Tony
-----Original Message-----
From: hlcoders-boun...@list.valvesoftware.com 
[mailto:hlcoders-boun...@list.valvesoftware.com] On Behalf Of Michael Chang
Sent: February-19-09 9:10 AM
To: hlcoders@list.valvesoftware.com
Subject: [hlcoders] anim events doubling up, firing at the wrong time

Hey all

Got a bit of a weird problem and I'm not sure if anyone's experienced this.

My animation events are firing twice, once when it's supposed to, and
another time as soon as the animation ends and m_flCycle is at 1.00

It appears that m_nResetEventsParity is being set at the wrong time, or that
the client is attempting to play the animation sequence for that animation
again before the sequence has successfully changed, causing the double-up.


I printed out the message from c_baseanimating to figure out what's exactly
happening, but I'm not sure what to make of this:

At the start of the animation:

174 cycle 0.004572
new seq: 29 - old seq: 0 - reset: true - m_flCycle 0.004572 - Model Name:
humans\group03\duel_knight.mdl - (time 2.624)
174 (seq 29 cycle 0.005 ) evcycle 0.000 prevevcycle -0.010 (time 2.624)
event! 174 (seq: 29) FE 33 Normal cycle 0.000000, prev -0.010000 ev 0.000000
(time 2.624) curcycle: 0.004572
event! 174 (seq: 29) FE 32 Normal cycle 0.000000, prev -0.010000 ev 0.000000
(time 2.624) curcycle: 0.004572
event! 174 (seq: 29) FE 32 Normal cycle 0.000000, prev -0.010000 ev 0.000000
(time 2.624) curcycle: 0.004572
176 cycle 0.016056
176 (seq 29 cycle 0.016 ) evcycle 0.016 prevevcycle 0.000 (time 2.643)
177 cycle 0.025701
new seq: 29 - old seq: 29 - reset: true - m_flCycle 0.025701 - Model Name:
humans\group03\duel_knight.mdl - (time 2.659)
177 (seq 29 cycle 0.026 ) evcycle 0.000 prevevcycle -0.010 (time 2.659)
event! 177 (seq: 29) FE 33 Normal cycle 0.000000, prev -0.010000 ev 0.000000
(time 2.659) curcycle: 0.025701
event! 177 (seq: 29) FE 32 Normal cycle 0.000000, prev -0.010000 ev 0.000000
(time 2.659) curcycle: 0.025701
event! 177 (seq: 29) FE 32 Normal cycle 0.000000, prev -0.010000 ev 0.000000
(time 2.659) curcycle: 0.025701
178 cycle 0.033285
178 (seq 29 cycle 0.033 ) evcycle 0.033 prevevcycle 0.000 (time 2.672)
178 cycle 0.040052
178 (seq 29 cycle 0.040 ) evcycle 0.040 prevevcycle 0.033 (time 2.683)
179 cycle 0.044780
179 (seq 29 cycle 0.045 ) evcycle 0.045 prevevcycle 0.040 (time 2.691)



etc... etc... animation finishes... and BAM:


283 (seq 29 cycle 0.996 ) evcycle 0.996 prevevcycle 0.992 (time 4.259)
284 cycle 0.999091
284 (seq 29 cycle 0.999 ) evcycle 0.999 prevevcycle 0.996 (time 4.265)
284 cycle 1.000000
284 (seq 29 cycle 1.000 ) evcycle 1.000 prevevcycle 0.999 (time 4.272)
285 cycle 1.000000
286 cycle 1.000000
new seq: 29 - old seq: 29 - reset: true - m_flCycle 1.000000 - Model Name:
humans\group03\duel_knight.mdl - (time 4.290)    <---- HERE
286 cycle 1.000000
286 (seq 29 cycle 1.000 ) evcycle 1.000 prevevcycle -0.010 (time 4.297)
event! 286 (seq: 29) FE 33 Normal cycle 0.000000, prev -0.010000 ev 1.000000
(time 4.297) curcycle: 1.000000    <---- AND HERE
event! 286 (seq: 29) FE 15 Normal cycle 0.101010, prev -0.010000 ev 1.000000
(time 4.297) curcycle: 1.000000
event! 286 (seq: 29) FE 32 Normal cycle 0.000000, prev -0.010000 ev 1.000000
(time 4.297) curcycle: 1.000000
event! 286 (seq: 29) FE 32 Normal cycle 0.000000, prev -0.010000 ev 1.000000
(time 4.297) curcycle: 1.000000
287 cycle 1.000000
287 cycle 1.000000


The same animation continues and is supposed to "finish" but for whatever
reason the parity is reset, ending up with the events all "catching up" with
this supposedly new animation.

Note that I could do this:
    if( GetCycle() == 1.0 )
        return;

But this is a major hack, and wouldn't work in all circumstances since this
sometimes happens even when cycle is at something like 0.93 etc.


Anyone have thoughts?

~M
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders


_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to