networking

This commit is contained in:
2025-07-13 15:47:42 +03:00
parent f5b26be510
commit a9c28b8940
345 changed files with 142130 additions and 174 deletions

View File

@@ -0,0 +1,40 @@
//========= Copyright © 1996-2008, Valve LLC, All rights reserved. ============
//
// Purpose: Class for rendering photon beams
//
// $NoKeywords: $
//=============================================================================
#include "stdafx.h"
#include "PhotonBeam.h"
#include "SpaceWar.h"
//-----------------------------------------------------------------------------
// Purpose: Constructor
//-----------------------------------------------------------------------------
CPhotonBeam::CPhotonBeam( IGameEngine *pGameEngine, float xPos, float yPos, DWORD dwBeamColor, float flInitialRotation, float flInitialXVelocity, float flInitialYVelocity )
: CSpaceWarEntity( pGameEngine, 3, true )
{
// Beams only have a lifetime of 1 second
m_ulTickCountToDieAt = m_pGameEngine->GetGameTickCount()+PHOTON_BEAM_LIFETIME_IN_TICKS;
// Set a really high max velocity for photon beams
SetMaximumVelocity( 500 );
AddLine( -2.0f, -3.0f, -2.0f, 3.0f, dwBeamColor );
AddLine( 2.0f, -3.0f, 2.0f, 3.0f, dwBeamColor );
SetPosition( xPos, yPos );
SetRotationDeltaNextFrame( flInitialRotation );
SetVelocity( flInitialXVelocity, flInitialYVelocity );
}
//-----------------------------------------------------------------------------
// Purpose: Update with data from server
//-----------------------------------------------------------------------------
void CPhotonBeam::OnReceiveServerUpdate( ServerPhotonBeamUpdateData_t *pUpdateData )
{
SetPosition( pUpdateData->GetXPosition()*m_pGameEngine->GetViewportWidth(), pUpdateData->GetYPosition()*m_pGameEngine->GetViewportHeight() );
SetVelocity( pUpdateData->GetXVelocity(), pUpdateData->GetYVelocity() );
SetAccumulatedRotation( pUpdateData->GetRotation() );
}