plugins/include/sdktools_tempents_stocks.inc
author Scott Ehlert <ds@alliedmods.net>
Sun Jul 15 08:00:26 2007 +0000 (2007-07-15)
changeset 1116 40cc5e9f0f1b
parent 1058 3248bc6dbf60
child 1330 ab94316bb52b
permissions -rw-r--r--
Removed strange debugging code
     1 /**
     2  * vim: set ts=4 :
     3  * ===============================================================
     4  * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
     5  * ===============================================================
     6  *
     7  *  This file is part of the SourceMod/SourcePawn SDK.  This file may only be used 
     8  * or modified under the Terms and Conditions of its License Agreement, which is found 
     9  * in LICENSE.txt.  The Terms and Conditions for making SourceMod extensions/plugins 
    10  * may change at any time.  To view the latest information, see:
    11  *   http://www.sourcemod.net/license.php
    12  *
    13  * Version: $Id$
    14  */
    15 
    16 #if defined _te_stocks_included
    17  #endinput
    18 #endif
    19 #define _te_stocks_included
    20 
    21 /**
    22  * @section TE Explosion flags.
    23  */
    24 #define TE_EXPLFLAG_NONE		0x0	/**< all flags clear makes default Half-Life explosion */
    25 #define TE_EXPLFLAG_NOADDITIVE		0x1	/**< sprite will be drawn opaque (ensure that the sprite you send is a non-additive sprite) */
    26 #define TE_EXPLFLAG_NODLIGHTS		0x2	/**< do not render dynamic lights */
    27 #define TE_EXPLFLAG_NOSOUND		0x4	/**< do not play client explosion sound */
    28 #define TE_EXPLFLAG_NOPARTICLES		0x8	/**< do not draw particles */
    29 #define TE_EXPLFLAG_DRAWALPHA		0x10	/**< sprite will be drawn alpha */
    30 #define TE_EXPLFLAG_ROTATE		0x20	/**< rotate the sprite randomly */
    31 #define TE_EXPLFLAG_NOFIREBALL		0x40	/**< do not draw a fireball */
    32 #define TE_EXPLFLAG_NOFIREBALLSMOKE	0x80	/**< do not draw smoke with the fireball */
    33 
    34 /**
    35  * @endsection
    36  */
    37 
    38 /**
    39  * @section TE Beam flags.
    40  */
    41 #define FBEAM_STARTENTITY 	0x00000001
    42 #define	FBEAM_ENDENTITY		0x00000002
    43 #define	FBEAM_FADEIN		0x00000004
    44 #define	FBEAM_FADEOUT		0x00000008
    45 #define	FBEAM_SINENOISE		0x00000010
    46 #define	FBEAM_SOLID		0x00000020
    47 #define	FBEAM_SHADEIN		0x00000040
    48 #define	FBEAM_SHADEOUT		0x00000080
    49 #define	FBEAM_ONLYNOISEONCE	0x00000100 	/**< Only calculate our noise once */
    50 #define	FBEAM_NOTILE		0x00000200
    51 #define	FBEAM_USE_HITBOXES	0x00000400	/**< Attachment indices represent hitbox indices instead when this is set. */
    52 #define	FBEAM_STARTVISIBLE	0x00000800	/**< Has this client actually seen this beam's start entity yet? */
    53 #define	FBEAM_ENDVISIBLE	0x00001000	/**< Has this client actually seen this beam's end entity yet? */
    54 #define	FBEAM_ISACTIVE		0x00002000
    55 #define	FBEAM_FOREVER		0x00004000
    56 #define	FBEAM_HALOBEAM		0x00008000	/**< When drawing a beam with a halo, don't ignore the segments and endwidth */
    57 
    58 /**
    59  * @endsection
    60  */
    61 
    62 /**
    63  * Sets up a sparks effect.
    64  *
    65  * @param pos			Position of the sparks.
    66  * @param dir			Direction of the sparks.
    67  * @param Magnitude		Sparks size.
    68  * @param TrailLength		Trail lenght of the sparks.
    69  * @noreturn
    70  */
    71 stock TE_SetupSparks(const Float:pos[3], const Float:dir[3], Magnitude, TrailLength)
    72 {
    73 	TE_Start("Sparks");
    74 	TE_WriteVector("m_vecOrigin[0]", pos);
    75 	TE_WriteVector("m_vecDir", dir);
    76 	TE_WriteNum("m_nMagnitude", Magnitude);
    77 	TE_WriteNum("m_nTrailLength", TrailLength);
    78 }
    79 
    80 /**
    81  * Sets up a smoke effect.
    82  *
    83  * @param pos			Position of the smoke.
    84  * @param Model			Precached model index.
    85  * @param Scale			Scale of the smoke.
    86  * @param Framerate		Frame rate of the smoke.
    87  * @noreturn
    88  */
    89 stock TE_SetupSmoke(const Float:pos[3], Model, Float:Scale, FrameRate)
    90 {
    91 	TE_Start("Smoke");
    92 	TE_WriteVector("m_vecOrigin", pos);
    93 	TE_WriteNum("m_nModelIndex", Model);
    94 	TE_WriteFloat("m_fScale", Scale);
    95 	TE_WriteNum("m_nFrameRate", FrameRate);
    96 }
    97 
    98 /**
    99  * Sets up a dust cloud effect.
   100  *
   101  * @param pos			Position of the dust.
   102  * @param dir			Direction of the dust.
   103  * @param Size			Dust cloud size.
   104  * @param Speed			Dust cloud speed.
   105  * @noreturn
   106  */
   107 stock TE_SetupDust(const Float:pos[3], const Float:dir[3], Float:Size, Float:Speed)
   108 {
   109 	TE_Start("Dust");
   110 	TE_WriteVector("m_vecOrigin[0]", pos);
   111 	TE_WriteVector("m_vecDirection", dir);
   112 	TE_WriteFloat("m_flSize", Size);
   113 	TE_WriteFloat("m_flSpeed", Speed);
   114 }
   115 
   116 /**
   117  * Sets up a muzzle flash effect.
   118  *
   119  * @param pos			Position of the muzzle flash.
   120  * @param angles		Rotation angles of the muzzle flash.
   121  * @param Scale			Scale of the muzzle flash.
   122  * @param Type			Muzzle flash type to render (Mod specific).
   123  * @noreturn
   124  */
   125 stock TE_SetupMuzzleFlash(const Float:pos[3], const Float:angles[3], Float:Scale, Type)
   126 {
   127 	TE_Start("MuzzleFlash");
   128 	TE_WriteVector("m_vecOrigin", pos);
   129 	TE_WriteVector("m_vecAngles", angles);
   130 	TE_WriteFloat("m_flScale", Scale);
   131 	TE_WriteNum("m_nType", Type);
   132 }
   133 
   134 /**
   135  * Sets up a metal sparks effect.
   136  *
   137  * @param pos			Position of the metal sparks.
   138  * @param dir			Direction of the metal sparks.
   139  * @noreturn
   140  */
   141 stock TE_SetupMetalSparks(const Float:pos[3], const Float:dir[3])
   142 {
   143 	TE_Start("Metal Sparks");
   144 	TE_WriteVector("m_vecPos", pos);
   145 	TE_WriteVector("m_vecDir", dir);
   146 }
   147 
   148 /**
   149  * Sets up an energy splash effect.
   150  *
   151  * @param pos			Position of the energy splash.
   152  * @param dir			Direction of the energy splash.
   153  * @param Explosive		Makes the effect explosive.
   154  * @noreturn
   155  */
   156 stock TE_SetupEnergySplash(const Float:pos[3], const Float:dir[3], bool:Explosive)
   157 {
   158 	TE_Start("Energy Splash");
   159 	TE_WriteVector("m_vecPos", pos);
   160 	TE_WriteVector("m_vecDir", dir);
   161 	TE_WriteNum("m_bExplosive", Explosive);
   162 }
   163 
   164 /**
   165  * Sets up an armor ricochet effect.
   166  *
   167  * @param pos			Position of the armor ricochet.
   168  * @param dir			Directon of the armor ricochet.
   169  * @noreturn
   170  */
   171 stock TE_SetupArmorRicochet(const Float:pos[3], const Float:dir[3])
   172 {
   173 	TE_Start("Armor Ricochet");
   174 	TE_WriteVector("m_vecPos", pos);
   175 	TE_WriteVector("m_vecDir", dir);
   176 }
   177 
   178 /**
   179  * Sets up a glowing sprite effect.
   180  *
   181  * @param pos			Position of the sprite.
   182  * @param Model			Precached model index.
   183  * @param Life			Time duration of the sprite.
   184  * @param Size			Sprite size.
   185  * @param Brightness		Sprite brightness.
   186  * @noreturn
   187  */
   188 stock TE_SetupGlowSprite(const Float:pos[3], Model, Float:Life, Float:Size, Brightness)
   189 {
   190 	TE_Start("GlowSprite");
   191 	TE_WriteVector("m_vecOrigin", pos);
   192 	TE_WriteNum("m_nModelIndex", Model);
   193 	TE_WriteFloat("m_fScale", Size);
   194 	TE_WriteFloat("m_fLife", Life);
   195 	TE_WriteNum("m_nBrightness", Brightness);
   196 }
   197 
   198 /**
   199  * Sets up a explosion effect.
   200  *
   201  * @param pos			Explosion position.
   202  * @param Model			Precached model index.
   203  * @param Scale			Explosion scale.
   204  * @param Framerate		Explosion frame rate.
   205  * @param Flags			Explosion flags.
   206  * @param Radius		Explosion radius.
   207  * @param Magnitude		Explosion size.
   208  * @param normal		Normal vector to the explosion.
   209  * @param MaterialType		Exploded material type.
   210  * @noreturn
   211  */
   212 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')
   213 {
   214 	TE_Start("Explosion");
   215 	TE_WriteVector("m_vecOrigin[0]", pos);
   216 	TE_WriteVector("m_vecNormal", normal);
   217 	TE_WriteNum("m_nModelIndex", Model);
   218 	TE_WriteFloat("m_fScale", Scale);
   219 	TE_WriteNum("m_nFrameRate", Framerate);
   220 	TE_WriteNum("m_nFlags", Flags);
   221 	TE_WriteNum("m_nRadius", Radius);
   222 	TE_WriteNum("m_nMagnitude", Magnitude);
   223 	TE_WriteNum("m_chMaterialType", MaterialType);
   224 }
   225 
   226 /**
   227  * Sets up a blood sprite effect.
   228  *
   229  * @param pos			Position of the sprite.
   230  * @param dir			Sprite direction.
   231  * @param color			Color array (r, g, b, a).
   232  * @param Size			Sprite size.
   233  * @param SprayModel		Precached model index.
   234  * @param BloodDropModel	Precached model index.
   235  * @noreturn
   236  */
   237 stock TE_SetupBloodSprite(const Float:pos[3], const Float:dir[3], const color[4], Size, SprayModel, BloodDropModel)
   238 {
   239 	TE_Start("Blood Sprite");
   240 	TE_WriteVector("m_vecOrigin", pos);
   241 	TE_WriteVector("m_vecDirection", dir);
   242 	TE_WriteNum("r", color[0]);
   243 	TE_WriteNum("g", color[1]);
   244 	TE_WriteNum("b", color[2]);
   245 	TE_WriteNum("a", color[3]);
   246 	TE_WriteNum("m_nSize", Size);
   247 	TE_WriteNum("m_nSprayModel", SprayModel);
   248 	TE_WriteNum("m_nDropModel", BloodDropModel);
   249 }
   250 
   251 /**
   252  * Sets up a beam ring point effect.
   253  *
   254  * @param center		Center position of the ring.
   255  * @param Start_Radius		Initial ring radius.
   256  * @param End_Radius		Final ring radius.
   257  * @param ModelIndex		Precached model index.
   258  * @param HaloIndex		Precached model index.
   259  * @param StartFrame		Initital frame to render.
   260  * @param FrameRate		Ring frame rate.
   261  * @param Life			Time duration of the ring.
   262  * @param Width			Beam width.
   263  * @param Amplitude		Beam amplitude.
   264  * @param color			Color array (r, g, b, a).
   265  * @param Speed			Speed of the beam.
   266  * @param Flags			Beam flags.
   267  * @noreturn
   268  */
   269 stock TE_SetupBeamRingPoint(const Float:center[3], Float:Start_Radius, Float:End_Radius, ModelIndex, HaloIndex, StartFrame, 
   270 				FrameRate, Float:Life, Float:Width, Float:Amplitude, const Color[4], Speed, Flags)
   271 {
   272 	TE_Start("BeamRingPoint");
   273 	TE_WriteVector("m_vecCenter", center);
   274 	TE_WriteFloat("m_flStartRadius", Start_Radius);
   275 	TE_WriteFloat("m_flEndRadius", End_Radius);
   276 	TE_WriteNum("m_nModelIndex", ModelIndex);
   277 	TE_WriteNum("m_nHaloIndex", HaloIndex);
   278 	TE_WriteNum("m_nStartFrame", StartFrame);
   279 	TE_WriteNum("m_nFrameRate", FrameRate);
   280 	TE_WriteFloat("m_fLife", Life);
   281 	TE_WriteFloat("m_fWidth", Width);
   282 	TE_WriteFloat("m_fEndWidth", Width);
   283 	TE_WriteFloat("m_fAmplitude", Amplitude);
   284 	TE_WriteNum("r", Color[0]);
   285 	TE_WriteNum("g", Color[1]);
   286 	TE_WriteNum("b", Color[2]);
   287 	TE_WriteNum("a", Color[3]);
   288 	TE_WriteNum("m_nSpeed", Speed);
   289 	TE_WriteNum("m_nFlags", Flags);
   290 	TE_WriteNum("m_nFadeLength", 0);
   291 }
   292 
   293 /**
   294  * Sets up a point to point beam effect.
   295  *
   296  * @param start			Start position of the beam.
   297  * @param end			End position of the beam.
   298  * @param ModelIndex		Precached model index.
   299  * @param HaloIndex		Precached model index.
   300  * @param StartFrame		Initital frame to render.
   301  * @param FrameRate		Beam frame rate.
   302  * @param Life			Time duration of the beam.
   303  * @param Width			Initial beam width.
   304  * @param EndWidth		Final beam width.
   305  * @param FadeLength		Beam fade time duration.
   306  * @param Amplitude		Beam amplitude.
   307  * @param color			Color array (r, g, b, a).
   308  * @param Speed			Speed of the beam.
   309  * @noreturn
   310  */
   311 stock TE_SetupBeamPoints(const Float:start[3], const Float:end[3], ModelIndex, HaloIndex, StartFrame, FrameRate, Float:Life, 
   312 				Float:Width, Float:EndWidth, FadeLength, Float:Amplitude, const Color[4], Speed)
   313 {
   314 	TE_Start("BeamPoints");
   315 	TE_WriteVector("m_vecStartPoint", start);
   316 	TE_WriteVector("m_vecEndPoint", end);
   317 	TE_WriteNum("m_nModelIndex", ModelIndex);
   318 	TE_WriteNum("m_nHaloIndex", HaloIndex);
   319 	TE_WriteNum("m_nStartFrame", StartFrame);
   320 	TE_WriteNum("m_nFrameRate", FrameRate);
   321 	TE_WriteFloat("m_fLife", Life);
   322 	TE_WriteFloat("m_fWidth", Width);
   323 	TE_WriteFloat("m_fEndWidth", EndWidth);
   324 	TE_WriteFloat("m_fAmplitude", Amplitude);
   325 	TE_WriteNum("r", Color[0]);
   326 	TE_WriteNum("g", Color[1]);
   327 	TE_WriteNum("b", Color[2]);
   328 	TE_WriteNum("a", Color[3]);
   329 	TE_WriteNum("m_nSpeed", Speed);
   330 	TE_WriteNum("m_nFadeLength", FadeLength);
   331 }
   332 
   333 /**
   334  * Sets up an entity to entity laser effect.
   335  *
   336  * @param StartEntity		Entity index from where the beam starts.
   337  * @param EndEntity		Entity index from where the beam ends.
   338  * @param ModelIndex		Precached model index.
   339  * @param HaloIndex		Precached model index.
   340  * @param StartFrame		Initital frame to render.
   341  * @param FrameRate		Beam frame rate.
   342  * @param Life			Time duration of the beam.
   343  * @param Width			Initial beam width.
   344  * @param EndWidth		Final beam width.
   345  * @param FadeLength		Beam fade time duration.
   346  * @param Amplitude		Beam amplitude.
   347  * @param color			Color array (r, g, b, a).
   348  * @param Speed			Speed of the beam.
   349  * @noreturn
   350  */
   351 stock TE_SetupBeamLaser(StartEntity, EndEntity, ModelIndex, HaloIndex, StartFrame, FrameRate, Float:Life, 
   352 				Float:Width, Float:EndWidth, FadeLength, Float:Amplitude, const Color[4], Speed)
   353 {
   354 	TE_Start("BeamLaser");
   355 	TE_WriteEncodedEnt("m_nStartEntity", StartEntity);
   356 	TE_WriteEncodedEnt("m_nEndEntity", EndEntity);
   357 	TE_WriteNum("m_nModelIndex", ModelIndex);
   358 	TE_WriteNum("m_nHaloIndex", HaloIndex);
   359 	TE_WriteNum("m_nStartFrame", StartFrame);
   360 	TE_WriteNum("m_nFrameRate", FrameRate);
   361 	TE_WriteFloat("m_fLife", Life);
   362 	TE_WriteFloat("m_fWidth", Width);
   363 	TE_WriteFloat("m_fEndWidth", EndWidth);
   364 	TE_WriteFloat("m_fAmplitude", Amplitude);
   365 	TE_WriteNum("r", Color[0]);
   366 	TE_WriteNum("g", Color[1]);
   367 	TE_WriteNum("b", Color[2]);
   368 	TE_WriteNum("a", Color[3]);
   369 	TE_WriteNum("m_nSpeed", Speed);
   370 	TE_WriteNum("m_nFadeLength", FadeLength);
   371 }
   372 
   373 /**
   374  * Sets up a beam ring effect.
   375  *
   376  * @param StartEntity		Entity index from where the ring starts.
   377  * @param EndEntity		Entity index from where the ring ends.
   378  * @param ModelIndex		Precached model index.
   379  * @param HaloIndex		Precached model index.
   380  * @param StartFrame		Initital frame to render.
   381  * @param FrameRate		Ring frame rate.
   382  * @param Life			Time duration of the ring.
   383  * @param Width			Beam width.
   384  * @param Amplitude		Beam amplitude.
   385  * @param color			Color array (r, g, b, a).
   386  * @param Speed			Speed of the beam.
   387  * @param Flags			Beam flags.
   388  * @noreturn
   389  */
   390 stock TE_SetupBeamRing(StartEntity, EndEntity, ModelIndex, HaloIndex, StartFrame, FrameRate, Float:Life, Float:Width, Float:Amplitude, const Color[4], Speed, Flags)
   391 {
   392 	TE_Start("BeamRing");
   393 	TE_WriteEncodedEnt("m_nStartEntity", StartEntity);
   394 	TE_WriteEncodedEnt("m_nEndEntity", EndEntity);
   395 	TE_WriteNum("m_nModelIndex", ModelIndex);
   396 	TE_WriteNum("m_nHaloIndex", HaloIndex);
   397 	TE_WriteNum("m_nStartFrame", StartFrame);
   398 	TE_WriteNum("m_nFrameRate", FrameRate);
   399 	TE_WriteFloat("m_fLife", Life);
   400 	TE_WriteFloat("m_fWidth", Width);
   401 	TE_WriteFloat("m_fEndWidth", Width);
   402 	TE_WriteFloat("m_fAmplitude", Amplitude);
   403 	TE_WriteNum("r", Color[0]);
   404 	TE_WriteNum("g", Color[1]);
   405 	TE_WriteNum("b", Color[2]);
   406 	TE_WriteNum("a", Color[3]);
   407 	TE_WriteNum("m_nSpeed", Speed);
   408 	TE_WriteNum("m_nFadeLength", 0);
   409 	TE_WriteNum("m_nFlags", Flags);
   410 }
   411 
   412 /**
   413  * Sets up a follow beam effect.
   414  *
   415  * @param EntIndex		Entity index from where the beam starts.
   416  * @param ModelIndex		Precached model index.
   417  * @param HaloIndex		Precached model index.
   418  * @param Life			Time duration of the beam.
   419  * @param Width			Initial beam width.
   420  * @param EndWidth		Final beam width.
   421  * @param FadeLength		Beam fade time duration.
   422  * @param color			Color array (r, g, b, a).
   423  * @noreturn
   424  */
   425 stock TE_SetupBeamFollow(EntIndex, ModelIndex, HaloIndex, Float:Life, Float:Width, Float:EndWidth, FadeLength, const Color[4])
   426 {
   427 	TE_Start("BeamFollow");
   428 	TE_WriteEncodedEnt("m_iEntIndex", EntIndex);
   429 	TE_WriteNum("m_nModelIndex", ModelIndex);
   430 	TE_WriteNum("m_nHaloIndex", HaloIndex);
   431 	TE_WriteNum("m_nStartFrame", 0);
   432 	TE_WriteNum("m_nFrameRate", 0);
   433 	TE_WriteFloat("m_fLife", Life);
   434 	TE_WriteFloat("m_fWidth", Width);
   435 	TE_WriteFloat("m_fEndWidth", EndWidth);
   436 	TE_WriteNum("m_nFadeLength", FadeLength);
   437 	TE_WriteNum("r", Color[0]);
   438 	TE_WriteNum("g", Color[1]);
   439 	TE_WriteNum("b", Color[2]);
   440 	TE_WriteNum("a", Color[3]);
   441 }