summaryrefslogtreecommitdiff
path: root/game/server/tf/entity_training_annotations.cpp
diff options
context:
space:
mode:
authorFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
committerFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
commit3bf9df6b2785fa6d951086978a3e66f49427166a (patch)
tree2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /game/server/tf/entity_training_annotations.cpp
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'game/server/tf/entity_training_annotations.cpp')
-rw-r--r--game/server/tf/entity_training_annotations.cpp63
1 files changed, 63 insertions, 0 deletions
diff --git a/game/server/tf/entity_training_annotations.cpp b/game/server/tf/entity_training_annotations.cpp
new file mode 100644
index 0000000..f349ca2
--- /dev/null
+++ b/game/server/tf/entity_training_annotations.cpp
@@ -0,0 +1,63 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose: CTrainingAnnotation Entity. This entity is used to place
+// annotations on maps.
+//=============================================================================//
+
+#include "cbase.h"
+#include "entity_training_annotations.h"
+
+// memdbgon must be the last include file in a .cpp file!!!
+#include "tier0/memdbgon.h"
+
+//-----------------------------------------------------------------------------
+// Purpose: Show an anotation in 3D space in the hud to point out things of
+// interest to the player.
+//-----------------------------------------------------------------------------
+BEGIN_DATADESC( CTrainingAnnotation )
+ DEFINE_KEYFIELD( m_displayText, FIELD_STRING, "display_text" ),
+ DEFINE_KEYFIELD( m_flLifetime, FIELD_FLOAT, "lifetime" ),
+ DEFINE_KEYFIELD( m_flVerticalOffset, FIELD_FLOAT, "offset" ),
+ DEFINE_INPUTFUNC( FIELD_VOID, "Show", InputShow ),
+ DEFINE_INPUTFUNC( FIELD_VOID, "Hide", InputHide ),
+END_DATADESC()
+
+LINK_ENTITY_TO_CLASS( training_annotation, CTrainingAnnotation );
+
+CTrainingAnnotation::CTrainingAnnotation()
+ : m_flLifetime(1.0f),
+ m_flVerticalOffset(0.0f)
+{
+
+}
+
+void CTrainingAnnotation::Show()
+{
+ IGameEvent *pEvent = gameeventmanager->CreateEvent( "show_annotation" );
+ if ( pEvent )
+ {
+ Vector location = GetAbsOrigin();
+
+ pEvent->SetString( "text", STRING( m_displayText ) );
+ pEvent->SetInt( "id", (long)this );
+ pEvent->SetFloat( "worldPosX", location.x );
+ pEvent->SetFloat( "worldPosY", location.y );
+ pEvent->SetFloat( "worldPosZ", location.z + m_flVerticalOffset );
+ pEvent->SetFloat( "lifetime", m_flLifetime );
+ pEvent->SetInt( "follow_entindex", 0 );
+
+ gameeventmanager->FireEvent( pEvent );
+ }
+}
+
+void CTrainingAnnotation::Hide()
+{
+ IGameEvent *pEvent = gameeventmanager->CreateEvent( "hide_annotation" );
+ if ( pEvent )
+ {
+ pEvent->SetInt( "id", (long)this );
+ gameeventmanager->FireEventClientSide( pEvent );
+ }
+}
+
+