|
ferret99gt@1800
|
1 |
/** |
|
ferret99gt@1800
|
2 |
* vim: set ts=4 : |
|
ferret99gt@1800
|
3 |
* ============================================================================= |
|
ds@1947
|
4 |
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved. |
|
ferret99gt@1800
|
5 |
* ============================================================================= |
|
ferret99gt@1800
|
6 |
* |
|
ferret99gt@1800
|
7 |
* This file is part of the SourceMod/SourcePawn SDK. |
|
ferret99gt@1800
|
8 |
* |
|
ferret99gt@1800
|
9 |
* This program is free software; you can redistribute it and/or modify it under |
|
ferret99gt@1800
|
10 |
* the terms of the GNU General Public License, version 3.0, as published by the |
|
ferret99gt@1800
|
11 |
* Free Software Foundation. |
|
ferret99gt@1800
|
12 |
* |
|
ferret99gt@1800
|
13 |
* This program is distributed in the hope that it will be useful, but WITHOUT |
|
ferret99gt@1800
|
14 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
|
ferret99gt@1800
|
15 |
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
|
ferret99gt@1800
|
16 |
* details. |
|
ferret99gt@1800
|
17 |
* |
|
ferret99gt@1800
|
18 |
* You should have received a copy of the GNU General Public License along with |
|
ferret99gt@1800
|
19 |
* this program. If not, see <http://www.gnu.org/licenses/>. |
|
ferret99gt@1800
|
20 |
* |
|
ferret99gt@1800
|
21 |
* As a special exception, AlliedModders LLC gives you permission to link the |
|
ferret99gt@1800
|
22 |
* code of this program (as well as its derivative works) to "Half-Life 2," the |
|
ferret99gt@1800
|
23 |
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software |
|
ferret99gt@1800
|
24 |
* by the Valve Corporation. You must obey the GNU General Public License in |
|
ferret99gt@1800
|
25 |
* all respects for all other code used. Additionally, AlliedModders LLC grants |
|
ferret99gt@1800
|
26 |
* this exception to all derivative works. AlliedModders LLC defines further |
|
ferret99gt@1800
|
27 |
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007), |
|
ferret99gt@1800
|
28 |
* or <http://www.sourcemod.net/license.php>. |
|
ferret99gt@1800
|
29 |
* |
|
ferret99gt@1800
|
30 |
* Version: $Id$ |
|
ferret99gt@1800
|
31 |
*/ |
|
ferret99gt@1800
|
32 |
|
|
ferret99gt@1800
|
33 |
#if defined _entity_prop_stocks_included |
|
ferret99gt@1800
|
34 |
#endinput |
|
ferret99gt@1800
|
35 |
#endif |
|
ferret99gt@1800
|
36 |
#define _entity_prop_stocks_included |
|
ferret99gt@1800
|
37 |
|
|
dvander@1837
|
38 |
enum MoveType |
|
ferret99gt@1800
|
39 |
{ |
|
dvander@1837
|
40 |
MOVETYPE_NONE = 0, /**< never moves */ |
|
dvander@1837
|
41 |
MOVETYPE_ISOMETRIC, /**< For players */ |
|
dvander@1837
|
42 |
MOVETYPE_WALK, /**< Player only - moving on the ground */ |
|
dvander@1837
|
43 |
MOVETYPE_STEP, /**< gravity, special edge handling -- monsters use this */ |
|
dvander@1837
|
44 |
MOVETYPE_FLY, /**< No gravity, but still collides with stuff */ |
|
dvander@1837
|
45 |
MOVETYPE_FLYGRAVITY, /**< flies through the air + is affected by gravity */ |
|
dvander@1837
|
46 |
MOVETYPE_VPHYSICS, /**< uses VPHYSICS for simulation */ |
|
dvander@1837
|
47 |
MOVETYPE_PUSH, /**< no clip to world, push and crush */ |
|
dvander@1837
|
48 |
MOVETYPE_NOCLIP, /**< No gravity, no collisions, still do velocity/avelocity */ |
|
dvander@1837
|
49 |
MOVETYPE_LADDER, /**< Used by players only when going onto a ladder */ |
|
dvander@1837
|
50 |
MOVETYPE_OBSERVER, /**< Observer movement, depends on player's observer mode */ |
|
dvander@1837
|
51 |
MOVETYPE_CUSTOM, /**< Allows the entity to describe its own physics */ |
|
dvander@1837
|
52 |
}; |
|
dvander@1837
|
53 |
|
|
dvander@1837
|
54 |
enum RenderMode |
|
dvander@1837
|
55 |
{ |
|
dvander@1837
|
56 |
RENDER_NORMAL, /**< src */ |
|
dvander@1837
|
57 |
RENDER_TRANSCOLOR, /**< c*a+dest*(1-a) */ |
|
dvander@1837
|
58 |
RENDER_TRANSTEXTURE, /**< src*a+dest*(1-a) */ |
|
dvander@1837
|
59 |
RENDER_GLOW, /**< src*a+dest -- No Z buffer checks -- Fixed size in screen space */ |
|
dvander@1837
|
60 |
RENDER_TRANSALPHA, /**< src*srca+dest*(1-srca) */ |
|
dvander@1837
|
61 |
RENDER_TRANSADD, /**< src*a+dest */ |
|
dvander@1837
|
62 |
RENDER_ENVIRONMENTAL, /**< not drawn, used for environmental effects */ |
|
dvander@1837
|
63 |
RENDER_TRANSADDFRAMEBLEND, /**< use a fractional frame value to blend between animation frames */ |
|
dvander@1837
|
64 |
RENDER_TRANSALPHAADD, /**< src + dest*(1-a) */ |
|
dvander@1837
|
65 |
RENDER_WORLDGLOW, /**< Same as kRenderGlow but not fixed size in screen space */ |
|
dvander@1837
|
66 |
RENDER_NONE, /**< Don't render. */ |
|
dvander@1837
|
67 |
}; |
|
dvander@1837
|
68 |
|
|
dvander@1837
|
69 |
enum RenderFx |
|
dvander@1837
|
70 |
{ |
|
dvander@1837
|
71 |
RENDERFX_NONE = 0, |
|
dvander@1837
|
72 |
RENDERFX_PULSE_SLOW, |
|
dvander@1837
|
73 |
RENDERFX_PULSE_FAST, |
|
dvander@1837
|
74 |
RENDERFX_PULSE_SLOW_WIDE, |
|
dvander@1837
|
75 |
RENDERFX_PULSE_FAST_WIDE, |
|
dvander@1837
|
76 |
RENDERFX_FADE_SLOW, |
|
dvander@1837
|
77 |
RENDERFX_FADE_FAST, |
|
dvander@1837
|
78 |
RENDERFX_SOLID_SLOW, |
|
dvander@1837
|
79 |
RENDERFX_SOLID_FAST, |
|
dvander@1837
|
80 |
RENDERFX_STROBE_SLOW, |
|
dvander@1837
|
81 |
RENDERFX_STROBE_FAST, |
|
dvander@1837
|
82 |
RENDERFX_STROBE_FASTER, |
|
dvander@1837
|
83 |
RENDERFX_FLICKER_SLOW, |
|
dvander@1837
|
84 |
RENDERFX_FLICKER_FAST, |
|
dvander@1837
|
85 |
RENDERFX_NO_DISSIPATION, |
|
dvander@1837
|
86 |
RENDERFX_DISTORT, /**< Distort/scale/translate flicker */ |
|
dvander@1837
|
87 |
RENDERFX_HOLOGRAM, /**< kRenderFxDistort + distance fade */ |
|
dvander@1837
|
88 |
RENDERFX_EXPLODE, /**< Scale up really big! */ |
|
dvander@1837
|
89 |
RENDERFX_GLOWSHELL, /**< Glowing Shell */ |
|
dvander@1837
|
90 |
RENDERFX_CLAMP_MIN_SCALE, /**< Keep this sprite from getting very small (SPRITES only!) */ |
|
dvander@1837
|
91 |
RENDERFX_ENV_RAIN, /**< for environmental rendermode, make rain */ |
|
dvander@1837
|
92 |
RENDERFX_ENV_SNOW, /**< " " " , make snow */ |
|
dvander@1837
|
93 |
RENDERFX_SPOTLIGHT, /**< TEST CODE for experimental spotlight */ |
|
dvander@1837
|
94 |
RENDERFX_RAGDOLL, /**< HACKHACK: TEST CODE for signalling death of a ragdoll character */ |
|
dvander@1837
|
95 |
RENDERFX_PULSE_FAST_WIDER, |
|
dvander@1837
|
96 |
RENDERFX_MAX |
|
ferret99gt@1800
|
97 |
}; |
|
ferret99gt@1800
|
98 |
|
|
ferret99gt@1845
|
99 |
// These defines are for client button presses. |
|
pred@1826
|
100 |
#define IN_ATTACK (1 << 0) |
|
pred@1826
|
101 |
#define IN_JUMP (1 << 1) |
|
pred@1826
|
102 |
#define IN_DUCK (1 << 2) |
|
pred@1826
|
103 |
#define IN_FORWARD (1 << 3) |
|
pred@1826
|
104 |
#define IN_BACK (1 << 4) |
|
pred@1826
|
105 |
#define IN_USE (1 << 5) |
|
pred@1826
|
106 |
#define IN_CANCEL (1 << 6) |
|
pred@1826
|
107 |
#define IN_LEFT (1 << 7) |
|
pred@1826
|
108 |
#define IN_RIGHT (1 << 8) |
|
pred@1826
|
109 |
#define IN_MOVELEFT (1 << 9) |
|
ferret99gt@1845
|
110 |
#define IN_MOVERIGHT (1 << 10) |
|
pred@1826
|
111 |
#define IN_ATTACK2 (1 << 11) |
|
pred@1826
|
112 |
#define IN_RUN (1 << 12) |
|
pred@1826
|
113 |
#define IN_RELOAD (1 << 13) |
|
pred@1826
|
114 |
#define IN_ALT1 (1 << 14) |
|
pred@1826
|
115 |
#define IN_ALT2 (1 << 15) |
|
ferret99gt@1845
|
116 |
#define IN_SCORE (1 << 16) // Used by client.dll for when scoreboard is held down |
|
pred@1826
|
117 |
#define IN_SPEED (1 << 17) // Player is holding the speed key |
|
pred@1826
|
118 |
#define IN_WALK (1 << 18) // Player holding walk key |
|
pred@1826
|
119 |
#define IN_ZOOM (1 << 19) // Zoom key for HUD zoom |
|
pred@1826
|
120 |
#define IN_WEAPON1 (1 << 20) // weapon defines these bits |
|
pred@1826
|
121 |
#define IN_WEAPON2 (1 << 21) // weapon defines these bits |
|
pred@1826
|
122 |
#define IN_BULLRUSH (1 << 22) |
|
pred@1826
|
123 |
#define IN_GRENADE1 (1 << 23) // grenade 1 |
|
pred@1826
|
124 |
#define IN_GRENADE2 (1 << 24) // grenade 2 |
|
pred@1826
|
125 |
|
|
skamonkey@3220
|
126 |
// Note: these are only for use with GetEntityFlags and SetEntityFlags |
|
skamonkey@3220
|
127 |
// and may not match the game's actual, internal m_fFlags values. |
|
ferret99gt@1845
|
128 |
// PLAYER SPECIFIC FLAGS FIRST BECAUSE WE USE ONLY A FEW BITS OF NETWORK PRECISION |
|
ferret99gt@1845
|
129 |
#define FL_ONGROUND (1 << 0) // At rest / on the ground |
|
ferret99gt@1845
|
130 |
#define FL_DUCKING (1 << 1) // Player flag -- Player is fully crouched |
|
ferret99gt@1845
|
131 |
#define FL_WATERJUMP (1 << 2) // player jumping out of water |
|
ferret99gt@1845
|
132 |
#define FL_ONTRAIN (1 << 3) // Player is _controlling_ a train, so movement commands should be ignored on client during prediction. |
|
ferret99gt@1845
|
133 |
#define FL_INRAIN (1 << 4) // Indicates the entity is standing in rain |
|
ferret99gt@1845
|
134 |
#define FL_FROZEN (1 << 5) // Player is frozen for 3rd person camera |
|
ferret99gt@1845
|
135 |
#define FL_ATCONTROLS (1 << 6) // Player can't move, but keeps key inputs for controlling another entity |
|
ferret99gt@1845
|
136 |
#define FL_CLIENT (1 << 7) // Is a player |
|
ferret99gt@1845
|
137 |
#define FL_FAKECLIENT (1 << 8) // Fake client, simulated server side; don't send network messages to them |
|
ferret99gt@1845
|
138 |
// NOTE if you move things up, make sure to change this value |
|
ferret99gt@1845
|
139 |
#define PLAYER_FLAG_BITS 9 |
|
ferret99gt@1845
|
140 |
// NON-PLAYER SPECIFIC (i.e., not used by GameMovement or the client .dll ) -- Can still be applied to players, though |
|
ferret99gt@1845
|
141 |
#define FL_INWATER (1 << 9) // In water |
|
ferret99gt@1845
|
142 |
#define FL_FLY (1 << 10) // Changes the SV_Movestep() behavior to not need to be on ground |
|
ferret99gt@1845
|
143 |
#define FL_SWIM (1 << 11) // Changes the SV_Movestep() behavior to not need to be on ground (but stay in water) |
|
ferret99gt@1845
|
144 |
#define FL_CONVEYOR (1 << 12) |
|
ferret99gt@1845
|
145 |
#define FL_NPC (1 << 13) |
|
ferret99gt@1845
|
146 |
#define FL_GODMODE (1 << 14) |
|
ferret99gt@1845
|
147 |
#define FL_NOTARGET (1 << 15) |
|
ferret99gt@1845
|
148 |
#define FL_AIMTARGET (1 << 16) // set if the crosshair needs to aim onto the entity |
|
ferret99gt@1845
|
149 |
#define FL_PARTIALGROUND (1 << 17) // not all corners are valid |
|
ferret99gt@1845
|
150 |
#define FL_STATICPROP (1 << 18) // Eetsa static prop! |
|
ferret99gt@1845
|
151 |
#define FL_GRAPHED (1 << 19) // worldgraph has this ent listed as something that blocks a connection |
|
ferret99gt@1845
|
152 |
#define FL_GRENADE (1 << 20) |
|
ferret99gt@1845
|
153 |
#define FL_STEPMOVEMENT (1 << 21) // Changes the SV_Movestep() behavior to not do any processing |
|
ferret99gt@1845
|
154 |
#define FL_DONTTOUCH (1 << 22) // Doesn't generate touch functions, generates Untouch() for anything it was touching when this flag was set |
|
ferret99gt@1845
|
155 |
#define FL_BASEVELOCITY (1 << 23) // Base velocity has been applied this frame (used to convert base velocity into momentum) |
|
ferret99gt@1845
|
156 |
#define FL_WORLDBRUSH (1 << 24) // Not moveable/removeable brush entity (really part of the world, but represented as an entity for transparency or something) |
|
ferret99gt@1845
|
157 |
#define FL_OBJECT (1 << 25) // Terrible name. This is an object that NPCs should see. Missiles, for example. |
|
ferret99gt@1845
|
158 |
#define FL_KILLME (1 << 26) // This entity is marked for death -- will be freed by game DLL |
|
ferret99gt@1845
|
159 |
#define FL_ONFIRE (1 << 27) // You know... |
|
ferret99gt@1845
|
160 |
#define FL_DISSOLVING (1 << 28) // We're dissolving! |
|
ferret99gt@1845
|
161 |
#define FL_TRANSRAGDOLL (1 << 29) // In the process of turning into a client side ragdoll. |
|
ferret99gt@1845
|
162 |
#define FL_UNBLOCKABLE_BY_PLAYER (1 << 30) // pusher that can't be blocked by the player |
|
skamonkey@3220
|
163 |
#define FL_FREEZING (1 << 31) // We're becoming frozen! |
|
skamonkey@3220
|
164 |
#define FL_EP2V_UNKNOWN1 (1 << 31) // Unknown |
|
skamonkey@3220
|
165 |
// END entity flag #defines |
|
ferret99gt@1845
|
166 |
|
|
ferret99gt@1845
|
167 |
/** |
|
ferret99gt@1845
|
168 |
* Get an entity's flags. |
|
ferret99gt@1845
|
169 |
* |
|
skamonkey@3220
|
170 |
* @note The game's actual flags are internally translated by SM |
|
skamonkey@3220
|
171 |
* to match the entity flags defined above as the actual values |
|
skamonkey@3220
|
172 |
* can differ per engine. |
|
skamonkey@3220
|
173 |
* |
|
ferret99gt@1845
|
174 |
* @param entity Entity index. |
|
skamonkey@3220
|
175 |
* @return Entity's flags, see entity flag defines above. |
|
ferret99gt@1845
|
176 |
* @error Invalid entity index, or lack of mod compliance. |
|
ferret99gt@1845
|
177 |
*/ |
|
skamonkey@3220
|
178 |
native GetEntityFlags(entity); |
|
skamonkey@3220
|
179 |
|
|
skamonkey@3220
|
180 |
/** |
|
skamonkey@3220
|
181 |
* Sets an entity's flags. |
|
skamonkey@3220
|
182 |
* |
|
skamonkey@3220
|
183 |
* @note The entity flags as defined above are internally translated by SM |
|
skamonkey@3220
|
184 |
* to match the current game's expected value for the flags as |
|
skamonkey@3220
|
185 |
* the actual values can differ per engine. |
|
skamonkey@3220
|
186 |
* |
|
skamonkey@3220
|
187 |
* @param entity Entity index. |
|
skamonkey@3220
|
188 |
* @param flags Entity flags, see entity flag defines above. |
|
skamonkey@3220
|
189 |
* @noreturn |
|
skamonkey@3220
|
190 |
* @error Invalid entity index, or lack of mod compliance. |
|
skamonkey@3220
|
191 |
*/ |
|
skamonkey@3220
|
192 |
native SetEntityFlags(entity, flags); |
|
ferret99gt@1845
|
193 |
|
|
ds@2583
|
194 |
|
|
ferret99gt@1800
|
195 |
/** |
|
ferret99gt@1820
|
196 |
* Gets an entity's movetype. |
|
ferret99gt@1820
|
197 |
* |
|
dvander@1834
|
198 |
* @param entity Entity index. |
|
dvander@1834
|
199 |
* @return Movetype, see enum above. |
|
dvander@1834
|
200 |
* @error Invalid entity index, or lack of mod compliance. |
|
ferret99gt@1820
|
201 |
*/ |
|
dvander@1837
|
202 |
stock MoveType:GetEntityMoveType(entity) |
|
ferret99gt@1820
|
203 |
{ |
|
ds@2583
|
204 |
static bool:gotconfig = false; |
|
ds@2583
|
205 |
static String:datamap[32]; |
|
ds@2583
|
206 |
|
|
ds@2583
|
207 |
if (!gotconfig) |
|
ds@2583
|
208 |
{ |
|
ds@2583
|
209 |
new Handle:gc = LoadGameConfigFile("core.games"); |
|
ds@2583
|
210 |
new bool:exists = GameConfGetKeyValue(gc, "m_MoveType", datamap, sizeof(datamap)); |
|
ds@2583
|
211 |
CloseHandle(gc); |
|
ds@2583
|
212 |
|
|
ds@2583
|
213 |
if (!exists) |
|
ds@2583
|
214 |
{ |
|
ds@2583
|
215 |
strcopy(datamap, sizeof(datamap), "m_MoveType"); |
|
ds@2583
|
216 |
} |
|
ds@2583
|
217 |
|
|
ds@2583
|
218 |
gotconfig = true; |
|
ds@2583
|
219 |
} |
|
ds@2583
|
220 |
|
|
ds@2583
|
221 |
return MoveType:GetEntProp(entity, Prop_Data, datamap); |
|
ferret99gt@1820
|
222 |
} |
|
ferret99gt@1820
|
223 |
|
|
ferret99gt@1820
|
224 |
/** |
|
ferret99gt@1820
|
225 |
* Sets an entity's movetype. |
|
ferret99gt@1800
|
226 |
* |
|
dvander@1834
|
227 |
* @param entity Entity index. |
|
dvander@1834
|
228 |
* @param mt Movetype, see enum above. |
|
ferret99gt@1800
|
229 |
* @noreturn |
|
dvander@1834
|
230 |
* @error Invalid entity index, or lack of mod compliance. |
|
ferret99gt@1800
|
231 |
*/ |
|
dvander@1837
|
232 |
stock SetEntityMoveType(entity, MoveType:mt) |
|
ferret99gt@1800
|
233 |
{ |
|
ds@2583
|
234 |
static bool:gotconfig = false; |
|
ds@2583
|
235 |
static String:datamap[32]; |
|
ds@2583
|
236 |
|
|
ds@2583
|
237 |
if (!gotconfig) |
|
ds@2583
|
238 |
{ |
|
ds@2583
|
239 |
new Handle:gc = LoadGameConfigFile("core.games"); |
|
ds@2583
|
240 |
new bool:exists = GameConfGetKeyValue(gc, "m_MoveType", datamap, sizeof(datamap)); |
|
ds@2583
|
241 |
CloseHandle(gc); |
|
ds@2583
|
242 |
|
|
ds@2583
|
243 |
if (!exists) |
|
ds@2583
|
244 |
{ |
|
ds@2583
|
245 |
strcopy(datamap, sizeof(datamap), "m_MoveType"); |
|
ds@2583
|
246 |
} |
|
ds@2583
|
247 |
|
|
ds@2583
|
248 |
gotconfig = true; |
|
ds@2583
|
249 |
} |
|
ds@2583
|
250 |
|
|
ds@2583
|
251 |
SetEntProp(entity, Prop_Data, datamap, mt); |
|
ferret99gt@1800
|
252 |
} |
|
ferret99gt@1800
|
253 |
|
|
ferret99gt@1800
|
254 |
/** |
|
dvander@1837
|
255 |
* Gets an entity's render mode. |
|
dvander@1837
|
256 |
* |
|
dvander@1837
|
257 |
* @param entity Entity index. |
|
dvander@1837
|
258 |
* @return RenderMode value. |
|
dvander@1837
|
259 |
* @error Invalid entity index, or lack of mod compliance. |
|
dvander@1837
|
260 |
*/ |
|
dvander@1837
|
261 |
stock RenderMode:GetEntityRenderMode(entity) |
|
dvander@1837
|
262 |
{ |
|
ds@2583
|
263 |
static bool:gotconfig = false; |
|
ds@2583
|
264 |
static String:prop[32]; |
|
ds@2583
|
265 |
|
|
ds@2583
|
266 |
if (!gotconfig) |
|
ds@2583
|
267 |
{ |
|
ds@2583
|
268 |
new Handle:gc = LoadGameConfigFile("core.games"); |
|
ds@2583
|
269 |
new bool:exists = GameConfGetKeyValue(gc, "m_nRenderMode", prop, sizeof(prop)); |
|
ds@2583
|
270 |
CloseHandle(gc); |
|
ds@2583
|
271 |
|
|
ds@2583
|
272 |
if (!exists) |
|
ds@2583
|
273 |
{ |
|
ds@2583
|
274 |
strcopy(prop, sizeof(prop), "m_nRenderMode"); |
|
ds@2583
|
275 |
} |
|
ds@2583
|
276 |
|
|
ds@2583
|
277 |
gotconfig = true; |
|
ds@2583
|
278 |
} |
|
ds@2583
|
279 |
|
|
ds@2583
|
280 |
return RenderMode:GetEntProp(entity, Prop_Send, prop, 1); |
|
dvander@1837
|
281 |
} |
|
dvander@1837
|
282 |
|
|
dvander@1837
|
283 |
/** |
|
dvander@1837
|
284 |
* Sets an entity's render mode. |
|
dvander@1837
|
285 |
* |
|
dvander@1837
|
286 |
* @param entity Entity index. |
|
dvander@1837
|
287 |
* @param mode RenderMode value. |
|
dvander@1837
|
288 |
* @noreturn |
|
dvander@1837
|
289 |
* @error Invalid entity index, or lack of mod compliance. |
|
dvander@1837
|
290 |
*/ |
|
dvander@1837
|
291 |
stock SetEntityRenderMode(entity, RenderMode:mode) |
|
dvander@1837
|
292 |
{ |
|
ds@2583
|
293 |
static bool:gotconfig = false; |
|
ds@2583
|
294 |
static String:prop[32]; |
|
ds@2583
|
295 |
|
|
ds@2583
|
296 |
if (!gotconfig) |
|
ds@2583
|
297 |
{ |
|
ds@2583
|
298 |
new Handle:gc = LoadGameConfigFile("core.games"); |
|
ds@2583
|
299 |
new bool:exists = GameConfGetKeyValue(gc, "m_nRenderMode", prop, sizeof(prop)); |
|
ds@2583
|
300 |
CloseHandle(gc); |
|
ds@2583
|
301 |
|
|
ds@2583
|
302 |
if (!exists) |
|
ds@2583
|
303 |
{ |
|
ds@2583
|
304 |
strcopy(prop, sizeof(prop), "m_nRenderMode"); |
|
ds@2583
|
305 |
} |
|
ds@2583
|
306 |
|
|
ds@2583
|
307 |
gotconfig = true; |
|
ds@2583
|
308 |
} |
|
ds@2583
|
309 |
|
|
ds@2583
|
310 |
SetEntProp(entity, Prop_Send, prop, mode, 1); |
|
dvander@1837
|
311 |
} |
|
dvander@1837
|
312 |
|
|
dvander@1837
|
313 |
/** |
|
dvander@1837
|
314 |
* Gets an entity's render Fx. |
|
dvander@1837
|
315 |
* |
|
dvander@1837
|
316 |
* @param entity Entity index. |
|
dvander@1837
|
317 |
* @return RenderFx value. |
|
dvander@1837
|
318 |
* @error Invalid entity index, or lack of mod compliance. |
|
dvander@1837
|
319 |
*/ |
|
dvander@1837
|
320 |
stock RenderFx:GetEntityRenderFx(entity) |
|
dvander@1837
|
321 |
{ |
|
ds@2583
|
322 |
static bool:gotconfig = false; |
|
ds@2583
|
323 |
static String:prop[32]; |
|
ds@2583
|
324 |
|
|
ds@2583
|
325 |
if (!gotconfig) |
|
ds@2583
|
326 |
{ |
|
ds@2583
|
327 |
new Handle:gc = LoadGameConfigFile("core.games"); |
|
ds@2583
|
328 |
new bool:exists = GameConfGetKeyValue(gc, "m_nRenderFX", prop, sizeof(prop)); |
|
ds@2583
|
329 |
CloseHandle(gc); |
|
ds@2583
|
330 |
|
|
ds@2583
|
331 |
if (!exists) |
|
ds@2583
|
332 |
{ |
|
ds@2583
|
333 |
strcopy(prop, sizeof(prop), "m_nRenderFX"); |
|
ds@2583
|
334 |
} |
|
ds@2583
|
335 |
|
|
ds@2583
|
336 |
gotconfig = true; |
|
ds@2583
|
337 |
} |
|
ds@2583
|
338 |
|
|
ds@2583
|
339 |
return RenderFx:GetEntProp(entity, Prop_Send, prop, 1); |
|
dvander@1837
|
340 |
} |
|
dvander@1837
|
341 |
|
|
dvander@1837
|
342 |
/** |
|
dvander@1837
|
343 |
* Sets an entity's render Fx. |
|
dvander@1837
|
344 |
* |
|
dvander@1837
|
345 |
* @param entity Entity index. |
|
dvander@1837
|
346 |
* @param fx RenderFx value. |
|
dvander@1837
|
347 |
* @noreturn |
|
dvander@1837
|
348 |
* @error Invalid entity index, or lack of mod compliance. |
|
dvander@1837
|
349 |
*/ |
|
dvander@1837
|
350 |
stock SetEntityRenderFx(entity, RenderFx:fx) |
|
dvander@1837
|
351 |
{ |
|
ds@2583
|
352 |
static bool:gotconfig = false; |
|
ds@2583
|
353 |
static String:prop[32]; |
|
ds@2583
|
354 |
|
|
ds@2583
|
355 |
if (!gotconfig) |
|
ds@2583
|
356 |
{ |
|
ds@2583
|
357 |
new Handle:gc = LoadGameConfigFile("core.games"); |
|
ds@2583
|
358 |
new bool:exists = GameConfGetKeyValue(gc, "m_nRenderFX", prop, sizeof(prop)); |
|
ds@2583
|
359 |
CloseHandle(gc); |
|
ds@2583
|
360 |
|
|
ds@2583
|
361 |
if (!exists) |
|
ds@2583
|
362 |
{ |
|
ds@2583
|
363 |
strcopy(prop, sizeof(prop), "m_nRenderFX"); |
|
ds@2583
|
364 |
} |
|
ds@2583
|
365 |
|
|
ds@2583
|
366 |
gotconfig = true; |
|
ds@2583
|
367 |
} |
|
ds@2583
|
368 |
|
|
ds@2583
|
369 |
SetEntProp(entity, Prop_Send, prop, fx, 1); |
|
dvander@1837
|
370 |
} |
|
dvander@1837
|
371 |
|
|
dvander@1837
|
372 |
/** |
|
ferret99gt@1800
|
373 |
* Sets an entity's color. |
|
ferret99gt@1800
|
374 |
* |
|
dvander@1834
|
375 |
* @param entity Entity index |
|
ferret99gt@1800
|
376 |
* @param r Amount of red (0-255) |
|
ferret99gt@1800
|
377 |
* @param g Amount of green (0-255) |
|
ferret99gt@1800
|
378 |
* @param b Amount of blue (0-255) |
|
ferret99gt@1800
|
379 |
* @param a Amount of alpha (0-255) |
|
ferret99gt@1800
|
380 |
* @noreturn |
|
dvander@1834
|
381 |
* @error Invalid entity index, or lack of mod compliance. |
|
ferret99gt@1800
|
382 |
*/ |
|
dvander@1834
|
383 |
stock SetEntityRenderColor(entity, r=255, g=255, b=255, a=255) |
|
ferret99gt@1800
|
384 |
{ |
|
ds@2583
|
385 |
static bool:gotconfig = false; |
|
ds@2583
|
386 |
static String:prop[32]; |
|
ds@2583
|
387 |
|
|
ds@2583
|
388 |
if (!gotconfig) |
|
ds@2583
|
389 |
{ |
|
ds@2583
|
390 |
new Handle:gc = LoadGameConfigFile("core.games"); |
|
ds@2583
|
391 |
new bool:exists = GameConfGetKeyValue(gc, "m_clrRender", prop, sizeof(prop)); |
|
ds@2583
|
392 |
CloseHandle(gc); |
|
ds@2583
|
393 |
|
|
ds@2583
|
394 |
if (!exists) |
|
ds@2583
|
395 |
{ |
|
ds@2583
|
396 |
strcopy(prop, sizeof(prop), "m_clrRender"); |
|
ds@2583
|
397 |
} |
|
ds@2583
|
398 |
|
|
ds@2583
|
399 |
gotconfig = true; |
|
ds@2583
|
400 |
} |
|
ds@2583
|
401 |
|
|
ds@2583
|
402 |
new offset = GetEntSendPropOffs(entity, prop); |
|
ds@2583
|
403 |
|
|
ds@2583
|
404 |
if (offset <= 0) |
|
ds@2583
|
405 |
{ |
|
ds@2583
|
406 |
ThrowError("SetEntityRenderColor not supported by this mod"); |
|
ds@2583
|
407 |
} |
|
ds@2583
|
408 |
|
|
dvander@1834
|
409 |
SetEntData(entity, offset, r, 1, true); |
|
dvander@1834
|
410 |
SetEntData(entity, offset + 1, g, 1, true); |
|
dvander@1834
|
411 |
SetEntData(entity, offset + 2, b, 1, true); |
|
dvander@1834
|
412 |
SetEntData(entity, offset + 3, a, 1, true); |
|
ferret99gt@1820
|
413 |
} |
|
ferret99gt@1820
|
414 |
|
|
ferret99gt@1820
|
415 |
/** |
|
ferret99gt@1820
|
416 |
* Gets an entity's gravity. |
|
ferret99gt@1820
|
417 |
* |
|
dvander@1834
|
418 |
* @param entity Entity index. |
|
dvander@1834
|
419 |
* @return Entity's m_flGravity value. |
|
dvander@1834
|
420 |
* @error Invalid entity index, or lack of mod compliance. |
|
ferret99gt@1820
|
421 |
*/ |
|
dvander@1834
|
422 |
stock Float:GetEntityGravity(entity) |
|
ferret99gt@1820
|
423 |
{ |
|
ds@2583
|
424 |
static bool:gotconfig = false; |
|
ds@2583
|
425 |
static String:datamap[32]; |
|
ds@2583
|
426 |
|
|
ds@2583
|
427 |
if (!gotconfig) |
|
ds@2583
|
428 |
{ |
|
ds@2583
|
429 |
new Handle:gc = LoadGameConfigFile("core.games"); |
|
ds@2583
|
430 |
new bool:exists = GameConfGetKeyValue(gc, "m_flGravity", datamap, sizeof(datamap)); |
|
ds@2583
|
431 |
CloseHandle(gc); |
|
ds@2583
|
432 |
|
|
ds@2583
|
433 |
if (!exists) |
|
ds@2583
|
434 |
{ |
|
ds@2583
|
435 |
strcopy(datamap, sizeof(datamap), "m_flGravity"); |
|
ds@2583
|
436 |
} |
|
ds@2583
|
437 |
|
|
ds@2583
|
438 |
gotconfig = true; |
|
ds@2583
|
439 |
} |
|
ds@2583
|
440 |
|
|
ds@2583
|
441 |
return GetEntPropFloat(entity, Prop_Data, datamap); |
|
ferret99gt@1820
|
442 |
} |
|
ferret99gt@1820
|
443 |
|
|
ferret99gt@1820
|
444 |
/** |
|
ferret99gt@1820
|
445 |
* Sets an entity's gravity. |
|
ferret99gt@1820
|
446 |
* |
|
dvander@1834
|
447 |
* @param entity Entity index. |
|
ferret99gt@1845
|
448 |
* @param amount Gravity to set (default = 1.0, half = 0.5, double = 2.0). |
|
ferret99gt@1820
|
449 |
* @noreturn |
|
dvander@1834
|
450 |
* @error Invalid entity index, or lack of mod compliance. |
|
ferret99gt@1820
|
451 |
*/ |
|
dvander@1834
|
452 |
stock SetEntityGravity(entity, Float:amount) |
|
ferret99gt@1820
|
453 |
{ |
|
ds@2583
|
454 |
static bool:gotconfig = false; |
|
ds@2583
|
455 |
static String:datamap[32]; |
|
ds@2583
|
456 |
|
|
ds@2583
|
457 |
if (!gotconfig) |
|
ds@2583
|
458 |
{ |
|
ds@2583
|
459 |
new Handle:gc = LoadGameConfigFile("core.games"); |
|
ds@2583
|
460 |
new bool:exists = GameConfGetKeyValue(gc, "m_flGravity", datamap, sizeof(datamap)); |
|
ds@2583
|
461 |
CloseHandle(gc); |
|
ds@2583
|
462 |
|
|
ds@2583
|
463 |
if (!exists) |
|
ds@2583
|
464 |
{ |
|
ds@2583
|
465 |
strcopy(datamap, sizeof(datamap), "m_flGravity"); |
|
ds@2583
|
466 |
} |
|
ds@2583
|
467 |
|
|
ds@2583
|
468 |
gotconfig = true; |
|
ds@2583
|
469 |
} |
|
ds@2583
|
470 |
|
|
ds@2583
|
471 |
SetEntPropFloat(entity, Prop_Data, datamap, amount); |
|
ferret99gt@1820
|
472 |
} |
|
ferret99gt@1820
|
473 |
|
|
ferret99gt@1820
|
474 |
/** |
|
ferret99gt@1820
|
475 |
* Sets an entity's health |
|
ferret99gt@1820
|
476 |
* |
|
dvander@1834
|
477 |
* @param entity Entity index. |
|
dvander@1834
|
478 |
* @param amount Health amount. |
|
ferret99gt@1820
|
479 |
* @noreturn |
|
dvander@1834
|
480 |
* @error Invalid entity index, or lack of mod compliance. |
|
ferret99gt@1820
|
481 |
*/ |
|
dvander@1834
|
482 |
stock SetEntityHealth(entity, amount) |
|
ferret99gt@1820
|
483 |
{ |
|
ds@2583
|
484 |
static bool:gotconfig = false; |
|
ds@2583
|
485 |
static String:prop[32]; |
|
ds@2583
|
486 |
|
|
ds@2583
|
487 |
if (!gotconfig) |
|
ds@2583
|
488 |
{ |
|
ds@2583
|
489 |
new Handle:gc = LoadGameConfigFile("core.games"); |
|
ds@2583
|
490 |
new bool:exists = GameConfGetKeyValue(gc, "m_iHealth", prop, sizeof(prop)); |
|
ds@2583
|
491 |
CloseHandle(gc); |
|
ds@2583
|
492 |
|
|
ds@2583
|
493 |
if (!exists) |
|
ds@2583
|
494 |
{ |
|
fyrenmoo@2659
|
495 |
strcopy(prop, sizeof(prop), "m_iHealth"); |
|
ds@2583
|
496 |
} |
|
ds@2583
|
497 |
|
|
ds@2583
|
498 |
gotconfig = true; |
|
ds@2583
|
499 |
} |
|
ds@2583
|
500 |
|
|
ds@2583
|
501 |
decl String:cls[64]; |
|
ds@2583
|
502 |
new PropFieldType:type; |
|
ds@2583
|
503 |
new offset; |
|
ds@2583
|
504 |
|
|
dvander@2646
|
505 |
if (!GetEntityNetClass(entity, cls, sizeof(cls))) |
|
ds@2583
|
506 |
{ |
|
ds@2583
|
507 |
ThrowError("SetEntityHealth not supported by this mod: Could not get serverclass name"); |
|
ds@2583
|
508 |
return; |
|
ds@2583
|
509 |
} |
|
ds@2583
|
510 |
|
|
ds@2583
|
511 |
offset = FindSendPropInfo(cls, prop, type); |
|
ds@2583
|
512 |
|
|
ds@2583
|
513 |
if (offset <= 0) |
|
ds@2583
|
514 |
{ |
|
ds@2583
|
515 |
ThrowError("SetEntityHealth not supported by this mod"); |
|
ds@2583
|
516 |
return; |
|
ds@2583
|
517 |
} |
|
ds@2583
|
518 |
|
|
ds@2583
|
519 |
/* Dark Messiah uses a float for the health instead an integer */ |
|
ds@2583
|
520 |
if (type == PropField_Float) |
|
ds@2583
|
521 |
{ |
|
ds@2583
|
522 |
SetEntDataFloat(entity, offset, float(amount)); |
|
ds@2583
|
523 |
} |
|
ds@2583
|
524 |
else |
|
ds@2583
|
525 |
{ |
|
dvander@2646
|
526 |
SetEntProp(entity, Prop_Send, prop, amount); |
|
ds@2583
|
527 |
} |
|
pred@1826
|
528 |
} |
|
pred@1826
|
529 |
|
|
pred@1826
|
530 |
/** |
|
pred@1826
|
531 |
* Get's a users current pressed buttons |
|
pred@1826
|
532 |
* |
|
pred@1826
|
533 |
* @param client Client index |
|
pred@1826
|
534 |
* @return Bitsum of buttons |
|
dvander@1834
|
535 |
* @error Invalid client index, client not in game, |
|
dvander@1834
|
536 |
* or lack of mod compliance. |
|
pred@1826
|
537 |
*/ |
|
pred@1826
|
538 |
stock GetClientButtons(client) |
|
pred@1826
|
539 |
{ |
|
ds@2583
|
540 |
static bool:gotconfig = false; |
|
ds@2583
|
541 |
static String:datamap[32]; |
|
ds@2583
|
542 |
|
|
ds@2583
|
543 |
if (!gotconfig) |
|
ds@2583
|
544 |
{ |
|
ds@2583
|
545 |
new Handle:gc = LoadGameConfigFile("core.games"); |
|
ds@2583
|
546 |
new bool:exists = GameConfGetKeyValue(gc, "m_nButtons", datamap, sizeof(datamap)); |
|
ds@2583
|
547 |
CloseHandle(gc); |
|
ds@2583
|
548 |
|
|
ds@2583
|
549 |
if (!exists) |
|
ds@2583
|
550 |
{ |
|
ds@2583
|
551 |
strcopy(datamap, sizeof(datamap), "m_nButtons"); |
|
ds@2583
|
552 |
} |
|
ds@2583
|
553 |
|
|
ds@2583
|
554 |
gotconfig = true; |
|
ds@2583
|
555 |
} |
|
ds@2583
|
556 |
|
|
ds@2583
|
557 |
return GetEntProp(client, Prop_Data, datamap); |
|
dvander@1834
|
558 |
} |