]> icculus.org git repositories - divverent/nexuiz.git/blob - qcsrc/gamec/w_nex.c
Got rid of third attack and replaced it with a zoom
[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 > 0) 
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 * 18 + v_right * 8 + v_up * -5;
45         te_smallflash(org);
46
47         if (game & GAME_INSTAGIB)
48                 FireRailgunBullet (org, self.origin + self.view_ofs + v_forward * 4096, 800, IT_NEX);
49         else
50                 FireRailgunBullet (org, self.origin + self.view_ofs + v_forward * 4096, 100, IT_NEX);
51
52         te_plasmaburn (trace_endpos);
53
54         if (trace_fraction < 1.0)
55         {
56                 dir = trace_plane_normal * 100;
57                 WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
58                 WriteByte (MSG_BROADCAST, TE_FLAMEJET);
59                 WriteCoord (MSG_BROADCAST, trace_endpos_x);
60                 WriteCoord (MSG_BROADCAST, trace_endpos_y);
61                 WriteCoord (MSG_BROADCAST, trace_endpos_z);
62                 WriteCoord (MSG_BROADCAST, dir_x);
63                 WriteCoord (MSG_BROADCAST, dir_y);
64                 WriteCoord (MSG_BROADCAST, dir_z);
65                 WriteByte (MSG_BROADCAST, 255);
66
67                 explosion = spawn ();
68                 setorigin (explosion, trace_endpos);
69                 RadiusDamage (explosion, self, 10, 0, 50, world, 300, IT_ROCKET_LAUNCHER);
70                 remove (explosion);
71
72                 PointSound (trace_endpos, "weapons/neximpact.wav", 1, ATTN_NORM);
73         }
74
75         self.attack_finished = time + 1;
76
77         if (!(game & GAME_INSTAGIB))
78                 self.ammo_cells = self.ammo_cells - 1;
79 }
80
81 void W_Nex_Attack2 (void)
82 {
83         makevectors(self.v_angle);
84 }
85
86 // weapon frames 
87 void()  nex_ready_01 =  {weapon_thinkf(WFRAME_IDLE, 0.1, nex_ready_01); self.weaponentity.state = WS_READY;};
88 void()  nex_select_01 = {weapon_thinkf(-1, PLAYER_WEAPONSELECTION_DELAY, w_ready); weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, '0 0 0');};
89 void()  nex_deselect_01 =       {weapon_thinkf(-1, PLAYER_WEAPONSELECTION_DELAY, w_clear); weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, PLAYER_WEAPONSELECTION_RANGE);};
90 void()  nex_fire1_01 =  
91 {
92         weapon_doattack(nex_check, nex_check, W_Nex_Attack);
93         weapon_thinkf(WFRAME_FIRE1, 0.3, nex_ready_01);
94 };
95 void()  nex_fire2_01 =  
96 {
97         weapon_doattack(nex_check, nex_check, W_Nex_Attack);
98         weapon_thinkf(WFRAME_FIRE2, 0.5, nex_ready_01);
99 };
100