//=============================================================================
// 
//=============================================================================
class SniperTest extends DeusExWeapon;

var float ZoomingScale, ZoomGrow, MaxZoom, MinZoom;

replication
{
	reliable if(Role<ROLE_Authority)
		UpdateScope;

	reliable if(Role==ROLE_Authority)
		ZoomingScale, ZoomIn, ZoomOut;

}



function UpdateScope(float ZoomFOV, bool bScoping)
{
	ScopeFOV = ZoomFOV;
	bZoomed  = bScoping;
	RefreshScopeDisplay(DeusExPlayer(Owner), False, bZoomed);
}


function ScopeOn()
{
	if (bHasScope && !bZoomed && Owner.IsA('DeusExPlayer'))
	{
		bZoomed = True;
		RefreshScopeDisplay(DeusExPlayer(Owner), False, bZoomed);
	}
}

function ScopeOff()
{
	if (bHasScope && bZoomed && Owner.IsA('DeusExPlayer'))
	{
		bZoomed = False;
		RefreshScopeDisplay(DeusExPlayer(Owner), False, bZoomed);
	}
}


simulated function RefreshScopeDisplay(DeusExPlayer player, bool bInstant, bool bScopeOn)
{
	if (bScopeOn && (Player !=None))
	{
		DeusExRootWindow(Player.RootWindow).ScopeView.ActivateView(ScopeFOV, False, bInstant);
	}

	else if (!bScopeOn)
	{
		DeusExRootWindow(Player.RootWindow).ScopeView.DeActivateView();
	}
}


function ScopeToggle()
{
	if(!bZoomed)
	{
		ScopeOn();
	}
	else
	{
		ScopeOff();
	}
}



simulated function bool ZoomOut()
{
	if(bZoomed)
	{
		bZoomed=True;

		if(ZoomingScale < MaxZoom)
		{
			ZoomingScale += ZoomGrow;

			//ZoomingScale=MaxZoom;
			ScopeFOV=80*ZoomingScale;
			UpdateScope(ScopeFOV,True);
		}
	}

	return bZoomed;
}

simulated function bool ZoomIn()
{
	if(bZoomed)
	{
		bZoomed=True;

		if(ZoomingScale > MinZoom)
		{
			ZoomingScale -= ZoomGrow;

			//ZoomingScale=MinZoom;
			ScopeFOV=80*ZoomingScale;
			UpdateScope(ScopeFOV,True);
		}

		return bZoomed;
	}
}


defaultproperties
{
     MaxZoom=1.500000
     MinZoom=0.200000
     LowAmmoWaterMark=6
     ZoomingScale=0.100000
     ZoomGrow=0.100000
     GoverningSkill=Class'DeusEx.SkillWeaponRifle'
     NoiseLevel=2.000000
     EnviroEffective=ENVEFF_Air
     ShotTime=2.000000
     reloadTime=2.000000
     HitDamage=40
     maxRange=48000
     AccurateRange=48800
     BaseAccuracy=0.000000
     bCanHaveScope=True
     bHasScope=True
     ScopeFOV=25
     bCanHaveLaser=True
     bCanHaveSilencer=True
     bHasMuzzleFlash=False
     recoilStrength=0.100000
     bUseWhileCrouched=False
     bCanHaveModBaseAccuracy=True
     bCanHaveModReloadCount=True
     bCanHaveModAccurateRange=True
     bCanHaveModReloadTime=True
     bCanHaveModRecoilStrength=True
     AmmoName=Class'DeusEx.Ammo3006'
     ReloadCount=1
     PickupAmmoCount=25
     bInstantHit=True
     FireOffset=(X=-20.000000,Y=2.000000,Z=30.000000)
     shakemag=50.000000
     FireSound=Sound'DeusExSounds.Weapons.RifleFire'
     AltFireSound=Sound'DeusExSounds.Weapons.RifleReloadEnd'
     CockingSound=Sound'DeusExSounds.Weapons.RifleReload'
     SelectSound=Sound'DeusExSounds.Weapons.SawedOffShotgunSelect'
     InventoryGroup=98
     ItemName="Sniper Rifle"
     ItemArticle="a"
     PlayerViewOffset=(X=20.000000,Y=-2.000000,Z=-30.000000)
     PlayerViewMesh=LodMesh'DeusExItems.SniperRifle'
     PickupViewMesh=LodMesh'DeusExItems.SniperRiflePickup'
     ThirdPersonMesh=LodMesh'DeusExItems.SniperRifle3rd'
     LandSound=Sound'DeusExSounds.Generic.DropMediumWeapon'
     Icon=Texture'DeusExUI.Icons.BeltIconRifle'
     largeIcon=Texture'DeusExUI.Icons.LargeIconRifle'
     largeIconWidth=159
     largeIconHeight=47
     invSlotsX=4
     Description="you're nailed"
     beltDescription="RIFLE"
     Mesh=LodMesh'DeusExItems.SniperRiflePickup'
     CollisionRadius=26.000000
     CollisionHeight=2.000000
     Mass=30.000000
}
