Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void C_BasePlayer::SetObserverTarget( EHANDLE hObserverTarget )
- {
- // If the observer target is changing to an entity that the client doesn't know about yet,
- // it can resolve to NULL. If the client didn't have an observer target before, then
- // comparing EHANDLEs directly will see them as equal, since it uses Get(), and compares
- // NULL to NULL. To combat this, we need to check against GetEntryIndex() and
- // GetSerialNumber().
- if ( hObserverTarget.GetEntryIndex() != m_hObserverTarget.GetEntryIndex() ||
- hObserverTarget.GetSerialNumber() != m_hObserverTarget.GetSerialNumber())
- {
- // Init based on the new handle's entry index and serial number, so that it's Get()
- // has a chance to become non-NULL even if it currently resolves to NULL.
- m_hObserverTarget.Init( hObserverTarget.GetEntryIndex(), hObserverTarget.GetSerialNumber() );
- IGameEvent *event = gameeventmanager->CreateEvent( "spec_target_updated" );
- if ( event )
- {
- gameeventmanager->FireEventClientSide( event );
- }
- if ( IsLocalPlayer() )
- {
- ResetToneMapping(1.0);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment