summaryrefslogtreecommitdiff
path: root/game/shared/tf/tf_playerclass_shared.h
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/shared/tf/tf_playerclass_shared.h
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'game/shared/tf/tf_playerclass_shared.h')
-rw-r--r--game/shared/tf/tf_playerclass_shared.h103
1 files changed, 103 insertions, 0 deletions
diff --git a/game/shared/tf/tf_playerclass_shared.h b/game/shared/tf/tf_playerclass_shared.h
new file mode 100644
index 0000000..722b1f4
--- /dev/null
+++ b/game/shared/tf/tf_playerclass_shared.h
@@ -0,0 +1,103 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+//=============================================================================
+#ifndef TF_PLAYERCLASS_SHARED_H
+#define TF_PLAYERCLASS_SHARED_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "tf_shareddefs.h"
+#include "tf_classdata.h"
+
+// Client specific.
+#ifdef CLIENT_DLL
+
+EXTERN_RECV_TABLE( DT_TFPlayerClassShared );
+
+// Server specific.
+#else
+
+EXTERN_SEND_TABLE( DT_TFPlayerClassShared );
+
+#endif
+
+//-----------------------------------------------------------------------------
+// TF Player Class Shared
+//-----------------------------------------------------------------------------
+class CTFPlayerClassShared
+{
+public:
+
+ CTFPlayerClassShared();
+
+ DECLARE_EMBEDDED_NETWORKVAR()
+ DECLARE_CLASS_NOBASE( CTFPlayerClassShared );
+
+ bool Init( int iClass );
+ bool IsClass( int iClass ) const { return ( m_iClass == iClass ); }
+ int GetClassIndex( void ) const { return m_iClass; }
+ void Reset( void );
+
+#ifdef CLIENT_DLL
+ string_t GetClassIconName( void ) const { return MAKE_STRING( m_iszClassIcon ); }
+ bool HasCustomModel( void ) const { return m_iszCustomModel[0] != '\0'; }
+#else
+ string_t GetClassIconName( void ) const { return m_iszClassIcon.Get(); }
+ void SetClassIconName( string_t iszClassIcon ) { m_iszClassIcon = iszClassIcon; }
+ bool HasCustomModel( void ) const { return (m_iszCustomModel.Get() != NULL_STRING); }
+#endif
+
+#ifndef CLIENT_DLL
+ #define USE_CLASS_ANIMATIONS true
+ void SetCustomModel( const char *pszModelName, bool isUsingClassAnimations = false );
+ void SetCustomModelOffset( Vector &vecOffset ) { m_vecCustomModelOffset = vecOffset; }
+ void SetCustomModelRotates( bool bRotates ) { m_bCustomModelRotates = bRotates; }
+ void SetCustomModelRotation( QAngle &vecOffset ) { m_angCustomModelRotation = vecOffset; m_bCustomModelRotationSet = true; }
+ void ClearCustomModelRotation( void ) { m_bCustomModelRotationSet = false; }
+ void SetCustomModelVisibleToSelf( bool bVisible ) { m_bCustomModelVisibleToSelf = bVisible; }
+#endif
+
+ const char *GetName( void ) const { return GetPlayerClassData( m_iClass )->m_szClassName; }
+ const char *GetModelName( void ) const;
+ const char *GetHandModelName( int iHandIndex ) const;
+ float GetMaxSpeed( void ) { return GetPlayerClassData( m_iClass )->m_flMaxSpeed; }
+ int GetMaxHealth( void ) const { return GetPlayerClassData( m_iClass )->m_nMaxHealth; }
+ int GetMaxArmor( void ) const { return GetPlayerClassData( m_iClass )->m_nMaxArmor; }
+ Vector GetCustomModelOffset( void ) const { return m_vecCustomModelOffset.Get(); }
+ QAngle GetCustomModelRotation( void ) const { return m_angCustomModelRotation.Get(); }
+ bool CustomModelRotationSet( void ) { return m_bCustomModelRotationSet.Get(); }
+ bool CustomModelRotates( void ) const { return m_bCustomModelRotates.Get(); }
+ bool CustomModelIsVisibleToSelf( void ) const { return m_bCustomModelVisibleToSelf.Get(); }
+ bool CustomModelUsesClassAnimations( void ) const { return m_bUseClassAnimations.Get(); }
+ bool CustomModelHasChanged( void );
+
+ TFPlayerClassData_t *GetData( void ) const { return GetPlayerClassData( m_iClass ); }
+
+ // If needed, put this into playerclass scripts
+ bool CanBuildObject( int iObjectType );
+
+protected:
+
+ CNetworkVar( int, m_iClass );
+
+#ifdef CLIENT_DLL
+ char m_iszClassIcon[MAX_PATH];
+ char m_iszCustomModel[MAX_PATH];
+#else
+ CNetworkVar( string_t, m_iszClassIcon );
+ CNetworkVar( string_t, m_iszCustomModel );
+#endif
+ CNetworkVar( Vector, m_vecCustomModelOffset );
+ CNetworkVar( QAngle, m_angCustomModelRotation );
+ CNetworkVar( bool, m_bCustomModelRotates );
+ CNetworkVar( bool, m_bCustomModelRotationSet );
+ CNetworkVar( bool, m_bCustomModelVisibleToSelf );
+ CNetworkVar( bool, m_bUseClassAnimations );
+ CNetworkVar( int, m_iClassModelParity );
+ int m_iOldClassModelParity;
+};
+
+#endif // TF_PLAYERCLASS_SHARED_H \ No newline at end of file