]> icculus.org git repositories - divverent/nexuiz.git/blob - qcsrc/gamec/w_shotgun.c
Change some damages
[divverent/nexuiz.git] / qcsrc / gamec / w_shotgun.c
1 void() shotgun_ready_01;
2 void() shotgun_fire1_01;
3 void() shotgun_fire2_01;
4 void() shotgun_deselect_01;
5 void() shotgun_select_01;
6
7 float() shotgun_check = 
8 {
9         if (self.ammo_shells > 0)
10                 return TRUE;
11         return FALSE;
12 };
13
14 void(float req) w_shotgun =
15 {
16         if (req == WR_IDLE)
17                 shotgun_ready_01();
18         else if (req == WR_FIRE1)
19                 weapon_prepareattack(shotgun_check, shotgun_check, shotgun_fire1_01, 0.7);
20         else if (req == WR_FIRE2)
21                 weapon_prepareattack(shotgun_check, shotgun_check, shotgun_fire2_01, 0.7);
22         else if (req == WR_RAISE)
23                 shotgun_select_01();
24         else if (req == WR_UPDATECOUNTS)
25                 self.currentammo = self.ammo_shells;
26         else if (req == WR_DROP)
27                 shotgun_deselect_01();
28         else if (req == WR_SETUP)
29                 weapon_setup(WEP_SHOTGUN, "w_shotgun.zym", IT_SHELLS);
30         else if (req == WR_CHECKAMMO)
31                 weapon_hasammo = shotgun_check();
32 };               
33
34 void W_Shotgun_Attack (void)
35 {
36         float   sc;
37         float   bullets;
38
39         makevectors(self.v_angle);
40         sound (self, CHAN_WEAPON, "weapons/shotgun_fire.wav", 1, ATTN_NORM);
41         bullets = 10;
42
43         for (sc = bullets; sc > 0; sc = sc - 1)
44                 fireBullet (self.origin + self.view_ofs, v_forward, 0.05, 2, IT_SHOTGUN);
45         self.ammo_shells = self.ammo_shells - 1;
46         self.attack_finished = time + 0.7;
47
48         vector  org; // casing code
49         org = self.origin + self.view_ofs + (v_right * 6) - (v_up * 4) + (v_forward * 15);
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, 1);
51         org = self.origin + self.view_ofs + (v_right * 6) - (v_up * 4) + (v_forward * 20);
52         W_Smoke(org, v_forward, 12);
53         //te_smallflash(org);
54 }
55
56 void W_Shotgun_Attack2 (void)
57 {
58         float   sc;
59         float   bullets;
60
61         makevectors(self.v_angle);
62         sound (self, CHAN_WEAPON, "weapons/shotgun_fire.wav", 1, ATTN_NORM);
63         bullets = 10;
64
65         for (sc = bullets; sc > 0; sc = sc - 1)
66                 fireBullet (self.origin + self.view_ofs, v_forward, 0.05, 2, IT_SHOTGUN);
67         self.ammo_shells = self.ammo_shells - 1;
68         self.attack_finished = time + 1.4;
69
70         self.punchangle_x = -5;
71
72         vector  org; // casing code
73         org = self.origin + self.view_ofs + (v_right * 6) - (v_up * 4) + (v_forward * 15);
74         SpawnCasing (org, ((random () * 50 + 50) * v_right) - ((random () * 25 + 25) * v_forward) - ((random () * 5 + 10) * v_up), 2, v_forward,'0 250 0', 100, 1);
75         org = self.origin + self.view_ofs + (v_right * 6) - (v_up * 4) + (v_forward * 20);
76         W_Smoke(org, v_forward, 12);
77 }
78
79 // weapon frames 
80
81 void()  shotgun_ready_01 =      {weapon_thinkf(WFRAME_IDLE, 0.1, shotgun_ready_01); self.weaponentity.state = WS_READY;};
82 void()  shotgun_select_01 =     {weapon_thinkf(-1, PLAYER_WEAPONSELECTION_DELAY, w_ready); weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, '0 0 0');};
83 void()  shotgun_deselect_01 =   {weapon_thinkf(-1, PLAYER_WEAPONSELECTION_DELAY, w_clear); weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, PLAYER_WEAPONSELECTION_RANGE);};
84 void()  shotgun_fire1_01 =      
85 {
86         weapon_doattack(shotgun_check, shotgun_check, W_Shotgun_Attack);
87         weapon_thinkf(WFRAME_FIRE1, 0.3, shotgun_ready_01);
88 };
89 void()  shotgun_fire2_03 =
90 {
91         weapon_doattack(shotgun_check, shotgun_check, W_Shotgun_Attack2);
92         weapon_thinkf(WFRAME_FIRE1, 0.9, shotgun_ready_01);
93 }
94 void()  shotgun_fire2_02 =      
95 {
96         weapon_doattack(shotgun_check, shotgun_check, W_Shotgun_Attack2);
97         weapon_thinkf(WFRAME_FIRE1, 0.2, shotgun_fire2_03);
98 }
99 void()  shotgun_fire2_01 =      
100 {
101         weapon_doattack(shotgun_check, shotgun_check, W_Shotgun_Attack2);
102         weapon_thinkf(WFRAME_FIRE1, 0.2, shotgun_fire2_02);
103 }