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 // Emplaced Gun
32 //---------------------------------------------------------
WP_EmplacedFire(gentity_t * ent)33 void WP_EmplacedFire( gentity_t *ent )
34 //---------------------------------------------------------
35 {
36 float damage = weaponData[WP_EMPLACED_GUN].damage * ( ent->NPC ? 0.1f : 1.0f );
37 float vel = EMPLACED_VEL * ( ent->NPC ? 0.4f : 1.0f );
38
39 gentity_t *missile = CreateMissile( wpMuzzle, wpFwd, vel, 10000, ent );
40
41 missile->classname = "emplaced_proj";
42 missile->s.weapon = WP_EMPLACED_GUN;
43
44 missile->damage = damage;
45 missile->dflags = DAMAGE_DEATH_KNOCKBACK | DAMAGE_HEAVY_WEAP_CLASS;
46 missile->methodOfDeath = MOD_EMPLACED;
47 missile->clipmask = MASK_SHOT | CONTENTS_LIGHTSABER;
48
49 // do some weird switchery on who the real owner is, we do this so the projectiles don't hit the gun object
50 missile->owner = ent->owner;
51
52 VectorSet( missile->maxs, EMPLACED_SIZE, EMPLACED_SIZE, EMPLACED_SIZE );
53 VectorScale( missile->maxs, -1, missile->mins );
54
55 // alternate wpMuzzles
56 ent->fxID = !ent->fxID;
57 }