]> icculus.org git repositories - divverent/nexuiz.git/blob - qcsrc/gamec/w_nex.c
Added crylink trails
[divverent/nexuiz.git] / qcsrc / gamec / w_nex.c
1 void() nex_ready_01;
2 void() nex_fire1_01;
3 void() nex_fire2_01;
4 void() nex_deselect_01;
5 void() nex_select_01;
6
7 float() nex_check =
8 {
9         if (self.ammo_cells >= 5)
10                 return TRUE;
11         return FALSE;
12 };
13
14 void(float req) w_nex =
15 {
16         if (req == WR_IDLE)
17                 nex_ready_01();
18         else if (req == WR_FIRE1)
19                 weapon_prepareattack(nex_check, nex_check, nex_fire1_01, 1);
20         else if (req == WR_FIRE2)
21                 weapon_prepareattack(nex_check, nex_check, nex_fire2_01, 1);
22         else if (req == WR_RAISE)
23                 nex_select_01();
24         else if (req == WR_UPDATECOUNTS)
25                 self.currentammo = self.ammo_cells;
26         else if (req == WR_DROP)
27                 nex_deselect_01();
28         else if (req == WR_SETUP)
29                 weapon_setup(WEP_NEX, "w_nex.zym", IT_CELLS);
30         else if (req == WR_CHECKAMMO)
31                 weapon_hasammo = nex_check();
32 };
33
34
35 void W_Nex_Attack (void)
36 {
37         vector  org;
38         vector  dir;
39         entity  explosion;
40
41         sound (self, CHAN_WEAPON, "weapons/nexfire.wav", 1, ATTN_NORM);
42         self.punchangle_x = -4;
43         makevectors(self.v_angle);
44         org = self.origin + self.view_ofs + v_forward * 28 + v_right * 14 + v_up * -7;
45         te_smallflash(org);
46
47         FireRailgunBullet (org, self.origin + self.view_ofs + v_forward * 4096, cvar("g_balance_nex_damage"), IT_NEX);
48
49         self.attack_finished = time + 1;
50
51         if (!(game & GAME_INSTAGIB))
52                 self.ammo_cells = self.ammo_cells - 5;
53
54         entity  flash;
55         flash = spawn ();
56         //flash.drawonlytoclient;
57         org = self.origin + self.view_ofs + v_forward * 33 + v_right * 14 + v_up * -7;
58         setorigin (flash, org);
59         setmodel (flash, "models/nexflash.md3");
60         flash.velocity = v_forward * 20;
61         flash.angles = vectoangles (flash.velocity);
62         SUB_SetFade (flash, time);
63         flash.effects = flash.effects | EF_ADDITIVE;
64 }
65
66 void W_Nex_Attack2 (void)
67 {
68         makevectors(self.v_angle);
69 }
70
71 // weapon frames
72 void()  nex_ready_01 =  {weapon_thinkf(WFRAME_IDLE, 0.1, nex_ready_01); self.weaponentity.state = WS_READY;};
73 void()  nex_select_01 = {weapon_thinkf(-1, PLAYER_WEAPONSELECTION_DELAY, w_ready); weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, '0 0 0');};
74 void()  nex_deselect_01 =       {weapon_thinkf(-1, PLAYER_WEAPONSELECTION_DELAY, w_clear); weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, PLAYER_WEAPONSELECTION_RANGE);};
75 void()  nex_fire1_01 =
76 {
77         weapon_doattack(nex_check, nex_check, W_Nex_Attack);
78         weapon_thinkf(WFRAME_FIRE1, 0.3, nex_ready_01);
79 };
80 void()  nex_fire2_01 =
81 {
82         weapon_doattack(nex_check, nex_check, W_Nex_Attack);
83         weapon_thinkf(WFRAME_FIRE2, 0.5, nex_ready_01);
84 };
85