1 void() shotgun_ready_01;
\r
2 void() shotgun_fire1_01;
\r
3 void() shotgun_fire2_01;
\r
4 void() shotgun_deselect_01;
\r
5 void() shotgun_select_01;
\r
7 float() shotgun_check =
\r
9 // if (self.ammo_shells >= 1)
\r
14 void(float req) w_shotgun =
\r
18 else if (req == WR_FIRE1)
\r
19 weapon_prepareattack(shotgun_check, shotgun_check, shotgun_fire1_01, cvar("g_balance_shotgun_refire"));
\r
20 else if (req == WR_FIRE2)
\r
21 weapon_prepareattack(shotgun_check, shotgun_check, shotgun_fire2_01, cvar("g_balance_shotgun_loadclip"));
\r
22 else if (req == WR_RAISE)
\r
23 shotgun_select_01();
\r
24 else if (req == WR_UPDATECOUNTS)
\r
25 return;//self.currentammo = self.ammo_shells;
\r
26 else if (req == WR_DROP)
\r
27 shotgun_deselect_01();
\r
28 else if (req == WR_SETUP)
\r
29 weapon_setup(WEP_SHOTGUN, "w_shotgun.zym", IT_SHELLS);
\r
30 else if (req == WR_CHECKAMMO)
\r
31 weapon_hasammo = shotgun_check();
\r
34 void W_Shotgun_Attack (void)
\r
42 sound (self, CHAN_WEAPON, "weapons/shotgun_fire.wav", 1, ATTN_NORM);
\r
43 bullets = cvar("g_balance_shotgun_bullets");
\r
44 d = cvar("g_balance_shotgun_damage");
\r
46 org = self.origin + self.view_ofs + (v_right * 6) - (v_up * 8) + (v_forward * 5);
\r
47 spread = cvar("g_balance_shotgun_spread");
\r
48 for (sc = 0;sc < bullets;sc = sc + 1)
\r
49 fireBullet2 (org, v_forward, spread, d, WEP_SHOTGUN, sc < 3, cvar("g_balance_shotgun_force"));
\r
50 self.currentammo = self.currentammo - 1;
\r
53 if (cvar("g_casings") >= 1)
\r
55 org = self.origin + self.view_ofs + (v_right * 6) - (v_up * 8) + (v_forward * 10);
\r
56 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);
\r
59 org = self.origin + self.view_ofs + (v_right * 6) - (v_up * 8) + (v_forward * 20);
\r
60 W_Smoke(org, v_forward, 12);
\r
61 //te_smallflash(org);
\r
63 self.punchangle_x = -5;
\r
68 void() shotgun_ready_01 = {weapon_thinkf(WFRAME_IDLE, 0.1, shotgun_ready_01); self.weaponentity.state = WS_READY;};
\r
69 void() shotgun_select_01 = {
\r
70 self.currentammo = cvar("g_balance_shotgun_clipsize");
\r
71 weapon_thinkf(-1, cvar("g_balance_weaponswitchdelay"), w_ready); weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, '0 0 0');
\r
73 void() shotgun_deselect_01 = {weapon_thinkf(-1, cvar("g_balance_weaponswitchdelay"), w_clear); weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, PLAYER_WEAPONSELECTION_RANGE);};
\r
75 void() shotgun_reload_02 =
\r
77 self.currentammo = self.currentammo + 1;
\r
78 shotgun_ready_01(); // return to ready state if not already there
\r
81 void() shotgun_reload_01 =
\r
83 if(self.currentammo >= cvar("g_balance_shotgun_clipsize"))
\r
85 if(self.weaponentity.state != WS_READY)
\r
86 shotgun_ready_01(); // return to ready state if not already there
\r
89 // if we somehow reached negative, fix that first
\r
90 if(self.currentammo < 0)
\r
91 self.currentammo = 0;
\r
93 sound (self, CHAN_WEAPON, "weapons/shotgun_reload.wav", 1, ATTN_NORM);
\r
96 weapon_thinkf(WFRAME_FIRE2, cvar("g_balance_shotgun_loadclip2"), shotgun_reload_02);
\r
99 // after firing, call this funtion to check if the shotgun is empty
\r
100 void() shotgun_checkempty_01 =
\r
102 if(self.currentammo >= 1)
\r
103 { // we don't need to force a reload
\r
104 shotgun_ready_01();
\r
108 shotgun_reload_01();
\r
111 void() shotgun_fire1_01 =
\r
113 weapon_doattack(shotgun_check, shotgun_check, W_Shotgun_Attack);
\r
114 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_shotgun_refire"), shotgun_checkempty_01);
\r
116 void() shotgun_fire2_01 =
\r
118 shotgun_reload_01();
\r