forked from rei-2/Amalgam
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNetVars.h
More file actions
51 lines (42 loc) · 1.67 KB
/
NetVars.h
File metadata and controls
51 lines (42 loc) · 1.67 KB
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
#pragma once
#include "../Feature/Feature.h"
#include "../../SDK/Definitions/Misc/dt_recv.h"
class CNetVars
{
public:
int GetOffset(RecvTable* pTable, const char* szNetVar);
int GetNetVar(const char* szClass, const char* szNetVar);
RecvProp* GetProp(RecvTable* pTable, const char* szNetVar);
RecvProp* GetNetProp(const char* szClass, const char* szNetVar);
};
ADD_FEATURE_CUSTOM(CNetVars, NetVars, U);
#define NETVAR(_name, type, table, name) inline type& _name() \
{ \
static int nOffset = U::NetVars.GetNetVar(table, name); \
return *reinterpret_cast<type*>(uintptr_t(this) + nOffset); \
}
#define NETVAR_OFF(_name, type, table, name, offset) inline type& _name() \
{ \
static int nOffset = U::NetVars.GetNetVar(table, name) + offset; \
return *reinterpret_cast<type*>(uintptr_t(this) + nOffset); \
}
#define NETVAR_ARRAY(_name, type, table, name) inline type& _name(int iIndex) \
{ \
static int nOffset = U::NetVars.GetNetVar(table, name); \
return *reinterpret_cast<type*>(uintptr_t(this) + nOffset + iIndex * sizeof(type)); \
}
#define NETVAR_ARRAY_OFF(_name, type, table, name, offset) inline type& _name(int iIndex) \
{ \
static int nOffset = U::NetVars.GetNetVar(table, name) + offset; \
return *reinterpret_cast<type*>(uintptr_t(this) + nOffset + iIndex * sizeof(type)); \
}
#define NETVAR_EMBED(_name, type, table, name) inline type _name() \
{ \
static int nOffset = U::NetVars.GetNetVar(table, name); \
return reinterpret_cast<type>(uintptr_t(this) + nOffset); \
}
#define NETVAR_EMBED_OFF(_name, type, table, name, offset) inline type _name() \
{ \
static int nOffset = U::NetVars.GetNetVar(table, name) + offset; \
return reinterpret_cast<type>(uintptr_t(this) + nOffset); \
}