-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcgsc.h
137 lines (119 loc) · 3.01 KB
/
cgsc.h
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#pragma once
#ifdef __cplusplus
extern "C"
{
#endif
#ifdef _WIN32
#define NOGDI
#include <winsock2.h>
#include <mswsock.h>
#include <windows.h>
#endif
#ifdef COD4X18UPDATE
#include "cod4x.h"
#else
#include "plugin.h"
#endif
#ifdef PLUGIN_HANDLER_VERSION_MAJOR
#define CGSC(version) PLUGIN_HANDLER_VERSION_MAJOR >= version
#define CGSCH PLUGIN_HANDLER_VERSION_MAJOR
#define CGSCL PLUGIN_HANDLER_VERSION_MINOR
#define CGSC_EQ(version) CGSCH == version
#if PLUGIN_HANDLER_VERSION_MAJOR >= 4
#include "versions/cgsc4.h"
#elif PLUGIN_HANDLER_VERSION_MAJOR >= 3
#include "versions/cgsc3.h"
#endif
#endif
#ifdef SYS_COMMONVERSION
#define COD4X(version) SYS_COMMONVERSION
#endif
#ifdef __cplusplus
#define CPP_EXTERN extern "C++"
#else
#define CPP_EXTERN
#endif
/// @brief Adds the definition for cod4x server and plugin export.
#define EXPORT(type, definition) \
type definition; \
type Plugin_##definition
#define CLASS_NUM_COUNT sizeof(gScrClassMap) / sizeof(gScrClassMap[0])
#define DEBUG_REFCOUNT_SIZE 65536
#define MAX_ARRAYINDEX 0x800000
#define MAX_LOCAL_CENTITIES 1536
#define OBJECT_STACK 0x18001u
#define SL_MAX_STRING_INDEX 0x10000
#define SCR_GET_ENTITY_FROM_ENTCLIENT(entcl) (entcl & UNK_ENTNUM_MASK)
#define UNK_ENTNUM_MASK 0x3FFF
#define VAR_ARRAYINDEXSTART 0x800000
#define VAR_STAT_MASK 0x60
#define VAR_STAT_FREE 0
#define VAR_STAT_MOVABLE 32
#define VAR_STAT_HEAD 64
#define VAR_STAT_EXTERNAL 96
#define VAR_MASK 0x1F
#define VAR_NAME_HIGH_MASK 0xFFFFFF00
#define VAR_NAME_BITS 8
#define VAR_TYPE(var) (var->w.type & VAR_MASK)
#define VARIABLELIST_CHILD_BEGIN 0x8002
#define VARIABLELIST_PARENT_BEGIN 0x1
#define VARIABLELIST_CHILD_SIZE 0xFFFE
#define VARIABLELIST_PARENT_SIZE 0x8000
#define IsObject(var) ((var->w.type & VAR_MASK) >= VAR_THREAD)
#define IsObjectVal(var) ((var->type & VAR_MASK) >= VAR_THREAD)
// clang-format off
enum GSCTypeFlag
{
FLAG_UNDEFINED = 1,
FLAG_BEGIN_REF = 2,
FLAG_POINTER = 4,
FLAG_STRING = 8,
FLAG_ISTRING = 16,
FLAG_VECTOR = 32,
FLAG_END_REF = 64,
FLAG_FLOAT = 128,
FLAG_INTEGER = 256,
FLAG_CODEPOS = 512,
FLAG_PRECODEPOS = 1024,
FLAG_FUNCTION = 2048,
FLAG_STACK = 4096,
FLAG_ANIMATION = 8192,
FLAG_DEVELOPER_CODEPOS = 16384,
FLAG_INCLUDE_CODEPOS = 32768,
FLAG_THREAD = 65536,
FLAG_NOTIFY_THREAD = 131072,
FLAG_TIME_THREAD = 262144,
FLAG_CHILD_THREAD = 524288,
FLAG_OBJECT = 1048576,
FLAG_DEAD_ENTITY = 2097152,
FLAG_ENTITY = 4194304,
FLAG_ARRAY = 8388608,
FLAG_DEAD_THREAD = 16777216,
FLAG_COUNT = 33554432,
FLAG_THREAD_LIST = 67108864,
FLAG_ENDON_LIST = 134217728
};
struct scrStringDebugGlob_t
{
volatile int refCount[DEBUG_REFCOUNT_SIZE];
volatile int totalRefCount;
int ignoreLeaks;
};
struct __attribute__((aligned(64))) scrVarGlob_t
{
VariableValueInternal* variableList;
};
typedef struct
{
uint32_t length;
VariableValue* items;
} VariableValueArray;
// clang-format on
#include "extensions/functions.h"
#include "extensions/variables.h"
#include "sys/async.h"
#include "sys/compatibility.h"
#include "utils/utils.h"
#ifdef __cplusplus
}
#endif