]> icculus.org git repositories - divverent/nexuiz.git/blob - qcsrc/gamec/w_uzi.c
Got rid of third attack and replaced it with a zoom
[divverent/nexuiz.git] / qcsrc / gamec / w_uzi.c
1 void() uzi_ready_01;
2 void() uzi_fire1_01;
3 void() uzi_fire2_01;
4 void() uzi_deselect_01;
5 void() uzi_select_01;
6
7 float() uzi_check = 
8 {
9         if (self.ammo_nails > 0)
10                 return TRUE;
11         return FALSE;
12 };
13
14 void(float req) w_uzi =
15 {
16         if (req == WR_IDLE)
17                 uzi_ready_01();
18         else if (req == WR_FIRE1)
19                 weapon_prepareattack(uzi_check, uzi_check, uzi_fire1_01, 0.075);
20         else if (req == WR_FIRE2)
21                 weapon_prepareattack(uzi_check, uzi_check, uzi_fire2_01, 0.4);
22         else if (req == WR_RAISE)
23                 uzi_select_01();
24         else if (req == WR_UPDATECOUNTS)
25                 self.currentammo = self.ammo_nails;
26         else if (req == WR_DROP)
27                 uzi_deselect_01();
28         else if (req == WR_SETUP)
29                 weapon_setup(WEP_UZI, "w_uzi.zym", IT_SHELLS);
30         else if (req == WR_CHECKAMMO)
31                 weapon_hasammo = uzi_check();
32 };               
33
34 void W_Uzi_Attack (void)
35 {
36         makevectors(self.v_angle);
37         sound (self, CHAN_WEAPON, "weapons/uzi_fire.wav", 1, ATTN_NORM);
38
39         fireBullet (v_forward, 100, 5, IT_UZI);
40
41         self.punchangle_x = random () - 0.5;
42         self.punchangle_y = random () - 0.5;
43         self.punchangle_z = random () - 0.5;
44
45         self.attack_finished = time + 0.075;
46         self.ammo_nails = self.ammo_nails - 1;
47
48         vector  org; // casing code
49         org = self.origin + self.view_ofs + (v_right * 6) - (v_up * 1) + (v_forward * 20);
50         SpawnCasing (org, ((random () * 50 + 50) * v_right) - ((random () * 25 + 25) * v_forward) - ((random () * 5 + 10) * v_up), 2, v_forward,'0 250 0', 100, 2);
51         //W_Smoke(org, v_forward, 12);
52 }
53
54 void W_Uzi_Attack2 (void)
55 {
56         makevectors(self.v_angle);
57         sound (self, CHAN_WEAPON, "weapons/uzi_fire.wav", 1, ATTN_NORM);
58
59         fireBullet (v_forward, 0, 10, IT_UZI);
60
61         self.attack_finished = time + 0.16;
62         self.ammo_nails = self.ammo_nails - 1;
63
64         vector  org; // casing code
65         org = self.origin + self.view_ofs + (v_right * 6) - (v_up * 1) + (v_forward * 20);
66         SpawnCasing (org, ((random () * 50 + 50) * v_right) - ((random () * 25 + 25) * v_forward) - ((random () * 5 + 10) * v_up), 2, v_forward,'0 250 0', 100, 2);
67 }
68 // weapon frames 
69
70 void()  uzi_ready_01 =  {weapon_thinkf(WFRAME_IDLE, 0.1, uzi_ready_01); self.weaponentity.state = WS_READY;};
71 void()  uzi_select_01 = {weapon_thinkf(-1, PLAYER_WEAPONSELECTION_DELAY, w_ready); weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, '0 0 0');};
72 void()  uzi_deselect_01 =       {weapon_thinkf(-1, PLAYER_WEAPONSELECTION_DELAY, w_clear); weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, PLAYER_WEAPONSELECTION_RANGE);};
73 void()  uzi_fire1_01 =  
74 {
75         weapon_doattack(uzi_check, uzi_check, W_Uzi_Attack);
76         if (self.button0)
77                 weapon_thinkf(WFRAME_FIRE1, 0.075, uzi_fire1_01);
78         else
79                 weapon_thinkf(WFRAME_FIRE1, 0.075, uzi_ready_01);
80 };
81 void()  uzi_fire2_01 =  
82 {
83         weapon_doattack(uzi_check, uzi_check, W_Uzi_Attack2);
84         if (self.button0)
85                 weapon_thinkf(WFRAME_FIRE2, 0.16, uzi_fire2_01);
86         else
87                 weapon_thinkf(WFRAME_FIRE2, 0.1, uzi_ready_01);
88 };