codemp/cgame/fx_bryarpistol.c

Go to the documentation of this file.
00001 // Bryar Pistol Weapon Effects
00002 
00003 #include "cg_local.h"
00004 #include "fx_local.h"
00005 
00006 /*
00007 -------------------------
00008 
00009         MAIN FIRE
00010 
00011 -------------------------
00012 FX_BryarProjectileThink
00013 -------------------------
00014 */
00015 void FX_BryarProjectileThink(  centity_t *cent, const struct weaponInfo_s *weapon )
00016 {
00017         vec3_t forward;
00018 
00019         if ( VectorNormalize2( cent->currentState.pos.trDelta, forward ) == 0.0f )
00020         {
00021                 forward[2] = 1.0f;
00022         }
00023 
00024         trap_FX_PlayEffectID( cgs.effects.bryarShotEffect, cent->lerpOrigin, forward, -1, -1 );
00025 }
00026 
00027 /*
00028 -------------------------
00029 FX_BryarHitWall
00030 -------------------------
00031 */
00032 void FX_BryarHitWall( vec3_t origin, vec3_t normal )
00033 {
00034         trap_FX_PlayEffectID( cgs.effects.bryarWallImpactEffect, origin, normal, -1, -1 );
00035 }
00036 
00037 /*
00038 -------------------------
00039 FX_BryarHitPlayer
00040 -------------------------
00041 */
00042 void FX_BryarHitPlayer( vec3_t origin, vec3_t normal, qboolean humanoid )
00043 {
00044         if ( humanoid )
00045         {
00046                 trap_FX_PlayEffectID( cgs.effects.bryarFleshImpactEffect, origin, normal, -1, -1 );
00047         }
00048         else
00049         {
00050                 trap_FX_PlayEffectID( cgs.effects.bryarDroidImpactEffect, origin, normal, -1, -1 );
00051         }
00052 }
00053 
00054 
00055 /*
00056 -------------------------
00057 
00058         ALT FIRE
00059 
00060 -------------------------
00061 FX_BryarAltProjectileThink
00062 -------------------------
00063 */
00064 void FX_BryarAltProjectileThink(  centity_t *cent, const struct weaponInfo_s *weapon )
00065 {
00066         vec3_t forward;
00067         int t;
00068 
00069         if ( VectorNormalize2( cent->currentState.pos.trDelta, forward ) == 0.0f )
00070         {
00071                 forward[2] = 1.0f;
00072         }
00073 
00074         // see if we have some sort of extra charge going on
00075         for (t = 1; t < cent->currentState.generic1; t++ )
00076         {
00077                 // just add ourselves over, and over, and over when we are charged
00078                 trap_FX_PlayEffectID( cgs.effects.bryarPowerupShotEffect, cent->lerpOrigin, forward, -1, -1 );
00079         }
00080 
00081         //      for ( int t = 1; t < cent->gent->count; t++ )   // The single player stores the charge in count, which isn't accessible on the client
00082 
00083         trap_FX_PlayEffectID( cgs.effects.bryarShotEffect, cent->lerpOrigin, forward, -1, -1 );
00084 }
00085 
00086 /*
00087 -------------------------
00088 FX_BryarAltHitWall
00089 -------------------------
00090 */
00091 void FX_BryarAltHitWall( vec3_t origin, vec3_t normal, int power )
00092 {
00093         switch( power )
00094         {
00095         case 4:
00096         case 5:
00097                 trap_FX_PlayEffectID( cgs.effects.bryarWallImpactEffect3, origin, normal, -1, -1 );
00098                 break;
00099 
00100         case 2:
00101         case 3:
00102                 trap_FX_PlayEffectID( cgs.effects.bryarWallImpactEffect2, origin, normal, -1, -1 );
00103                 break;
00104 
00105         default:
00106                 trap_FX_PlayEffectID( cgs.effects.bryarWallImpactEffect, origin, normal, -1, -1 );
00107                 break;
00108         }
00109 }
00110 
00111 /*
00112 -------------------------
00113 FX_BryarAltHitPlayer
00114 -------------------------
00115 */
00116 void FX_BryarAltHitPlayer( vec3_t origin, vec3_t normal, qboolean humanoid )
00117 {
00118         if ( humanoid )
00119         {
00120                 trap_FX_PlayEffectID( cgs.effects.bryarFleshImpactEffect, origin, normal, -1, -1 );
00121         }
00122         else
00123         {
00124                 trap_FX_PlayEffectID( cgs.effects.bryarDroidImpactEffect, origin, normal, -1, -1 );
00125         }
00126 }
00127 
00128 
00129 //TURRET
00130 /*
00131 -------------------------
00132 FX_TurretProjectileThink
00133 -------------------------
00134 */
00135 void FX_TurretProjectileThink(  centity_t *cent, const struct weaponInfo_s *weapon )
00136 {
00137         vec3_t forward;
00138 
00139         if ( VectorNormalize2( cent->currentState.pos.trDelta, forward ) == 0.0f )
00140         {
00141                 forward[2] = 1.0f;
00142         }
00143 
00144         trap_FX_PlayEffectID( cgs.effects.turretShotEffect, cent->lerpOrigin, forward, -1, -1 );
00145 }
00146 
00147 /*
00148 -------------------------
00149 FX_TurretHitWall
00150 -------------------------
00151 */
00152 void FX_TurretHitWall( vec3_t origin, vec3_t normal )
00153 {
00154         trap_FX_PlayEffectID( cgs.effects.bryarWallImpactEffect, origin, normal, -1, -1 );
00155 }
00156 
00157 /*
00158 -------------------------
00159 FX_TurretHitPlayer
00160 -------------------------
00161 */
00162 void FX_TurretHitPlayer( vec3_t origin, vec3_t normal, qboolean humanoid )
00163 {
00164         if ( humanoid )
00165         {
00166                 trap_FX_PlayEffectID( cgs.effects.bryarFleshImpactEffect, origin, normal, -1, -1 );
00167         }
00168         else
00169         {
00170                 trap_FX_PlayEffectID( cgs.effects.bryarDroidImpactEffect, origin, normal, -1, -1 );
00171         }
00172 }
00173 
00174 
00175 
00176 //CONCUSSION (yeah, should probably make a new file for this.. or maybe just move all these stupid semi-redundant fx_ functions into one file)
00177 /*
00178 -------------------------
00179 FX_ConcussionHitWall
00180 -------------------------
00181 */
00182 void FX_ConcussionHitWall( vec3_t origin, vec3_t normal )
00183 {
00184         trap_FX_PlayEffectID( cgs.effects.concussionImpactEffect, origin, normal, -1, -1 );
00185 }
00186 
00187 /*
00188 -------------------------
00189 FX_ConcussionHitPlayer
00190 -------------------------
00191 */
00192 void FX_ConcussionHitPlayer( vec3_t origin, vec3_t normal, qboolean humanoid )
00193 {
00194         trap_FX_PlayEffectID( cgs.effects.concussionImpactEffect, origin, normal, -1, -1 );
00195 }
00196 
00197 /*
00198 -------------------------
00199 FX_ConcussionProjectileThink
00200 -------------------------
00201 */
00202 void FX_ConcussionProjectileThink(  centity_t *cent, const struct weaponInfo_s *weapon )
00203 {
00204         vec3_t forward;
00205 
00206         if ( VectorNormalize2( cent->currentState.pos.trDelta, forward ) == 0.0f )
00207         {
00208                 forward[2] = 1.0f;
00209         }
00210 
00211         trap_FX_PlayEffectID( cgs.effects.concussionShotEffect, cent->lerpOrigin, forward, -1, -1 );
00212 }
00213 
00214 /*
00215 ---------------------------
00216 FX_ConcAltShot
00217 ---------------------------
00218 */
00219 static vec3_t WHITE     ={1.0f,1.0f,1.0f};
00220 static vec3_t BRIGHT={0.75f,0.5f,1.0f};
00221 
00222 void FX_ConcAltShot( vec3_t start, vec3_t end )
00223 {
00224         //"concussion/beam"
00225         trap_FX_AddLine( start, end, 0.1f, 10.0f, 0.0f, 
00226                                                         1.0f, 0.0f, 0.0f,
00227                                                         WHITE, WHITE, 0.0f,
00228                                                         175, trap_R_RegisterShader( "gfx/effects/blueLine" ), 
00229                                                         FX_SIZE_LINEAR | FX_ALPHA_LINEAR );
00230 
00231         // add some beef
00232         trap_FX_AddLine( start, end, 0.1f, 7.0f, 0.0f, 
00233                                                 1.0f, 0.0f, 0.0f,
00234                                                 BRIGHT, BRIGHT, 0.0f,
00235                                                 150, trap_R_RegisterShader( "gfx/misc/whiteline2" ), 
00236                                                 FX_SIZE_LINEAR | FX_ALPHA_LINEAR );
00237 }