1 /*
2 ===========================================================================
3 Copyright (C) 2000 - 2013, Raven Software, Inc.
4 Copyright (C) 2001 - 2013, Activision, Inc.
5 Copyright (C) 2013 - 2015, OpenJK contributors
6 
7 This file is part of the OpenJK source code.
8 
9 OpenJK is free software; you can redistribute it and/or modify it
10 under the terms of the GNU General Public License version 2 as
11 published by the Free Software Foundation.
12 
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 GNU General Public License for more details.
17 
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, see <http://www.gnu.org/licenses/>.
20 ===========================================================================
21 */
22 
23 // Bryar Pistol Weapon Effects
24 
25 #include "cg_local.h"
26 #include "fx_local.h"
27 
28 /*
29 -------------------------
30 
31 	MAIN FIRE
32 
33 -------------------------
34 FX_BryarProjectileThink
35 -------------------------
36 */
FX_BryarProjectileThink(centity_t * cent,const struct weaponInfo_s * weapon)37 void FX_BryarProjectileThink(  centity_t *cent, const struct weaponInfo_s *weapon )
38 {
39 	vec3_t forward;
40 
41 	if ( VectorNormalize2( cent->currentState.pos.trDelta, forward ) == 0.0f )
42 	{
43 		forward[2] = 1.0f;
44 	}
45 
46 	trap->FX_PlayEffectID( cgs.effects.bryarShotEffect, cent->lerpOrigin, forward, -1, -1, qfalse );
47 }
48 
49 /*
50 -------------------------
51 FX_BryarHitWall
52 -------------------------
53 */
FX_BryarHitWall(vec3_t origin,vec3_t normal)54 void FX_BryarHitWall( vec3_t origin, vec3_t normal )
55 {
56 	trap->FX_PlayEffectID( cgs.effects.bryarWallImpactEffect, origin, normal, -1, -1, qfalse );
57 }
58 
59 /*
60 -------------------------
61 FX_BryarHitPlayer
62 -------------------------
63 */
FX_BryarHitPlayer(vec3_t origin,vec3_t normal,qboolean humanoid)64 void FX_BryarHitPlayer( vec3_t origin, vec3_t normal, qboolean humanoid )
65 {
66 	if ( humanoid )
67 	{
68 		trap->FX_PlayEffectID( cgs.effects.bryarFleshImpactEffect, origin, normal, -1, -1, qfalse );
69 	}
70 	else
71 	{
72 		trap->FX_PlayEffectID( cgs.effects.bryarDroidImpactEffect, origin, normal, -1, -1, qfalse );
73 	}
74 }
75 
76 
77 /*
78 -------------------------
79 
80 	ALT FIRE
81 
82 -------------------------
83 FX_BryarAltProjectileThink
84 -------------------------
85 */
FX_BryarAltProjectileThink(centity_t * cent,const struct weaponInfo_s * weapon)86 void FX_BryarAltProjectileThink(  centity_t *cent, const struct weaponInfo_s *weapon )
87 {
88 	vec3_t forward;
89 	int t;
90 
91 	if ( VectorNormalize2( cent->currentState.pos.trDelta, forward ) == 0.0f )
92 	{
93 		forward[2] = 1.0f;
94 	}
95 
96 	// see if we have some sort of extra charge going on
97 	for (t = 1; t < cent->currentState.generic1; t++ )
98 	{
99 		// just add ourselves over, and over, and over when we are charged
100 		trap->FX_PlayEffectID( cgs.effects.bryarPowerupShotEffect, cent->lerpOrigin, forward, -1, -1, qfalse );
101 	}
102 
103 	//	for ( int t = 1; t < cent->gent->count; t++ )	// The single player stores the charge in count, which isn't accessible on the client
104 
105 	trap->FX_PlayEffectID( cgs.effects.bryarShotEffect, cent->lerpOrigin, forward, -1, -1, qfalse );
106 }
107 
108 /*
109 -------------------------
110 FX_BryarAltHitWall
111 -------------------------
112 */
FX_BryarAltHitWall(vec3_t origin,vec3_t normal,int power)113 void FX_BryarAltHitWall( vec3_t origin, vec3_t normal, int power )
114 {
115 	switch( power )
116 	{
117 	case 4:
118 	case 5:
119 		trap->FX_PlayEffectID( cgs.effects.bryarWallImpactEffect3, origin, normal, -1, -1, qfalse );
120 		break;
121 
122 	case 2:
123 	case 3:
124 		trap->FX_PlayEffectID( cgs.effects.bryarWallImpactEffect2, origin, normal, -1, -1, qfalse );
125 		break;
126 
127 	default:
128 		trap->FX_PlayEffectID( cgs.effects.bryarWallImpactEffect, origin, normal, -1, -1, qfalse );
129 		break;
130 	}
131 }
132 
133 /*
134 -------------------------
135 FX_BryarAltHitPlayer
136 -------------------------
137 */
FX_BryarAltHitPlayer(vec3_t origin,vec3_t normal,qboolean humanoid)138 void FX_BryarAltHitPlayer( vec3_t origin, vec3_t normal, qboolean humanoid )
139 {
140 	if ( humanoid )
141 	{
142 		trap->FX_PlayEffectID( cgs.effects.bryarFleshImpactEffect, origin, normal, -1, -1, qfalse );
143 	}
144 	else
145 	{
146 		trap->FX_PlayEffectID( cgs.effects.bryarDroidImpactEffect, origin, normal, -1, -1, qfalse );
147 	}
148 }
149 
150 
151 //TURRET
152 /*
153 -------------------------
154 FX_TurretProjectileThink
155 -------------------------
156 */
FX_TurretProjectileThink(centity_t * cent,const struct weaponInfo_s * weapon)157 void FX_TurretProjectileThink(  centity_t *cent, const struct weaponInfo_s *weapon )
158 {
159 	vec3_t forward;
160 
161 	if ( VectorNormalize2( cent->currentState.pos.trDelta, forward ) == 0.0f )
162 	{
163 		forward[2] = 1.0f;
164 	}
165 
166 	trap->FX_PlayEffectID( cgs.effects.turretShotEffect, cent->lerpOrigin, forward, -1, -1, qfalse );
167 }
168 
169 /*
170 -------------------------
171 FX_TurretHitWall
172 -------------------------
173 */
FX_TurretHitWall(vec3_t origin,vec3_t normal)174 void FX_TurretHitWall( vec3_t origin, vec3_t normal )
175 {
176 	trap->FX_PlayEffectID( cgs.effects.bryarWallImpactEffect, origin, normal, -1, -1, qfalse );
177 }
178 
179 /*
180 -------------------------
181 FX_TurretHitPlayer
182 -------------------------
183 */
FX_TurretHitPlayer(vec3_t origin,vec3_t normal,qboolean humanoid)184 void FX_TurretHitPlayer( vec3_t origin, vec3_t normal, qboolean humanoid )
185 {
186 	if ( humanoid )
187 	{
188 		trap->FX_PlayEffectID( cgs.effects.bryarFleshImpactEffect, origin, normal, -1, -1, qfalse );
189 	}
190 	else
191 	{
192 		trap->FX_PlayEffectID( cgs.effects.bryarDroidImpactEffect, origin, normal, -1, -1, qfalse );
193 	}
194 }
195 
196 
197 
198 //CONCUSSION (yeah, should probably make a new file for this.. or maybe just move all these stupid semi-redundant fx_ functions into one file)
199 /*
200 -------------------------
201 FX_ConcussionHitWall
202 -------------------------
203 */
FX_ConcussionHitWall(vec3_t origin,vec3_t normal)204 void FX_ConcussionHitWall( vec3_t origin, vec3_t normal )
205 {
206 	trap->FX_PlayEffectID( cgs.effects.concussionImpactEffect, origin, normal, -1, -1, qfalse );
207 }
208 
209 /*
210 -------------------------
211 FX_ConcussionHitPlayer
212 -------------------------
213 */
FX_ConcussionHitPlayer(vec3_t origin,vec3_t normal,qboolean humanoid)214 void FX_ConcussionHitPlayer( vec3_t origin, vec3_t normal, qboolean humanoid )
215 {
216 	trap->FX_PlayEffectID( cgs.effects.concussionImpactEffect, origin, normal, -1, -1, qfalse );
217 }
218 
219 /*
220 -------------------------
221 FX_ConcussionProjectileThink
222 -------------------------
223 */
FX_ConcussionProjectileThink(centity_t * cent,const struct weaponInfo_s * weapon)224 void FX_ConcussionProjectileThink(  centity_t *cent, const struct weaponInfo_s *weapon )
225 {
226 	vec3_t forward;
227 
228 	if ( VectorNormalize2( cent->currentState.pos.trDelta, forward ) == 0.0f )
229 	{
230 		forward[2] = 1.0f;
231 	}
232 
233 	trap->FX_PlayEffectID( cgs.effects.concussionShotEffect, cent->lerpOrigin, forward, -1, -1, qfalse );
234 }
235 
236 /*
237 ---------------------------
238 FX_ConcAltShot
239 ---------------------------
240 */
241 static vec3_t WHITE	={1.0f,1.0f,1.0f};
242 static vec3_t BRIGHT={0.75f,0.5f,1.0f};
243 
FX_ConcAltShot(vec3_t start,vec3_t end)244 void FX_ConcAltShot( vec3_t start, vec3_t end )
245 {
246 	//"concussion/beam"
247 	trap->FX_AddLine( start, end, 0.1f, 10.0f, 0.0f,
248 							1.0f, 0.0f, 0.0f,
249 							WHITE, WHITE, 0.0f,
250 							175, trap->R_RegisterShader( "gfx/effects/blueLine" ),
251 							FX_SIZE_LINEAR | FX_ALPHA_LINEAR );
252 
253 	// add some beef
254 	trap->FX_AddLine( start, end, 0.1f, 7.0f, 0.0f,
255 						1.0f, 0.0f, 0.0f,
256 						BRIGHT, BRIGHT, 0.0f,
257 						150, trap->R_RegisterShader( "gfx/misc/whiteline2" ),
258 						FX_SIZE_LINEAR | FX_ALPHA_LINEAR );
259 }
260