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 #include "g_headers.h"
24
25 #include "b_local.h"
26 #include "g_local.h"
27 #include "wp_saber.h"
28 #include "w_local.h"
29 #include "g_functions.h"
30
31 // ATST Main
32 //---------------------------------------------------------
WP_ATSTMainFire(gentity_t * ent)33 void WP_ATSTMainFire( gentity_t *ent )
34 //---------------------------------------------------------
35 {
36 float vel = ATST_MAIN_VEL;
37
38 // if ( ent->client && (ent->client->ps.eFlags & EF_IN_ATST ))
39 // {
40 // vel = 4500.0f;
41 // }
42
43 if ( !ent->s.number )
44 {
45 // player shoots faster
46 vel *= 1.6f;
47 }
48
49 gentity_t *missile = CreateMissile( wpMuzzle, wpFwd, vel, 10000, ent );
50
51 missile->classname = "atst_main_proj";
52 missile->s.weapon = WP_ATST_MAIN;
53
54 missile->damage = weaponData[WP_ATST_MAIN].damage;
55 missile->dflags = DAMAGE_DEATH_KNOCKBACK|DAMAGE_HEAVY_WEAP_CLASS;
56 missile->methodOfDeath = MOD_ENERGY;
57 missile->clipmask = MASK_SHOT | CONTENTS_LIGHTSABER;
58
59 missile->owner = ent;
60
61 VectorSet( missile->maxs, ATST_MAIN_SIZE, ATST_MAIN_SIZE, ATST_MAIN_SIZE );
62 VectorScale( missile->maxs, -1, missile->mins );
63
64 }
65
66 // ATST Alt Side
67 //---------------------------------------------------------
WP_ATSTSideAltFire(gentity_t * ent)68 void WP_ATSTSideAltFire( gentity_t *ent )
69 //---------------------------------------------------------
70 {
71 int damage = weaponData[WP_ATST_SIDE].altDamage;
72 float vel = ATST_SIDE_ALT_NPC_VELOCITY;
73
74 if ( ent->client && (ent->client->ps.eFlags & EF_IN_ATST ))
75 {
76 vel = ATST_SIDE_ALT_VELOCITY;
77 }
78
79 gentity_t *missile = CreateMissile( wpMuzzle, wpFwd, vel, 10000, ent, qtrue );
80
81 missile->classname = "atst_rocket";
82 missile->s.weapon = WP_ATST_SIDE;
83
84 missile->mass = 10;
85
86 // Do the damages
87 if ( ent->s.number != 0 )
88 {
89 if ( g_spskill->integer == 0 )
90 {
91 damage = ATST_SIDE_ROCKET_NPC_DAMAGE_EASY;
92 }
93 else if ( g_spskill->integer == 1 )
94 {
95 damage = ATST_SIDE_ROCKET_NPC_DAMAGE_NORMAL;
96 }
97 else
98 {
99 damage = ATST_SIDE_ROCKET_NPC_DAMAGE_HARD;
100 }
101 }
102
103 VectorCopy( wpFwd, missile->movedir );
104
105 // Make it easier to hit things
106 VectorSet( missile->maxs, ATST_SIDE_ALT_ROCKET_SIZE, ATST_SIDE_ALT_ROCKET_SIZE, ATST_SIDE_ALT_ROCKET_SIZE );
107 VectorScale( missile->maxs, -1, missile->mins );
108
109 missile->damage = damage;
110 missile->dflags = DAMAGE_DEATH_KNOCKBACK | DAMAGE_HEAVY_WEAP_CLASS;
111 missile->methodOfDeath = MOD_EXPLOSIVE;
112 missile->splashMethodOfDeath = MOD_EXPLOSIVE_SPLASH;
113 missile->clipmask = MASK_SHOT | CONTENTS_LIGHTSABER;
114
115 // Scale damage down a bit if it is coming from an NPC
116 missile->splashDamage = weaponData[WP_ATST_SIDE].altSplashDamage * ( ent->s.number == 0 ? 1.0f : ATST_SIDE_ALT_ROCKET_SPLASH_SCALE );
117 missile->splashRadius = weaponData[WP_ATST_SIDE].altSplashRadius;
118
119 // we don't want it to ever bounce
120 missile->bounceCount = 0;
121 }
122
123 // ATST Side
124 //---------------------------------------------------------
WP_ATSTSideFire(gentity_t * ent)125 void WP_ATSTSideFire( gentity_t *ent )
126 //---------------------------------------------------------
127 {
128 int damage = weaponData[WP_ATST_SIDE].damage;
129
130 gentity_t *missile = CreateMissile( wpMuzzle, wpFwd, ATST_SIDE_MAIN_VELOCITY, 10000, ent, qfalse );
131
132 missile->classname = "atst_side_proj";
133 missile->s.weapon = WP_ATST_SIDE;
134
135 // Do the damages
136 if ( ent->s.number != 0 )
137 {
138 if ( g_spskill->integer == 0 )
139 {
140 damage = ATST_SIDE_MAIN_NPC_DAMAGE_EASY;
141 }
142 else if ( g_spskill->integer == 1 )
143 {
144 damage = ATST_SIDE_MAIN_NPC_DAMAGE_NORMAL;
145 }
146 else
147 {
148 damage = ATST_SIDE_MAIN_NPC_DAMAGE_HARD;
149 }
150 }
151
152 VectorSet( missile->maxs, ATST_SIDE_MAIN_SIZE, ATST_SIDE_MAIN_SIZE, ATST_SIDE_MAIN_SIZE );
153 VectorScale( missile->maxs, -1, missile->mins );
154
155 missile->damage = damage;
156 missile->dflags = DAMAGE_DEATH_KNOCKBACK|DAMAGE_HEAVY_WEAP_CLASS;
157 missile->methodOfDeath = MOD_ENERGY;
158 missile->clipmask = MASK_SHOT | CONTENTS_LIGHTSABER;
159
160 missile->splashDamage = weaponData[WP_ATST_SIDE].splashDamage * ( ent->s.number == 0 ? 1.0f : 0.6f );
161 missile->splashRadius = weaponData[WP_ATST_SIDE].splashRadius;
162
163 // we don't want it to bounce
164 missile->bounceCount = 0;
165 }