Lets make the L button fire Lweapons.
below W_attack void add this-
void() Lfire=
{
local float r;
if (!W_CheckNoAmmo ())
return;
makevectors (self.v_angle); // calculate forward angle for velocity
self.show_hostile = time + 1; // wake monsters up
if (self.weapon != IT_LWEAPON1 && self.weapon != IT_LWEAPON2 && self.weapon != IT_LWEAPON3) { self.weapon = IT_LWEAPON1; }
else if (self.weapon == IT_LWEAPON1)
{
//Lweapon1 code
}
else if (self.weapon == IT_LWEAPON2)
{
//Lweapon2 code
}
else if (self.weapon == IT_LWEAPON3)
{
//Lweapon3 code
}
};
Then before cycleweaponcommand add-
void() Lcycle = {
local float it, am;
it = self.items;
self.impulse = 0;
while (1)
{
am = 0;
if (self.weapon != IT_LWEAPON1 && self.weapon != IT_LWEAPON2 && self.weapon != IT_LWEAPON3) { self.weapon = IT_LWEAPON1; }
else if (self.weapon == IT_LWEAPON1) { self.weapon = IT_LWEAPON2; }
else if (self.weapon == IT_LWEAPON2) { self.weapon = IT_LWEAPON3; }
else if (self.weapon == IT_LWEAPON3) { self.weapon = IT_LWEAPON1; }
}
};
To get r to switch back before fireing goto W_attack there after-
void() W_Attack =
{
local float r;
if (!W_CheckNoAmmo ())
return;
makevectors (self.v_angle); // calculate forward angle for velocity
self.show_hostile = time + 1; // wake monsters up
add the check code-
if (self.weapon == IT_LWEAPON1 || self.weapon == IT_LWEAPON2 || self.weapon == IT_LWEAPON3) { self.weapon = IT_AXE; }
go down to the impulse command and add-
if (self.impulse == 29)
Lfire ();
if (self.impulse == 30)
Lcycle();
then in the config file in id1 add-
bind LEFT_SHIFT "impulse 29"
bind K_DOWN "impulse 30"