aboutsummaryrefslogtreecommitdiff
path: root/mp/src/public/dt_shared.cpp
blob: 3508d214348c74984729774a8f776f2db15a335c (plain) (blame)
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
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
}