diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /public/dt_shared.cpp | |
| download | archived-source-engine-2018-hl2-src-3bf9df6b2785fa6d951086978a3e66f49427166a.tar.xz archived-source-engine-2018-hl2-src-3bf9df6b2785fa6d951086978a3e66f49427166a.zip | |
Diffstat (limited to 'public/dt_shared.cpp')
| -rw-r--r-- | public/dt_shared.cpp | 113 |
1 files changed, 113 insertions, 0 deletions
diff --git a/public/dt_shared.cpp b/public/dt_shared.cpp new file mode 100644 index 0000000..3508d21 --- /dev/null +++ b/public/dt_shared.cpp @@ -0,0 +1,113 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +// +//=============================================================================// + +#include "dt_shared.h" + +#if !defined (CLIENT_DLL) +#include "sendproxy.h" +#else +#include "recvproxy.h" +#endif + + +// ------------------------------------------------------------------------ // +// Just wrappers to make shared code look easier... +// ------------------------------------------------------------------------ // + +// Use these functions to setup your data tables. +DataTableProp PropFloat( + char *pVarName, // Variable name. + int offset, // Offset into container structure. + int sizeofVar, + int nBits, // Number of bits to use when encoding. + int flags, + float fLowValue, // For floating point, low and high values. + float fHighValue // High value. If HIGH_DEFAULT, it's (1<<nBits). + ) +{ +#if !defined (CLIENT_DLL) + return SendPropFloat( pVarName, offset, sizeofVar, nBits, flags, fLowValue, fHighValue ); +#else + return RecvPropFloat( pVarName, offset, sizeofVar, flags ); +#endif +} + +DataTableProp PropVector( + char *pVarName, + int offset, + int sizeofVar, + int nBits, // Number of bits (for each floating-point component) to use when encoding. + int flags, + float fLowValue, // For floating point, low and high values. + float fHighValue // High value. If HIGH_DEFAULT, it's (1<<nBits). + ) +{ +#if !defined (CLIENT_DLL) + return SendPropVector( pVarName, offset, sizeofVar, nBits, flags, fLowValue, fHighValue ); +#else + return RecvPropVector( pVarName, offset, sizeofVar, flags ); +#endif +} + +DataTableProp PropAngle( + char *pVarName, + int offset, + int sizeofVar, + int nBits, + int flags + ) +{ +#if !defined (CLIENT_DLL) + return SendPropAngle( pVarName, offset, sizeofVar, nBits, flags ); +#else + return RecvPropFloat( pVarName, offset, sizeofVar, flags ); +#endif +} + +DataTableProp PropInt( + char *pVarName, + int offset, + int sizeofVar, // Handled by SENDINFO macro. + int nBits, // Set to -1 to automatically pick (max) number of bits based on size of element. + int flags, + int rightShift + ) +{ +#if !defined (CLIENT_DLL) + return SendPropInt( pVarName, offset, sizeofVar, nBits, flags, rightShift ); +#else + return RecvPropInt( pVarName, offset, sizeofVar, flags ); +#endif +} + +DataTableProp PropString( + char *pVarName, + int offset, + int bufferLen, + int flags + ) +{ +#if !defined (CLIENT_DLL) + return SendPropString( pVarName, offset, bufferLen, flags ); +#else + return RecvPropString( pVarName, offset, bufferLen, flags ); +#endif +} + +DataTableProp PropEHandle( + char *pVarName, + int offset, + int sizeofVar ) +{ +#if !defined (CLIENT_DLL) + return SendPropEHandle( pVarName, offset, sizeofVar ); +#else + return RecvPropEHandle( pVarName, offset, sizeofVar ); +#endif +} + |