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
43 local vector trueaim;
\r
44 org = self.origin + self.view_ofs;
\r
45 end = self.origin + self.view_ofs + v_forward * 4096;
\r
46 traceline(org,end,TRUE,self);
\r
48 trueaim = trace_endpos;
\r
50 sound (self, CHAN_WEAPON, "weapons/shotgun_fire.wav", 1, ATTN_NORM);
\r
51 bullets = cvar("g_balance_shotgun_bullets");
\r
52 d = cvar("g_balance_shotgun_damage");
\r
54 org = self.origin + self.view_ofs + (v_right * 6) - (v_up * 8) + (v_forward * 5);
\r
55 spread = cvar("g_balance_shotgun_spread");
\r
56 for (sc = 0;sc < bullets;sc = sc + 1)
\r
57 fireBullet2 (org, normalize(trueaim - org), spread, d, WEP_SHOTGUN, sc < 3, cvar("g_balance_shotgun_force"));
\r
58 self.currentammo = self.currentammo - 1;
\r
61 if (cvar("g_casings") >= 1)
\r
63 org = self.origin + self.view_ofs + (v_right * 6) - (v_up * 8) + (v_forward * 10);
\r
64 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
67 org = self.origin + self.view_ofs + (v_right * 6) - (v_up * 8) + (v_forward * 20);
\r
68 W_Smoke(org, v_forward, 12);
\r
69 //te_smallflash(org);
\r
71 self.punchangle_x = -5;
\r
76 void() shotgun_ready_01 = {weapon_thinkf(WFRAME_IDLE, 0.1, shotgun_ready_01); self.weaponentity.state = WS_READY;};
\r
77 void() shotgun_select_01 = {
\r
78 self.currentammo = cvar("g_balance_shotgun_clipsize");
\r
79 weapon_thinkf(-1, cvar("g_balance_weaponswitchdelay"), w_ready); weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, '0 0 0');
\r
81 void() shotgun_deselect_01 = {weapon_thinkf(-1, cvar("g_balance_weaponswitchdelay"), w_clear); weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, PLAYER_WEAPONSELECTION_RANGE);};
\r
83 void() shotgun_reload_02 =
\r
85 self.currentammo = self.currentammo + 1;
\r
86 shotgun_ready_01(); // return to ready state if not already there
\r
89 void() shotgun_reload_01 =
\r
91 if(self.currentammo >= cvar("g_balance_shotgun_clipsize"))
\r
93 if(self.weaponentity.state != WS_READY)
\r
94 shotgun_ready_01(); // return to ready state if not already there
\r
97 // if we somehow reached negative, fix that first
\r
98 if(self.currentammo < 0)
\r
99 self.currentammo = 0;
\r
101 sound (self, CHAN_WEAPON, "weapons/shotgun_reload.wav", 1, ATTN_NORM);
\r
104 weapon_thinkf(WFRAME_FIRE2, cvar("g_balance_shotgun_loadclip2"), shotgun_reload_02);
\r
107 // after firing, call this funtion to check if the shotgun is empty
\r
108 void() shotgun_checkempty_01 =
\r
110 if(self.currentammo >= 1)
\r
111 { // we don't need to force a reload
\r
112 shotgun_ready_01();
\r
116 shotgun_reload_01();
\r
119 void() shotgun_fire1_01 =
\r
121 weapon_doattack(shotgun_check, shotgun_check, W_Shotgun_Attack);
\r
122 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_shotgun_refire"), shotgun_checkempty_01);
\r
124 void() shotgun_fire2_01 =
\r
126 shotgun_reload_01();
\r