Thanks for the quick reply. I tried to experiment with that a little but I couldn't fix it. I think if you mute the sound based on altFire it doesn't solve the problem. I think I should find the way to remove the sound based on BUTTON_ALT_ATTACK which is mouse2 key.
Here are some prepositions from bg_pmove.c file.
line6222
Code:
if ( pm->ps->weaponstate == WEAPON_CHARGING )
{
// weapon has a charge, so let us do an attack
#ifdef _DEBUG
Com_Printf("Firing. Charge time=%d\n", pm->cmd.serverTime - pm->ps->weaponChargeTime);
#endif
// dumb, but since we shoot a charged weapon on button-up, we need to repress this button for now
pm->cmd.buttons |= BUTTON_ATTACK;
pm->ps->eFlags |= EF_FIRING;
}
else if ( pm->ps->weaponstate == WEAPON_CHARGING_ALT )
{
// weapon has a charge, so let us do an alt-attack
#ifdef _DEBUG
Com_Printf("Firing. Charge time=%d\n", pm->cmd.serverTime - pm->ps->weaponChargeTime);
#endif
// dumb, but since we shoot a charged weapon on button-up, we need to repress this button for now
pm->cmd.buttons |= BUTTON_ALT_ATTACK;
pm->ps->eFlags |= (EF_FIRING|EF_ALT_FIRING);
}
This one is basically from charged weapon section. Sniper rifle belongs to this section so the tirck might be in this. The reason I brought up this code is the comment: "// dumb, but since we shoot a charged weapon on button-up, we need to repress this button for now".
line7659
Code:
if ( pm->cmd.buttons & BUTTON_ALT_ATTACK ) {
//if ( pm->ps->weapon == WP_BRYAR_PISTOL && pm->gametype != GT_SIEGE )
if (0)
{ //kind of a hack for now
PM_AddEvent( EV_FIRE_WEAPON );
addTime = weaponData[pm->ps->weapon].fireTime;
}
else if (pm->ps->weapon == WP_DISRUPTOR && pm->ps->zoomMode != 1)
{
PM_AddEvent( EV_FIRE_WEAPON );
addTime = weaponData[pm->ps->weapon].fireTime;
}
else if (pm->ps->weapon == WP_BLASTER && pm->ps->zoomMode != 1)
{
PM_AddEvent( EV_FIRE_WEAPON );
addTime = weaponData[pm->ps->weapon].fireTime;
}
Another reference to alt_attack button. Only that I already set it for WP_BLASTER too.
line8229
Code:
if ( pm->ps->weapon == WP_DISRUPTOR || pm->ps->weapon == WP_BLASTER)
{
if ( pm->cmd.buttons & BUTTON_ATTACK && pm->ps->zoomMode == 1 && pm->ps->zoomLocked)
{
// converting the main fire to an alt-fire
pm->cmd.buttons |= BUTTON_ALT_ATTACK;
pm->ps->eFlags |= EF_ALT_FIRING;
}
else if ( pm->cmd.buttons & BUTTON_ALT_ATTACK && pm->ps->zoomMode == 1 && pm->ps->zoomLocked)
{
pm->cmd.buttons &= ~BUTTON_ALT_ATTACK;
pm->ps->eFlags &= ~EF_ALT_FIRING;
}
}
This is a segment of code within the scope script that converts alt_attack from mouse button 2 to mouse button 1 once you zoomed the scope. I included WP_BLASTER too so this works fine.
Now I think the problem is that somewhere it is set for WP_BLASTER (or perhaps all the non special weapon) that when you press BUTTON_ALT_ATTACK (mouse2) it also executes the alt_fire sound. Obviously sniper rifle does no attack sound when you are pressing mouse2 but it only does the zoomin sound. So I think I should be looking for
relation between the BUTTON_ALT_ATTACK and ALT_FIRE.mp3 sound rather than relation between altFire function and ALT_FIRE.mp3 sound. AltFire function is necessary for executing sound when pressing mouse1 when scope is on so I don't think I should mess with it.