initial
This commit is contained in:
109
game/server/hl2/Func_Monitor.cpp
Normal file
109
game/server/hl2/Func_Monitor.cpp
Normal file
@@ -0,0 +1,109 @@
|
||||
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
//=============================================================================//
|
||||
|
||||
#include "cbase.h"
|
||||
#include "point_camera.h"
|
||||
#include "modelentities.h"
|
||||
#include "info_camera_link.h"
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
class CFuncMonitor : public CFuncBrush
|
||||
{
|
||||
DECLARE_DATADESC();
|
||||
DECLARE_CLASS( CFuncMonitor, CFuncBrush );
|
||||
DECLARE_SERVERCLASS();
|
||||
|
||||
public:
|
||||
virtual void Activate();
|
||||
virtual void UpdateOnRemove();
|
||||
|
||||
private:
|
||||
void InputSetCamera(inputdata_t &inputdata);
|
||||
void SetCameraByName(const char *szName);
|
||||
void ReleaseCameraLink();
|
||||
|
||||
EHANDLE m_hInfoCameraLink;
|
||||
};
|
||||
|
||||
// automatically hooks in the system's callbacks
|
||||
BEGIN_DATADESC( CFuncMonitor )
|
||||
|
||||
DEFINE_FIELD( m_hInfoCameraLink, FIELD_EHANDLE ),
|
||||
|
||||
// Outputs
|
||||
DEFINE_INPUTFUNC( FIELD_STRING, "SetCamera", InputSetCamera ),
|
||||
|
||||
END_DATADESC()
|
||||
|
||||
|
||||
LINK_ENTITY_TO_CLASS( func_monitor, CFuncMonitor );
|
||||
|
||||
|
||||
IMPLEMENT_SERVERCLASS_ST( CFuncMonitor, DT_FuncMonitor )
|
||||
END_SEND_TABLE()
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Called after all entities have spawned and after a load game.
|
||||
//-----------------------------------------------------------------------------
|
||||
void CFuncMonitor::Activate()
|
||||
{
|
||||
BaseClass::Activate();
|
||||
SetCameraByName(STRING(m_target));
|
||||
}
|
||||
|
||||
void CFuncMonitor::UpdateOnRemove()
|
||||
{
|
||||
ReleaseCameraLink();
|
||||
BaseClass::UpdateOnRemove();
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Frees the camera.
|
||||
//-----------------------------------------------------------------------------
|
||||
void CFuncMonitor::ReleaseCameraLink()
|
||||
{
|
||||
if ( m_hInfoCameraLink )
|
||||
{
|
||||
UTIL_Remove( m_hInfoCameraLink );
|
||||
m_hInfoCameraLink = NULL;
|
||||
|
||||
// Keep the target up-to-date for save/load
|
||||
m_target = NULL_STRING;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Sets camera
|
||||
//-----------------------------------------------------------------------------
|
||||
void CFuncMonitor::SetCameraByName(const char *szName)
|
||||
{
|
||||
ReleaseCameraLink();
|
||||
CBaseEntity *pBaseEnt = gEntList.FindEntityByName( NULL, szName );
|
||||
if( pBaseEnt )
|
||||
{
|
||||
CPointCamera *pCamera = dynamic_cast<CPointCamera *>( pBaseEnt );
|
||||
if( pCamera )
|
||||
{
|
||||
// Keep the target up-to-date for save/load
|
||||
m_target = MAKE_STRING( szName );
|
||||
m_hInfoCameraLink = CreateInfoCameraLink( this, pCamera );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
void CFuncMonitor::InputSetCamera(inputdata_t &inputdata)
|
||||
{
|
||||
SetCameraByName( inputdata.value.String() );
|
||||
}
|
||||
67
game/server/hl2/te_gaussexplosion.cpp
Normal file
67
game/server/hl2/te_gaussexplosion.cpp
Normal file
@@ -0,0 +1,67 @@
|
||||
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
//=============================================================================//
|
||||
|
||||
#include "cbase.h"
|
||||
#include "te_particlesystem.h"
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
//=============================================================================
|
||||
// Gauss explosion
|
||||
//=============================================================================
|
||||
|
||||
class CTEGaussExplosion : public CTEParticleSystem
|
||||
{
|
||||
public:
|
||||
DECLARE_CLASS( CTEGaussExplosion, CTEParticleSystem );
|
||||
DECLARE_SERVERCLASS();
|
||||
|
||||
CTEGaussExplosion( const char *name );
|
||||
virtual ~CTEGaussExplosion( void );
|
||||
|
||||
virtual void Test( const Vector& current_origin, const QAngle& current_angles ) { };
|
||||
|
||||
CNetworkVar( int, m_nType );
|
||||
CNetworkVector( m_vecDirection );
|
||||
};
|
||||
|
||||
|
||||
CTEGaussExplosion::CTEGaussExplosion( const char *name ) : BaseClass( name )
|
||||
{
|
||||
m_nType = 0;
|
||||
m_vecDirection.Init();
|
||||
}
|
||||
|
||||
CTEGaussExplosion::~CTEGaussExplosion( void )
|
||||
{
|
||||
}
|
||||
|
||||
IMPLEMENT_SERVERCLASS_ST( CTEGaussExplosion, DT_TEGaussExplosion )
|
||||
SendPropInt( SENDINFO(m_nType), 2, SPROP_UNSIGNED ),
|
||||
SendPropVector( SENDINFO(m_vecDirection), -1, SPROP_COORD ),
|
||||
END_SEND_TABLE()
|
||||
|
||||
static CTEGaussExplosion g_TEGaussExplosion( "GaussExplosion" );
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
// Input : &pos -
|
||||
// &angles -
|
||||
//-----------------------------------------------------------------------------
|
||||
void TE_GaussExplosion( IRecipientFilter& filter, float delay,
|
||||
const Vector &pos, const Vector &dir, int type )
|
||||
{
|
||||
g_TEGaussExplosion.m_vecOrigin = pos;
|
||||
g_TEGaussExplosion.m_vecDirection = dir;
|
||||
g_TEGaussExplosion.m_nType = type;
|
||||
|
||||
//Send it
|
||||
g_TEGaussExplosion.Create( filter, delay );
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user