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 // Disruptor Weapon
24 
25 #include "cg_local.h"
26 #include "fx_local.h"
27 
28 /*
29 ---------------------------
30 FX_DisruptorMainShot
31 ---------------------------
32 */
33 static vec3_t WHITE={1.0f,1.0f,1.0f};
34 
FX_DisruptorMainShot(vec3_t start,vec3_t end)35 void FX_DisruptorMainShot( vec3_t start, vec3_t end )
36 {
37 //	vec3_t	dir;
38 //	float	len;
39 
40 	trap->FX_AddLine( start, end, 0.1f, 6.0f, 0.0f,
41 							1.0f, 0.0f, 0.0f,
42 							WHITE, WHITE, 0.0f,
43 							150, trap->R_RegisterShader( "gfx/effects/redLine" ),
44 							FX_SIZE_LINEAR | FX_ALPHA_LINEAR );
45 
46 //	VectorSubtract( end, start, dir );
47 //	len = VectorNormalize( dir );
48 
49 //	FX_AddCylinder( start, dir, 5.0f, 5.0f, 0.0f,
50 //								5.0f, 5.0f, 0.0f,
51 //								len, len, 0.0f,
52 //								1.0f, 1.0f, 0.0f,
53 //								WHITE, WHITE, 0.0f,
54 //								400, cgi_R_RegisterShader( "gfx/effects/spiral" ), 0 );
55 }
56 
57 
58 /*
59 ---------------------------
60 FX_DisruptorAltShot
61 ---------------------------
62 */
FX_DisruptorAltShot(vec3_t start,vec3_t end,qboolean fullCharge)63 void FX_DisruptorAltShot( vec3_t start, vec3_t end, qboolean fullCharge )
64 {
65 	trap->FX_AddLine( start, end, 0.1f, 10.0f, 0.0f,
66 							1.0f, 0.0f, 0.0f,
67 							WHITE, WHITE, 0.0f,
68 							175, trap->R_RegisterShader( "gfx/effects/redLine" ),
69 							FX_SIZE_LINEAR | FX_ALPHA_LINEAR );
70 
71 	if ( fullCharge )
72 	{
73 		vec3_t	YELLER={0.8f,0.7f,0.0f};
74 
75 		// add some beef
76 		trap->FX_AddLine( start, end, 0.1f, 7.0f, 0.0f,
77 							1.0f, 0.0f, 0.0f,
78 							YELLER, YELLER, 0.0f,
79 							150, trap->R_RegisterShader( "gfx/misc/whiteline2" ),
80 							FX_SIZE_LINEAR | FX_ALPHA_LINEAR );
81 	}
82 }
83 
84 
85 /*
86 ---------------------------
87 FX_DisruptorAltMiss
88 ---------------------------
89 */
90 #define FX_ALPHA_WAVE		0x00000008
91 
FX_DisruptorAltMiss(vec3_t origin,vec3_t normal)92 void FX_DisruptorAltMiss( vec3_t origin, vec3_t normal )
93 {
94 	vec3_t pos, c1, c2;
95 	addbezierArgStruct_t b;
96 
97 	VectorMA( origin, 4.0f, normal, c1 );
98 	VectorCopy( c1, c2 );
99 	c1[2] += 4;
100 	c2[2] += 12;
101 
102 	VectorAdd( origin, normal, pos );
103 	pos[2] += 28;
104 
105 	/*
106 	FX_AddBezier( origin, pos, c1, vec3_origin, c2, vec3_origin, 6.0f, 6.0f, 0.0f, 0.0f, 0.2f, 0.5f,
107 	WHITE, WHITE, 0.0f, 4000, trap->R_RegisterShader( "gfx/effects/smokeTrail" ), FX_ALPHA_WAVE );
108 	*/
109 
110 	VectorCopy(origin, b.start);
111 	VectorCopy(pos, b.end);
112 	VectorCopy(c1, b.control1);
113 	VectorCopy(vec3_origin, b.control1Vel);
114 	VectorCopy(c2, b.control2);
115 	VectorCopy(vec3_origin, b.control2Vel);
116 
117 	b.size1 = 6.0f;
118 	b.size2 = 6.0f;
119 	b.sizeParm = 0.0f;
120 	b.alpha1 = 0.0f;
121 	b.alpha2 = 0.2f;
122 	b.alphaParm = 0.5f;
123 
124 	VectorCopy(WHITE, b.sRGB);
125 	VectorCopy(WHITE, b.eRGB);
126 
127 	b.rgbParm = 0.0f;
128 	b.killTime = 4000;
129 	b.shader = trap->R_RegisterShader( "gfx/effects/smokeTrail" );
130 	b.flags = FX_ALPHA_WAVE;
131 
132 	trap->FX_AddBezier(&b);
133 
134 	trap->FX_PlayEffectID( cgs.effects.disruptorAltMissEffect, origin, normal, -1, -1, qfalse );
135 }
136 
137 /*
138 ---------------------------
139 FX_DisruptorAltHit
140 ---------------------------
141 */
142 
FX_DisruptorAltHit(vec3_t origin,vec3_t normal)143 void FX_DisruptorAltHit( vec3_t origin, vec3_t normal )
144 {
145 	trap->FX_PlayEffectID( cgs.effects.disruptorAltHitEffect, origin, normal, -1, -1, qfalse );
146 }
147 
148 
149 
150 /*
151 ---------------------------
152 FX_DisruptorHitWall
153 ---------------------------
154 */
155 
FX_DisruptorHitWall(vec3_t origin,vec3_t normal)156 void FX_DisruptorHitWall( vec3_t origin, vec3_t normal )
157 {
158 	trap->FX_PlayEffectID( cgs.effects.disruptorWallImpactEffect, origin, normal, -1, -1, qfalse );
159 }
160 
161 /*
162 ---------------------------
163 FX_DisruptorHitPlayer
164 ---------------------------
165 */
166 
FX_DisruptorHitPlayer(vec3_t origin,vec3_t normal,qboolean humanoid)167 void FX_DisruptorHitPlayer( vec3_t origin, vec3_t normal, qboolean humanoid )
168 {
169 	trap->FX_PlayEffectID( cgs.effects.disruptorFleshImpactEffect, origin, normal, -1, -1, qfalse );
170 }
171