]> icculus.org git repositories - divverent/nexuiz.git/blob - qcsrc/gamec/w_uzi.c
changed weapons/ammo cheat to give 999 ammo
[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 >= 1)
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, cvar("g_balance_uzi_refire"));
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_NAILS);
30         else if (req == WR_CHECKAMMO)
31                 weapon_hasammo = uzi_check();
32 };
33
34 .float uzi_bulletcounter;
35 void W_Uzi_Attack (void)
36 {
37         local vector org;
38         makevectors(self.v_angle);
39         sound (self, CHAN_WEAPON, "weapons/uzi_fire.wav", 1, ATTN_NORM);
40
41         org = self.origin + self.view_ofs + (v_right * 6) - (v_up * 8) + (v_forward * 15);
42         self.uzi_bulletcounter = self.uzi_bulletcounter + 1;
43         if (self.uzi_bulletcounter >= 4)
44                 self.uzi_bulletcounter = 0;
45         fireBullet (org, v_forward, cvar("g_balance_uzi_spread"), cvar("g_balance_uzi_damage"), IT_UZI, self.uzi_bulletcounter == 0);
46
47         self.punchangle_x = random () - 0.5;
48         self.punchangle_y = random () - 0.5;
49         self.punchangle_z = random () - 0.5;
50
51         //self.attack_finished = time + 0.2;
52         self.ammo_nails = self.ammo_nails - 0.25;
53
54         // casing code
55         if (cvar("g_casings") == 1)
56         {
57                 org = self.origin + self.view_ofs + (v_right * 6) - (v_up * 8) + (v_forward * 10);
58                 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);
59         }
60 }
61
62 void W_Uzi_Attack2 (void)
63 {
64
65
66 }
67 // weapon frames
68
69 void()  uzi_ready_01 =  {weapon_thinkf(WFRAME_IDLE, 0.1, uzi_ready_01); self.weaponentity.state = WS_READY;};
70 void()  uzi_select_01 = {weapon_thinkf(-1, cvar("g_balance_weaponswitchdelay"), w_ready); weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, '0 0 0');};
71 void()  uzi_deselect_01 =       {weapon_thinkf(-1, cvar("g_balance_weaponswitchdelay"), w_clear); weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, PLAYER_WEAPONSELECTION_RANGE);};
72 void()  uzi_fire1_01 =
73 {
74         weapon_doattack(uzi_check, uzi_check, W_Uzi_Attack);
75         if (self.button0)
76                 weapon_thinkf(WFRAME_FIRE1, 0.05, uzi_fire1_01);
77         else
78                 weapon_thinkf(WFRAME_FIRE1, 0.05, uzi_ready_01);
79 };
80 void()  uzi_fire2_01 =
81 {
82         weapon_doattack(uzi_check, uzi_check, W_Uzi_Attack2);
83         weapon_thinkf(WFRAME_FIRE2, 0.05, uzi_ready_01);
84 };