void CRadarArea::SetPosition ( const CVector& vecPosition ) { // Remember the last position m_vecLastPosition = m_vecPosition; // Different from our current position? if ( vecPosition != m_vecPosition ) { // Set the new position m_vecPosition = vecPosition; // We need to make sure the time context is replaced // before that so old packets don't arrive after this. GenerateSyncTimeContext (); // Tell all the players that know about us CBitStream BitStream; BitStream.pBitStream->Write ( m_ID ); BitStream.pBitStream->Write ( vecPosition.fX ); BitStream.pBitStream->Write ( vecPosition.fY ); BitStream.pBitStream->Write ( vecPosition.fZ ); BitStream.pBitStream->Write ( GetSyncTimeContext () ); BroadcastOnlyVisible ( CLuaPacket ( SET_ELEMENT_POSITION, *BitStream.pBitStream ) ); } }
void CRadarArea::SetColor ( unsigned long ulColor ) { // Different from our current color? if ( ulColor != m_ulColor ) { // Update the color m_ulColor = ulColor; // Tell all the players that know about us CBitStream BitStream; BitStream.pBitStream->Write ( m_ID ); BitStream.pBitStream->Write ( ulColor ); BroadcastOnlyVisible ( CLuaPacket ( SET_RADAR_AREA_COLOR, *BitStream.pBitStream ) ); } }
void CRadarArea::SetSize ( const CVector2D& vecSize ) { // Different from our current size? if ( vecSize != m_vecSize ) { // Update the size m_vecSize = vecSize; // Tell all the players that know about us CBitStream BitStream; BitStream.pBitStream->Write ( m_ID ); BitStream.pBitStream->Write ( vecSize.fX ); BitStream.pBitStream->Write ( vecSize.fY ); BroadcastOnlyVisible ( CLuaPacket ( SET_RADAR_AREA_SIZE, *BitStream.pBitStream ) ); } }
void CRadarArea::SetColor ( const SColor color ) { // Different from our current color? if ( color != m_Color ) { // Update the color m_Color = color; // Tell all the players that know about us CBitStream BitStream; BitStream.pBitStream->Write ( m_ID ); BitStream.pBitStream->Write ( color.R ); BitStream.pBitStream->Write ( color.G ); BitStream.pBitStream->Write ( color.B ); BitStream.pBitStream->Write ( color.A ); BroadcastOnlyVisible ( CLuaPacket ( SET_RADAR_AREA_COLOR, *BitStream.pBitStream ) ); } }
void CRadarArea::SetFlashing ( bool bFlashing ) { // Different from our current flashing status? if ( bFlashing != m_bIsFlashing ) { // Set the new status m_bIsFlashing = bFlashing; // Tell all the players that know about us CBitStream BitStream; BitStream.pBitStream->Write ( m_ID ); if ( bFlashing ) { BitStream.pBitStream->Write ( static_cast < unsigned char > ( 1 ) ); } else { BitStream.pBitStream->Write ( static_cast < unsigned char > ( 0 ) ); } BroadcastOnlyVisible ( CLuaPacket ( SET_RADAR_AREA_FLASHING, *BitStream.pBitStream ) ); } }