Merge from 1.2 branch.
3 * =============================================================================
4 * SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
5 * =============================================================================
7 * This file is part of the SourceMod/SourcePawn SDK.
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.
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
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/>.
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>.
33 #if defined _te_stocks_included
36 #define _te_stocks_included
39 * @section TE Explosion flags.
41 #define TE_EXPLFLAG_NONE 0x0 /**< all flags clear makes default Half-Life explosion */
42 #define TE_EXPLFLAG_NOADDITIVE 0x1 /**< sprite will be drawn opaque (ensure that the sprite you send is a non-additive sprite) */
43 #define TE_EXPLFLAG_NODLIGHTS 0x2 /**< do not render dynamic lights */
44 #define TE_EXPLFLAG_NOSOUND 0x4 /**< do not play client explosion sound */
45 #define TE_EXPLFLAG_NOPARTICLES 0x8 /**< do not draw particles */
46 #define TE_EXPLFLAG_DRAWALPHA 0x10 /**< sprite will be drawn alpha */
47 #define TE_EXPLFLAG_ROTATE 0x20 /**< rotate the sprite randomly */
48 #define TE_EXPLFLAG_NOFIREBALL 0x40 /**< do not draw a fireball */
49 #define TE_EXPLFLAG_NOFIREBALLSMOKE 0x80 /**< do not draw smoke with the fireball */
56 * @section TE Beam flags.
58 #define FBEAM_STARTENTITY 0x00000001
59 #define FBEAM_ENDENTITY 0x00000002
60 #define FBEAM_FADEIN 0x00000004
61 #define FBEAM_FADEOUT 0x00000008
62 #define FBEAM_SINENOISE 0x00000010
63 #define FBEAM_SOLID 0x00000020
64 #define FBEAM_SHADEIN 0x00000040
65 #define FBEAM_SHADEOUT 0x00000080
66 #define FBEAM_ONLYNOISEONCE 0x00000100 /**< Only calculate our noise once */
67 #define FBEAM_NOTILE 0x00000200
68 #define FBEAM_USE_HITBOXES 0x00000400 /**< Attachment indices represent hitbox indices instead when this is set. */
69 #define FBEAM_STARTVISIBLE 0x00000800 /**< Has this client actually seen this beam's start entity yet? */
70 #define FBEAM_ENDVISIBLE 0x00001000 /**< Has this client actually seen this beam's end entity yet? */
71 #define FBEAM_ISACTIVE 0x00002000
72 #define FBEAM_FOREVER 0x00004000
73 #define FBEAM_HALOBEAM 0x00008000 /**< When drawing a beam with a halo, don't ignore the segments and endwidth */
80 * Sets up a sparks effect.
82 * @param pos Position of the sparks.
83 * @param dir Direction of the sparks.
84 * @param Magnitude Sparks size.
85 * @param TrailLength Trail lenght of the sparks.
88 stock TE_SetupSparks(const Float:pos[3], const Float:dir[3], Magnitude, TrailLength)
91 TE_WriteVector("m_vecOrigin[0]", pos);
92 TE_WriteVector("m_vecDir", dir);
93 TE_WriteNum("m_nMagnitude", Magnitude);
94 TE_WriteNum("m_nTrailLength", TrailLength);
98 * Sets up a smoke effect.
100 * @param pos Position of the smoke.
101 * @param Model Precached model index.
102 * @param Scale Scale of the smoke.
103 * @param Framerate Frame rate of the smoke.
106 stock TE_SetupSmoke(const Float:pos[3], Model, Float:Scale, FrameRate)
109 TE_WriteVector("m_vecOrigin", pos);
110 TE_WriteNum("m_nModelIndex", Model);
111 TE_WriteFloat("m_fScale", Scale);
112 TE_WriteNum("m_nFrameRate", FrameRate);
116 * Sets up a dust cloud effect.
118 * @param pos Position of the dust.
119 * @param dir Direction of the dust.
120 * @param Size Dust cloud size.
121 * @param Speed Dust cloud speed.
124 stock TE_SetupDust(const Float:pos[3], const Float:dir[3], Float:Size, Float:Speed)
127 TE_WriteVector("m_vecOrigin[0]", pos);
128 TE_WriteVector("m_vecDirection", dir);
129 TE_WriteFloat("m_flSize", Size);
130 TE_WriteFloat("m_flSpeed", Speed);
134 * Sets up a muzzle flash effect.
136 * @param pos Position of the muzzle flash.
137 * @param angles Rotation angles of the muzzle flash.
138 * @param Scale Scale of the muzzle flash.
139 * @param Type Muzzle flash type to render (Mod specific).
142 stock TE_SetupMuzzleFlash(const Float:pos[3], const Float:angles[3], Float:Scale, Type)
144 TE_Start("MuzzleFlash");
145 TE_WriteVector("m_vecOrigin", pos);
146 TE_WriteVector("m_vecAngles", angles);
147 TE_WriteFloat("m_flScale", Scale);
148 TE_WriteNum("m_nType", Type);
152 * Sets up a metal sparks effect.
154 * @param pos Position of the metal sparks.
155 * @param dir Direction of the metal sparks.
158 stock TE_SetupMetalSparks(const Float:pos[3], const Float:dir[3])
160 TE_Start("Metal Sparks");
161 TE_WriteVector("m_vecPos", pos);
162 TE_WriteVector("m_vecDir", dir);
166 * Sets up an energy splash effect.
168 * @param pos Position of the energy splash.
169 * @param dir Direction of the energy splash.
170 * @param Explosive Makes the effect explosive.
173 stock TE_SetupEnergySplash(const Float:pos[3], const Float:dir[3], bool:Explosive)
175 TE_Start("Energy Splash");
176 TE_WriteVector("m_vecPos", pos);
177 TE_WriteVector("m_vecDir", dir);
178 TE_WriteNum("m_bExplosive", Explosive);
182 * Sets up an armor ricochet effect.
184 * @param pos Position of the armor ricochet.
185 * @param dir Directon of the armor ricochet.
188 stock TE_SetupArmorRicochet(const Float:pos[3], const Float:dir[3])
190 TE_Start("Armor Ricochet");
191 TE_WriteVector("m_vecPos", pos);
192 TE_WriteVector("m_vecDir", dir);
196 * Sets up a glowing sprite effect.
198 * @param pos Position of the sprite.
199 * @param Model Precached model index.
200 * @param Life Time duration of the sprite.
201 * @param Size Sprite size.
202 * @param Brightness Sprite brightness.
205 stock TE_SetupGlowSprite(const Float:pos[3], Model, Float:Life, Float:Size, Brightness)
207 TE_Start("GlowSprite");
208 TE_WriteVector("m_vecOrigin", pos);
209 TE_WriteNum("m_nModelIndex", Model);
210 TE_WriteFloat("m_fScale", Size);
211 TE_WriteFloat("m_fLife", Life);
212 TE_WriteNum("m_nBrightness", Brightness);
216 * Sets up a explosion effect.
218 * @param pos Explosion position.
219 * @param Model Precached model index.
220 * @param Scale Explosion scale.
221 * @param Framerate Explosion frame rate.
222 * @param Flags Explosion flags.
223 * @param Radius Explosion radius.
224 * @param Magnitude Explosion size.
225 * @param normal Normal vector to the explosion.
226 * @param MaterialType Exploded material type.
229 stock TE_SetupExplosion(const Float:pos[3], Model, Float:Scale, Framerate, Flags, Radius, Magnitude, const Float:normal[3]={0.0, 0.0, 1.0}, MaterialType='C')
231 TE_Start("Explosion");
232 TE_WriteVector("m_vecOrigin[0]", pos);
233 TE_WriteVector("m_vecNormal", normal);
234 TE_WriteNum("m_nModelIndex", Model);
235 TE_WriteFloat("m_fScale", Scale);
236 TE_WriteNum("m_nFrameRate", Framerate);
237 TE_WriteNum("m_nFlags", Flags);
238 TE_WriteNum("m_nRadius", Radius);
239 TE_WriteNum("m_nMagnitude", Magnitude);
240 TE_WriteNum("m_chMaterialType", MaterialType);
244 * Sets up a blood sprite effect.
246 * @param pos Position of the sprite.
247 * @param dir Sprite direction.
248 * @param color Color array (r, g, b, a).
249 * @param Size Sprite size.
250 * @param SprayModel Precached model index.
251 * @param BloodDropModel Precached model index.
254 stock TE_SetupBloodSprite(const Float:pos[3], const Float:dir[3], const color[4], Size, SprayModel, BloodDropModel)
256 TE_Start("Blood Sprite");
257 TE_WriteVector("m_vecOrigin", pos);
258 TE_WriteVector("m_vecDirection", dir);
259 TE_WriteNum("r", color[0]);
260 TE_WriteNum("g", color[1]);
261 TE_WriteNum("b", color[2]);
262 TE_WriteNum("a", color[3]);
263 TE_WriteNum("m_nSize", Size);
264 TE_WriteNum("m_nSprayModel", SprayModel);
265 TE_WriteNum("m_nDropModel", BloodDropModel);
269 * Sets up a beam ring point effect.
271 * @param center Center position of the ring.
272 * @param Start_Radius Initial ring radius.
273 * @param End_Radius Final ring radius.
274 * @param ModelIndex Precached model index.
275 * @param HaloIndex Precached model index.
276 * @param StartFrame Initital frame to render.
277 * @param FrameRate Ring frame rate.
278 * @param Life Time duration of the ring.
279 * @param Width Beam width.
280 * @param Amplitude Beam amplitude.
281 * @param color Color array (r, g, b, a).
282 * @param Speed Speed of the beam.
283 * @param Flags Beam flags.
286 stock TE_SetupBeamRingPoint(const Float:center[3], Float:Start_Radius, Float:End_Radius, ModelIndex, HaloIndex, StartFrame,
287 FrameRate, Float:Life, Float:Width, Float:Amplitude, const Color[4], Speed, Flags)
289 TE_Start("BeamRingPoint");
290 TE_WriteVector("m_vecCenter", center);
291 TE_WriteFloat("m_flStartRadius", Start_Radius);
292 TE_WriteFloat("m_flEndRadius", End_Radius);
293 TE_WriteNum("m_nModelIndex", ModelIndex);
294 TE_WriteNum("m_nHaloIndex", HaloIndex);
295 TE_WriteNum("m_nStartFrame", StartFrame);
296 TE_WriteNum("m_nFrameRate", FrameRate);
297 TE_WriteFloat("m_fLife", Life);
298 TE_WriteFloat("m_fWidth", Width);
299 TE_WriteFloat("m_fEndWidth", Width);
300 TE_WriteFloat("m_fAmplitude", Amplitude);
301 TE_WriteNum("r", Color[0]);
302 TE_WriteNum("g", Color[1]);
303 TE_WriteNum("b", Color[2]);
304 TE_WriteNum("a", Color[3]);
305 TE_WriteNum("m_nSpeed", Speed);
306 TE_WriteNum("m_nFlags", Flags);
307 TE_WriteNum("m_nFadeLength", 0);
311 * Sets up a point to point beam effect.
313 * @param start Start position of the beam.
314 * @param end End position of the beam.
315 * @param ModelIndex Precached model index.
316 * @param HaloIndex Precached model index.
317 * @param StartFrame Initital frame to render.
318 * @param FrameRate Beam frame rate.
319 * @param Life Time duration of the beam.
320 * @param Width Initial beam width.
321 * @param EndWidth Final beam width.
322 * @param FadeLength Beam fade time duration.
323 * @param Amplitude Beam amplitude.
324 * @param color Color array (r, g, b, a).
325 * @param Speed Speed of the beam.
328 stock TE_SetupBeamPoints(const Float:start[3], const Float:end[3], ModelIndex, HaloIndex, StartFrame, FrameRate, Float:Life,
329 Float:Width, Float:EndWidth, FadeLength, Float:Amplitude, const Color[4], Speed)
331 TE_Start("BeamPoints");
332 TE_WriteVector("m_vecStartPoint", start);
333 TE_WriteVector("m_vecEndPoint", end);
334 TE_WriteNum("m_nModelIndex", ModelIndex);
335 TE_WriteNum("m_nHaloIndex", HaloIndex);
336 TE_WriteNum("m_nStartFrame", StartFrame);
337 TE_WriteNum("m_nFrameRate", FrameRate);
338 TE_WriteFloat("m_fLife", Life);
339 TE_WriteFloat("m_fWidth", Width);
340 TE_WriteFloat("m_fEndWidth", EndWidth);
341 TE_WriteFloat("m_fAmplitude", Amplitude);
342 TE_WriteNum("r", Color[0]);
343 TE_WriteNum("g", Color[1]);
344 TE_WriteNum("b", Color[2]);
345 TE_WriteNum("a", Color[3]);
346 TE_WriteNum("m_nSpeed", Speed);
347 TE_WriteNum("m_nFadeLength", FadeLength);
351 * Sets up an entity to entity laser effect.
353 * @param StartEntity Entity index from where the beam starts.
354 * @param EndEntity Entity index from where the beam ends.
355 * @param ModelIndex Precached model index.
356 * @param HaloIndex Precached model index.
357 * @param StartFrame Initital frame to render.
358 * @param FrameRate Beam frame rate.
359 * @param Life Time duration of the beam.
360 * @param Width Initial beam width.
361 * @param EndWidth Final beam width.
362 * @param FadeLength Beam fade time duration.
363 * @param Amplitude Beam amplitude.
364 * @param color Color array (r, g, b, a).
365 * @param Speed Speed of the beam.
368 stock TE_SetupBeamLaser(StartEntity, EndEntity, ModelIndex, HaloIndex, StartFrame, FrameRate, Float:Life,
369 Float:Width, Float:EndWidth, FadeLength, Float:Amplitude, const Color[4], Speed)
371 TE_Start("BeamLaser");
372 TE_WriteEncodedEnt("m_nStartEntity", StartEntity);
373 TE_WriteEncodedEnt("m_nEndEntity", EndEntity);
374 TE_WriteNum("m_nModelIndex", ModelIndex);
375 TE_WriteNum("m_nHaloIndex", HaloIndex);
376 TE_WriteNum("m_nStartFrame", StartFrame);
377 TE_WriteNum("m_nFrameRate", FrameRate);
378 TE_WriteFloat("m_fLife", Life);
379 TE_WriteFloat("m_fWidth", Width);
380 TE_WriteFloat("m_fEndWidth", EndWidth);
381 TE_WriteFloat("m_fAmplitude", Amplitude);
382 TE_WriteNum("r", Color[0]);
383 TE_WriteNum("g", Color[1]);
384 TE_WriteNum("b", Color[2]);
385 TE_WriteNum("a", Color[3]);
386 TE_WriteNum("m_nSpeed", Speed);
387 TE_WriteNum("m_nFadeLength", FadeLength);
391 * Sets up a beam ring effect.
393 * @param StartEntity Entity index from where the ring starts.
394 * @param EndEntity Entity index from where the ring ends.
395 * @param ModelIndex Precached model index.
396 * @param HaloIndex Precached model index.
397 * @param StartFrame Initital frame to render.
398 * @param FrameRate Ring frame rate.
399 * @param Life Time duration of the ring.
400 * @param Width Beam width.
401 * @param Amplitude Beam amplitude.
402 * @param color Color array (r, g, b, a).
403 * @param Speed Speed of the beam.
404 * @param Flags Beam flags.
407 stock TE_SetupBeamRing(StartEntity, EndEntity, ModelIndex, HaloIndex, StartFrame, FrameRate, Float:Life, Float:Width, Float:Amplitude, const Color[4], Speed, Flags)
409 TE_Start("BeamRing");
410 TE_WriteEncodedEnt("m_nStartEntity", StartEntity);
411 TE_WriteEncodedEnt("m_nEndEntity", EndEntity);
412 TE_WriteNum("m_nModelIndex", ModelIndex);
413 TE_WriteNum("m_nHaloIndex", HaloIndex);
414 TE_WriteNum("m_nStartFrame", StartFrame);
415 TE_WriteNum("m_nFrameRate", FrameRate);
416 TE_WriteFloat("m_fLife", Life);
417 TE_WriteFloat("m_fWidth", Width);
418 TE_WriteFloat("m_fEndWidth", Width);
419 TE_WriteFloat("m_fAmplitude", Amplitude);
420 TE_WriteNum("r", Color[0]);
421 TE_WriteNum("g", Color[1]);
422 TE_WriteNum("b", Color[2]);
423 TE_WriteNum("a", Color[3]);
424 TE_WriteNum("m_nSpeed", Speed);
425 TE_WriteNum("m_nFadeLength", 0);
426 TE_WriteNum("m_nFlags", Flags);
430 * Sets up a follow beam effect.
432 * @param EntIndex Entity index from where the beam starts.
433 * @param ModelIndex Precached model index.
434 * @param HaloIndex Precached model index.
435 * @param Life Time duration of the beam.
436 * @param Width Initial beam width.
437 * @param EndWidth Final beam width.
438 * @param FadeLength Beam fade time duration.
439 * @param color Color array (r, g, b, a).
442 stock TE_SetupBeamFollow(EntIndex, ModelIndex, HaloIndex, Float:Life, Float:Width, Float:EndWidth, FadeLength, const Color[4])
444 TE_Start("BeamFollow");
445 TE_WriteEncodedEnt("m_iEntIndex", EntIndex);
446 TE_WriteNum("m_nModelIndex", ModelIndex);
447 TE_WriteNum("m_nHaloIndex", HaloIndex);
448 TE_WriteNum("m_nStartFrame", 0);
449 TE_WriteNum("m_nFrameRate", 0);
450 TE_WriteFloat("m_fLife", Life);
451 TE_WriteFloat("m_fWidth", Width);
452 TE_WriteFloat("m_fEndWidth", EndWidth);
453 TE_WriteNum("m_nFadeLength", FadeLength);
454 TE_WriteNum("r", Color[0]);
455 TE_WriteNum("g", Color[1]);
456 TE_WriteNum("b", Color[2]);
457 TE_WriteNum("a", Color[3]);