dfdffdfdfdfd commited on
Commit
d3ce870
·
verified ·
1 Parent(s): 28bcc05

Update core.inc

Browse files
Files changed (1) hide show
  1. core.inc +33 -320
core.inc CHANGED
@@ -1,320 +1,33 @@
1
- /**
2
- * vim: set ts=4 sw=4 tw=99 noet:
3
- * =============================================================================
4
- * SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
5
- * =============================================================================
6
- *
7
- * This file is part of the SourceMod/SourcePawn SDK.
8
- *
9
- * This program is free software; you can redistribute it and/or modify it under
10
- * the terms of the GNU General Public License, version 3.0, as published by the
11
- * Free Software Foundation.
12
- *
13
- * This program is distributed in the hope that it will be useful, but WITHOUT
14
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
16
- * details.
17
- *
18
- * You should have received a copy of the GNU General Public License along with
19
- * this program. If not, see <http://www.gnu.org/licenses/>.
20
- *
21
- * As a special exception, AlliedModders LLC gives you permission to link the
22
- * code of this program (as well as its derivative works) to "Half-Life 2," the
23
- * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
24
- * by the Valve Corporation. You must obey the GNU General Public License in
25
- * all respects for all other code used. Additionally, AlliedModders LLC grants
26
- * this exception to all derivative works. AlliedModders LLC defines further
27
- * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
28
- * or <http://www.sourcemod.net/license.php>.
29
- *
30
- * Version: $Id$
31
- */
32
-
33
- #if defined _core_included
34
- #endinput
35
- #endif
36
- #define _core_included
37
-
38
- #include <version>
39
-
40
- /** If this gets changed, you need to update Core's check. */
41
- #define SOURCEMOD_PLUGINAPI_VERSION 7
42
-
43
- struct PlVers
44
- {
45
- public int version;
46
- public const char[] filevers;
47
- public const char[] date;
48
- public const char[] time;
49
- };
50
-
51
- /**
52
- * Specifies what to do after a hook completes.
53
- */
54
- enum Action
55
- {
56
- Plugin_Continue = 0, /**< Continue with the original action */
57
- Plugin_Changed = 1, /**< Inputs or outputs have been overridden with new values */
58
- Plugin_Handled = 3, /**< Handle the action at the end (don't call it) */
59
- Plugin_Stop = 4 /**< Immediately stop the hook chain and handle the original */
60
- };
61
-
62
- /**
63
- * Specifies identity types.
64
- */
65
- enum Identity
66
- {
67
- Identity_Core = 0,
68
- Identity_Extension = 1,
69
- Identity_Plugin = 2
70
- };
71
-
72
- public PlVers __version =
73
- {
74
- version = SOURCEMOD_PLUGINAPI_VERSION,
75
- filevers = SOURCEMOD_VERSION,
76
- date = __DATE__,
77
- time = __TIME__
78
- };
79
-
80
- /**
81
- * Plugin status values.
82
- */
83
- enum PluginStatus
84
- {
85
- Plugin_Running=0, /**< Plugin is running */
86
- /* All states below are "temporarily" unexecutable */
87
- Plugin_Paused, /**< Plugin is loaded but paused */
88
- Plugin_Error, /**< Plugin is loaded but errored/locked */
89
- /* All states below do not have all natives */
90
- Plugin_Loaded, /**< Plugin has passed loading and can be finalized */
91
- Plugin_Failed, /**< Plugin has a fatal failure */
92
- Plugin_Created, /**< Plugin is created but not initialized */
93
- Plugin_Uncompiled, /**< Plugin is not yet compiled by the JIT */
94
- Plugin_BadLoad, /**< Plugin failed to load */
95
- Plugin_Evicted /**< Plugin was unloaded due to an error */
96
- };
97
-
98
- /**
99
- * Plugin information properties. Plugins can declare a global variable with
100
- * their info. Example,
101
- *
102
- * public Plugin myinfo = {
103
- * name = "Admin Help",
104
- * author = "AlliedModders LLC",
105
- * description = "Display command information",
106
- * version = "1.0",
107
- * url = "http://www.sourcemod.net/"
108
- * };
109
- *
110
- * SourceMod will display this information when a user inspects plugins in the
111
- * console.
112
- */
113
- enum PluginInfo
114
- {
115
- PlInfo_Name, /**< Plugin name */
116
- PlInfo_Author, /**< Plugin author */
117
- PlInfo_Description, /**< Plugin description */
118
- PlInfo_Version, /**< Plugin version */
119
- PlInfo_URL /**< Plugin URL */
120
- };
121
-
122
- /**
123
- * Defines how an extension must expose itself for autoloading.
124
- */
125
- struct Extension
126
- {
127
- public const char[] name; /**< Short name */
128
- public const char[] file; /**< Default file name */
129
- public bool autoload; /**< Whether or not to auto-load */
130
- public bool required; /**< Whether or not to require */
131
- };
132
-
133
- /**
134
- * Defines how a plugin must expose itself for native requiring.
135
- */
136
- struct SharedPlugin
137
- {
138
- public const char[] name; /**< Short name */
139
- public const char[] file; /**< File name */
140
- public bool required; /**< Whether or not to require */
141
- };
142
-
143
- public float NULL_VECTOR[3]; /**< Pass this into certain functions to act as a C++ NULL */
144
- public const char NULL_STRING[1]; /**< pass this into certain functions to act as a C++ NULL */
145
-
146
- /**
147
- * Check if the given vector is the NULL_VECTOR.
148
- *
149
- * @param vec The vector to test.
150
- * @return True if NULL_VECTOR, false otherwise.
151
- */
152
- native bool IsNullVector(const float vec[3]);
153
-
154
- /**
155
- * Check if the given string is the NULL_STRING.
156
- *
157
- * @param str The string to test.
158
- * @return True if NULL_STRING, false otherwise.
159
- */
160
- native bool IsNullString(const char[] str);
161
-
162
- /**
163
- * Horrible compatibility shim.
164
- */
165
- public Extension __ext_core =
166
- {
167
- name = "Core",
168
- file = "core",
169
- autoload = 0,
170
- required = 0,
171
- };
172
-
173
- native int VerifyCoreVersion();
174
-
175
- /**
176
- * Sets a native as optional, such that if it is unloaded, removed,
177
- * or otherwise non-existent, the plugin will still work. Calling
178
- * removed natives results in a run-time error.
179
- *
180
- * @param name Native name.
181
- */
182
- native void MarkNativeAsOptional(const char[] name);
183
-
184
- public void __ext_core_SetNTVOptional()
185
- {
186
- MarkNativeAsOptional("GetFeatureStatus");
187
- MarkNativeAsOptional("RequireFeature");
188
- MarkNativeAsOptional("AddCommandListener");
189
- MarkNativeAsOptional("RemoveCommandListener");
190
-
191
- MarkNativeAsOptional("BfWriteBool");
192
- MarkNativeAsOptional("BfWriteByte");
193
- MarkNativeAsOptional("BfWriteChar");
194
- MarkNativeAsOptional("BfWriteShort");
195
- MarkNativeAsOptional("BfWriteWord");
196
- MarkNativeAsOptional("BfWriteNum");
197
- MarkNativeAsOptional("BfWriteFloat");
198
- MarkNativeAsOptional("BfWriteString");
199
- MarkNativeAsOptional("BfWriteEntity");
200
- MarkNativeAsOptional("BfWriteAngle");
201
- MarkNativeAsOptional("BfWriteCoord");
202
- MarkNativeAsOptional("BfWriteVecCoord");
203
- MarkNativeAsOptional("BfWriteVecNormal");
204
- MarkNativeAsOptional("BfWriteAngles");
205
- MarkNativeAsOptional("BfReadBool");
206
- MarkNativeAsOptional("BfReadByte");
207
- MarkNativeAsOptional("BfReadChar");
208
- MarkNativeAsOptional("BfReadShort");
209
- MarkNativeAsOptional("BfReadWord");
210
- MarkNativeAsOptional("BfReadNum");
211
- MarkNativeAsOptional("BfReadFloat");
212
- MarkNativeAsOptional("BfReadString");
213
- MarkNativeAsOptional("BfReadEntity");
214
- MarkNativeAsOptional("BfReadAngle");
215
- MarkNativeAsOptional("BfReadCoord");
216
- MarkNativeAsOptional("BfReadVecCoord");
217
- MarkNativeAsOptional("BfReadVecNormal");
218
- MarkNativeAsOptional("BfReadAngles");
219
- MarkNativeAsOptional("BfGetNumBytesLeft");
220
-
221
- MarkNativeAsOptional("BfWrite.WriteBool");
222
- MarkNativeAsOptional("BfWrite.WriteByte");
223
- MarkNativeAsOptional("BfWrite.WriteChar");
224
- MarkNativeAsOptional("BfWrite.WriteShort");
225
- MarkNativeAsOptional("BfWrite.WriteWord");
226
- MarkNativeAsOptional("BfWrite.WriteNum");
227
- MarkNativeAsOptional("BfWrite.WriteFloat");
228
- MarkNativeAsOptional("BfWrite.WriteString");
229
- MarkNativeAsOptional("BfWrite.WriteEntity");
230
- MarkNativeAsOptional("BfWrite.WriteAngle");
231
- MarkNativeAsOptional("BfWrite.WriteCoord");
232
- MarkNativeAsOptional("BfWrite.WriteVecCoord");
233
- MarkNativeAsOptional("BfWrite.WriteVecNormal");
234
- MarkNativeAsOptional("BfWrite.WriteAngles");
235
- MarkNativeAsOptional("BfRead.ReadBool");
236
- MarkNativeAsOptional("BfRead.ReadByte");
237
- MarkNativeAsOptional("BfRead.ReadChar");
238
- MarkNativeAsOptional("BfRead.ReadShort");
239
- MarkNativeAsOptional("BfRead.ReadWord");
240
- MarkNativeAsOptional("BfRead.ReadNum");
241
- MarkNativeAsOptional("BfRead.ReadFloat");
242
- MarkNativeAsOptional("BfRead.ReadString");
243
- MarkNativeAsOptional("BfRead.ReadEntity");
244
- MarkNativeAsOptional("BfRead.ReadAngle");
245
- MarkNativeAsOptional("BfRead.ReadCoord");
246
- MarkNativeAsOptional("BfRead.ReadVecCoord");
247
- MarkNativeAsOptional("BfRead.ReadVecNormal");
248
- MarkNativeAsOptional("BfRead.ReadAngles");
249
- MarkNativeAsOptional("BfRead.BytesLeft.get");
250
-
251
- MarkNativeAsOptional("PbReadInt");
252
- MarkNativeAsOptional("PbReadFloat");
253
- MarkNativeAsOptional("PbReadBool");
254
- MarkNativeAsOptional("PbReadString");
255
- MarkNativeAsOptional("PbReadColor");
256
- MarkNativeAsOptional("PbReadAngle");
257
- MarkNativeAsOptional("PbReadVector");
258
- MarkNativeAsOptional("PbReadVector2D");
259
- MarkNativeAsOptional("PbGetRepeatedFieldCount");
260
- MarkNativeAsOptional("PbSetInt");
261
- MarkNativeAsOptional("PbSetFloat");
262
- MarkNativeAsOptional("PbSetBool");
263
- MarkNativeAsOptional("PbSetString");
264
- MarkNativeAsOptional("PbSetColor");
265
- MarkNativeAsOptional("PbSetAngle");
266
- MarkNativeAsOptional("PbSetVector");
267
- MarkNativeAsOptional("PbSetVector2D");
268
- MarkNativeAsOptional("PbAddInt");
269
- MarkNativeAsOptional("PbAddFloat");
270
- MarkNativeAsOptional("PbAddBool");
271
- MarkNativeAsOptional("PbAddString");
272
- MarkNativeAsOptional("PbAddColor");
273
- MarkNativeAsOptional("PbAddAngle");
274
- MarkNativeAsOptional("PbAddVector");
275
- MarkNativeAsOptional("PbAddVector2D");
276
- MarkNativeAsOptional("PbRemoveRepeatedFieldValue");
277
- MarkNativeAsOptional("PbReadMessage");
278
- MarkNativeAsOptional("PbReadRepeatedMessage");
279
- MarkNativeAsOptional("PbAddMessage");
280
-
281
- MarkNativeAsOptional("Protobuf.ReadInt");
282
- MarkNativeAsOptional("Protobuf.ReadInt64");
283
- MarkNativeAsOptional("Protobuf.ReadFloat");
284
- MarkNativeAsOptional("Protobuf.ReadBool");
285
- MarkNativeAsOptional("Protobuf.ReadString");
286
- MarkNativeAsOptional("Protobuf.ReadColor");
287
- MarkNativeAsOptional("Protobuf.ReadAngle");
288
- MarkNativeAsOptional("Protobuf.ReadVector");
289
- MarkNativeAsOptional("Protobuf.ReadVector2D");
290
- MarkNativeAsOptional("Protobuf.GetRepeatedFieldCount");
291
- MarkNativeAsOptional("Protobuf.SetInt");
292
- MarkNativeAsOptional("Protobuf.SetInt64");
293
- MarkNativeAsOptional("Protobuf.SetFloat");
294
- MarkNativeAsOptional("Protobuf.SetBool");
295
- MarkNativeAsOptional("Protobuf.SetString");
296
- MarkNativeAsOptional("Protobuf.SetColor");
297
- MarkNativeAsOptional("Protobuf.SetAngle");
298
- MarkNativeAsOptional("Protobuf.SetVector");
299
- MarkNativeAsOptional("Protobuf.SetVector2D");
300
- MarkNativeAsOptional("Protobuf.AddInt");
301
- MarkNativeAsOptional("Protobuf.AddInt64");
302
- MarkNativeAsOptional("Protobuf.AddFloat");
303
- MarkNativeAsOptional("Protobuf.AddBool");
304
- MarkNativeAsOptional("Protobuf.AddString");
305
- MarkNativeAsOptional("Protobuf.AddColor");
306
- MarkNativeAsOptional("Protobuf.AddAngle");
307
- MarkNativeAsOptional("Protobuf.AddVector");
308
- MarkNativeAsOptional("Protobuf.AddVector2D");
309
- MarkNativeAsOptional("Protobuf.RemoveRepeatedFieldValue");
310
- MarkNativeAsOptional("Protobuf.ReadMessage");
311
- MarkNativeAsOptional("Protobuf.ReadRepeatedMessage");
312
- MarkNativeAsOptional("Protobuf.AddMessage");
313
-
314
- VerifyCoreVersion();
315
- }
316
-
317
-
318
- #define AUTOLOAD_EXTENSIONS
319
- #define REQUIRE_EXTENSIONS
320
- #define REQUIRE_PLUGIN
 
1
+ /* Core functions
2
+ *
3
+ * (c) Copyright 1998-2005, ITB CompuPhase
4
+ * This file is provided as is (no warranties).
5
+ */
6
+ #if defined _core_included
7
+ #endinput
8
+ #endif
9
+ #define _core_included
10
+ #pragma library Core
11
+
12
+ native heapspace();
13
+
14
+ native funcidx(const name[]);
15
+
16
+ native numargs();
17
+ native getarg(arg, index=0);
18
+ native setarg(arg, index=0, value);
19
+
20
+ native tolower(c);
21
+ native toupper(c);
22
+ native swapchars(c);
23
+
24
+ native random(max);
25
+
26
+ native min(value1, value2);
27
+ native max(value1, value2);
28
+ native clamp(value, min=cellmin, max=cellmax);
29
+
30
+ native getproperty(id=0, const name[]="", value=cellmin, string[]="");
31
+ native setproperty(id=0, const name[]="", value=cellmin, const string[]="");
32
+ native deleteproperty(id=0, const name[]="", value=cellmin);
33
+ native existproperty(id=0, const name[]="", value=cellmin);