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;
7 float() shotgun_check =
9 if (self.ammo_shells >= cvar("g_balance_shotgun_primary_ammo"))
14 float() shotgun_check2 =
16 if (self.ammo_shells >= cvar("g_balance_shotgun_secondary_ammo"))
21 void(float req) w_shotgun =
25 else if (req == WR_FIRE1)
26 weapon_prepareattack(shotgun_check, shotgun_check, shotgun_fire1_01, cvar("g_balance_shotgun_primary_refire"));
27 else if (req == WR_FIRE2)
28 weapon_prepareattack(shotgun_check2, shotgun_check2, shotgun_fire2_01, cvar("g_balance_shotgun_secondary_refire"));
29 else if (req == WR_RAISE)
31 else if (req == WR_UPDATECOUNTS)
32 self.currentammo = self.ammo_shells;
33 else if (req == WR_DROP)
34 shotgun_deselect_01();
35 else if (req == WR_SETUP)
36 weapon_setup(WEP_SHOTGUN, "w_shotgun.zym", IT_SHELLS);
37 else if (req == WR_CHECKAMMO)
38 weapon_hasammo = shotgun_check() + shotgun_check2();
41 void W_Shotgun_Attack (void)
50 trueaim = W_TrueAim();
52 sound (self, CHAN_WEAPON, "weapons/shotgun_fire.ogg", 1, ATTN_NORM);
53 if (self.items & IT_STRENGTH) {
54 sound (self, CHAN_AUTO, "weapons/strength_fire.ogg", 1, ATTN_NORM);
57 bullets = cvar("g_balance_shotgun_primary_bullets");
58 d = cvar("g_balance_shotgun_primary_damage");
60 org = self.origin + self.view_ofs + (v_right * 6) - (v_up * 8) + (v_forward * 5);
61 spread = cvar("g_balance_shotgun_primary_spread");
62 for (sc = 0;sc < bullets;sc = sc + 1)
63 fireBullet (org, normalize(trueaim - org), spread, d, IT_SHOTGUN, sc < 3);
64 if (cvar("g_use_ammunition"))
65 self.ammo_shells = self.ammo_shells - cvar("g_balance_shotgun_primary_ammo");
68 if (cvar("g_casings") >= 1)
70 org = self.origin + self.view_ofs + (v_right * 6) - (v_up * 8) + (v_forward * 10);
71 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);
74 org = self.origin + self.view_ofs + (v_right * 6) - (v_up * 8) + (v_forward * 20);
75 W_Smoke(org, v_forward, 12);
78 self.punchangle_x = -5;
81 void W_Shotgun_Attack2 (void)
90 trueaim = W_TrueAim();
92 sound (self, CHAN_WEAPON, "weapons/shotgun_fire.ogg", 1, ATTN_NORM);
93 if (self.items & IT_STRENGTH) {
94 sound (self, CHAN_AUTO, "weapons/strength_fire.ogg", 1, ATTN_NORM);
97 bullets = cvar("g_balance_shotgun_secondary_bullets");
98 d = cvar("g_balance_shotgun_secondary_damage");
100 org = self.origin + self.view_ofs + (v_right * 6) - (v_up * 8) + (v_forward * 5);
101 spread = cvar("g_balance_shotgun_secondary_spread");
102 for (sc = 0;sc < bullets;sc = sc + 1)
103 fireBullet (org, normalize(trueaim - org), spread, d, IT_SHOTGUN, sc < 3);
104 if (cvar("g_use_ammunition"))
105 self.ammo_shells = self.ammo_shells - cvar("g_balance_shotgun_secondary_ammo");
108 if (cvar("g_casings") >= 1)
110 org = self.origin + self.view_ofs + (v_right * 6) - (v_up * 8) + (v_forward * 10);
111 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);
114 org = self.origin + self.view_ofs + (v_right * 6) - (v_up * 8) + (v_forward * 20);
115 W_Smoke(org, v_forward, 12);
116 //te_smallflash(org);
118 self.punchangle_x = -5;
123 void() shotgun_ready_01 = {weapon_thinkf(WFRAME_IDLE, 0.1, shotgun_ready_01); self.weaponentity.state = WS_READY;};
124 void() shotgun_select_01 = {weapon_thinkf(-1, cvar("g_balance_weaponswitchdelay"), w_ready); weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, '0 0 0');};
125 void() shotgun_deselect_01 = {weapon_thinkf(-1, cvar("g_balance_weaponswitchdelay"), w_clear); weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, PLAYER_WEAPONSELECTION_RANGE);};
126 void() shotgun_fire1_01 =
128 weapon_doattack(shotgun_check, shotgun_check, W_Shotgun_Attack);
129 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_shotgun_primary_animtime"), shotgun_ready_01);
131 void() shotgun_fire2_03 =
133 weapon_doattack(shotgun_check, shotgun_check, W_Shotgun_Attack2);
134 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_shotgun_secondary_animtime"), shotgun_ready_01);
136 void() shotgun_fire2_02 =
138 weapon_doattack(shotgun_check, shotgun_check, W_Shotgun_Attack2);
139 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_shotgun_secondary_animtime"), shotgun_fire2_03);
141 void() shotgun_fire2_01 =
143 weapon_doattack(shotgun_check, shotgun_check, W_Shotgun_Attack2);
144 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_shotgun_secondary_animtime"), shotgun_fire2_02);