1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//
//=============================================================================//
#include "cbase.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
// -------------------------------------------------------------------------------- //
// An entity used to test traceline
// -------------------------------------------------------------------------------- //
class CTestTraceline : public CPointEntity
{
public:
DECLARE_CLASS( CTestTraceline, CPointEntity );
void Spawn( void );
int UpdateTransmitState();
DECLARE_SERVERCLASS();
DECLARE_DATADESC();
private:
void Spin( void );
};
// This table encodes the CBaseEntity data.
IMPLEMENT_SERVERCLASS_ST_NOBASE(CTestTraceline, DT_TestTraceline)
SendPropInt (SENDINFO(m_clrRender), 32, SPROP_UNSIGNED ),
SendPropVector (SENDINFO(m_vecOrigin), 19, 0, MIN_COORD_INTEGER, MAX_COORD_INTEGER),
SendPropFloat (SENDINFO_VECTORELEM(m_angRotation, 0), 19, 0, MIN_COORD_INTEGER, MAX_COORD_INTEGER),
SendPropFloat (SENDINFO_VECTORELEM(m_angRotation, 1), 19, 0, MIN_COORD_INTEGER, MAX_COORD_INTEGER),
SendPropFloat (SENDINFO_VECTORELEM(m_angRotation, 2), 19, 0, MIN_COORD_INTEGER, MAX_COORD_INTEGER),
SendPropEHandle (SENDINFO_NAME(m_hMoveParent, moveparent)),
END_SEND_TABLE()
LINK_ENTITY_TO_CLASS( test_traceline, CTestTraceline );
BEGIN_DATADESC( CTestTraceline )
// Function Pointers
DEFINE_FUNCTION( Spin ),
END_DATADESC()
void CTestTraceline::Spawn( void )
{
SetRenderColor( 255, 255, 255, 255 );
SetNextThink( gpGlobals->curtime );
SetThink( &CTestTraceline::Spin );
}
void CTestTraceline::Spin( void )
{
static ConVar traceline_spin( "traceline_spin","1" );
if (traceline_spin.GetInt())
{
float s = sin( gpGlobals->curtime );
QAngle angles = GetLocalAngles();
angles[0] = 180.0 * 0.5 * (s * s * s + 1.0f) + 90;
angles[1] = gpGlobals->curtime * 10;
SetLocalAngles( angles );
}
SetNextThink( gpGlobals->curtime );
}
int CTestTraceline::UpdateTransmitState()
{
return SetTransmitState( FL_EDICT_ALWAYS );
}
|