Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //=============================================================================
- // SG552.
- //=============================================================================
- class SG552 expands CSWeapons;
- Var Bool bIsZoomed;
- Replication
- {
- Reliable If (bNetOwner && Role == ROLE_Authority)
- bIsZoomed;
- }
- simulated function PostRender( canvas Canvas )
- {
- // Super.PostRender(Canvas);
- bOwnsCrosshair = !bIsZoomed;
- if(!bIsZoomed)
- {
- if ((Canvas.SizeX == 1920) && (Canvas.SizeY == 1080))
- ClientSetMFlash(Default.FlashS, -0.11);
- else
- ClientSetMFlash(Default.FlashS, Default.FlashY);
- }
- Else if (bIsZoomed)
- {
- if ((Canvas.SizeX == 1920) && (Canvas.SizeY == 1080))
- ClientSetMFlash(-180, -0.17);
- else
- ClientSetMFlash(-180, -0.13);
- }
- }
- state NormalFire
- {
- function AltFire(float F)
- {
- Global.AltFire(0);
- }
- Begin:
- if (bIsZoomed)
- PlayAnim('Fire',AltFireRate, 0.04);
- Else
- PlayAnim('Fire',FireRate, 0.04);
- FinishAnim();
- if (ClipCount <= 5)
- Owner.PlaySound(Misc1Sound, SLOT_None, 3.5*Pawn(Owner).SoundDampening);
- if ( bChangeWeapon )
- GotoState('DownWeapon');
- else if ( PlayerPawn(Owner) == None )
- Super.Finish();
- else if ( (AmmoType.AmmoAmount<=0) || (Pawn(Owner).Weapon != self) )
- GotoState('Idle');
- else if (ClipCount<=0)
- GoToState('NewClip');
- else if ( Pawn(Owner).bFire!=0 )
- Global.Fire(0);
- else if ( Pawn(Owner).bAltFire!=0 )
- Global.AltFire(0);
- GoToState('Idle');
- }
- function Fire( float Value )
- {
- if(ClipCount>0)
- {
- bMuzzleFlash++;
- GotoState('NormalFire');
- AmmoType.UseAmmo(1);
- if ( PlayerPawn(Owner) != None )
- PlayerPawn(Owner).ShakeView(ShakeTime, ShakeMag, ShakeVert);
- bPointing=True;
- if (!bIsZoomed)
- TraceFire(0.5);
- if (bIsZoomed)
- TraceFire(0.25);
- Owner.PlaySound(FireSound);
- ClipCount--;
- CheckVisibility();
- }
- else if(ClipCount<=0)
- {
- GotoState('NewClip');
- }
- }
- Simulated state AltFiring
- {
- function Timer()
- {
- if (Pawn(Owner).bAltFire == 0)
- {
- if (PlayerPawn(Owner) != None)
- ClientResetFOV();
- SetTimer(0.0,False);
- GoToState('Idle');
- }
- }
- Begin:
- if ( Owner.IsA('PlayerPawn'))
- {
- ClientSetFOV(50);
- SetTimer(0.03,True);
- }
- else
- {
- Pawn(Owner).bFire = 1;
- Pawn(Owner).bAltFire = 0;
- Global.Fire(0);
- }
- }
- Simulated function AltFire( float Value )
- {
- if( PlayerPawn(Owner)==None )
- {
- Global.Fire(0);
- return;
- }
- ClientSetFOV(50);
- bIsZoomed = True;
- SetTimer(0.03,true);
- }
- Simulated function Timer()
- {
- if( PlayerPawn(Owner)==None || Pawn(Owner).Weapon!=Self )
- SetTimer(0.00,false);
- else if( Pawn(Owner).bAltFire==0 )
- {
- ClientResetFOV();
- bIsZoomed = False;
- SetTimer(0,false);
- }
- }
- state NewClip
- {
- ignores Fire, AltFire;
- Begin:
- if (Owner.IsA('PlayerPawn'))
- {
- ClientResetFOV();
- bOwnsCrossHair = True;
- bIsZoomed = False;
- }
- PlayAnim('Reload',1.3,0.04);
- If (AmmoType.AmmoAmount >= Default.Clipcount)
- ClipCount = Default.Clipcount;
- Else if (AmmoType.AmmoAmount < Default.Clipcount)
- ClipCount = Ammotype.AmmoAmount;
- Sleep(0.6);
- Owner.PlaySound(ReloadSounds[0], SLOT_None, Pawn(Owner).SoundDampening * 1.0);
- Sleep(0.9);
- Owner.PlaySound(ReloadSounds[1], SLOT_None, Pawn(Owner).SoundDampening * 1.0);
- Sleep(0.8);
- Owner.PlaySound(ReloadSounds[2], SLOT_None, Pawn(Owner).SoundDampening * 1.0);
- FinishAnim();
- GotoState('Idle');
- if ( bChangeWeapon )
- GotoState('DownWeapon');
- else if ( Pawn(Owner).bFire!=0 )
- Global.Fire(0);
- else if ( Pawn(Owner).bAltFire!=0 )
- Global.AltFire(0);
- else GotoState('Idle');
- }
- function Finish()
- {
- local Pawn PawnOwner;
- if ( bChangeWeapon )
- {
- GotoState('DownWeapon');
- return;
- }
- PawnOwner = Pawn(Owner);
- if ( PlayerPawn(Owner) == None )
- {
- if ( (AmmoType != None) && (AmmoType.AmmoAmount<=0) )
- {
- PawnOwner.StopFiring();
- PawnOwner.SwitchToBestWeapon();
- if ( bChangeWeapon )
- GotoState('DownWeapon');
- }
- else if ( (PawnOwner.bFire != 0) && (FRand() < RefireRate) )
- Global.Fire(0);
- else
- {
- PawnOwner.StopFiring();
- GotoState('Idle');
- }
- return;
- }
- if ( ((AmmoType != None) && (AmmoType.AmmoAmount<=0)) || (PawnOwner.Weapon != self) )
- GotoState('Idle');
- else if ( PawnOwner.bFire!=0 )
- Global.Fire(0);
- else GotoState('Idle');
- }
- state Idle
- {
- Begin:
- if ( bChangeWeapon )
- {
- GotoState('DownWeapon');
- }
- bMuzzleFlash = 0;
- bPointing=False;
- if ( (AmmoType != None) && (AmmoType.AmmoAmount<=0) )
- Pawn(Owner).SwitchToBestWeapon(); //Goto Weapon that has Ammo
- if ( Pawn(Owner).bFire!=0 ) Fire(0.0);
- Disable('AnimEnd');
- SetTimer(1.5,True);
- if (Pawn(Owner).bFire!=0 )
- Global.Fire(0.0);
- if (Pawn(Owner).bAltFire!=0 )
- Global.AltFire(0.0);
- if( PlayerPawn(Owner)!=None )
- {
- while( Pawn(Owner).bExtra1==0 )
- Sleep(0.05);
- }
- else Sleep(3.f);
- GotoState('NewClip');
- }
- state Active
- {
- function Fire(float F)
- {
- }
- function AltFire(float F)
- {
- }
- function bool PutDown()
- {
- if ( bWeaponUp || (AnimFrame < 0.75) )
- GotoState('DownWeapon');
- else
- bChangeWeapon = true;
- return True;
- }
- function BeginState()
- {
- bChangeWeapon = false;
- Super.BeginState();
- }
- Begin:
- if ( bChangeWeapon )
- GotoState('DownWeapon');
- bWeaponUp = True;
- PlayAnim('Select',1.0,0.0);
- Sleep(0.4);
- Owner.PlaySound(SelectSound, SLOT_Misc, Pawn(Owner).SoundDampening);
- FinishAnim();
- Finish();
- }
- function BringUp()
- {
- bIsZoomed = false;
- Super.BringUp();
- }
- Function PlaySelect();
- Simulated State DownWeapon
- {
- ignores Fire, AltFire;
- function BeginState()
- {
- if( PlayerPawn(Owner)!=None )
- ClientResetFOV();
- bIsZoomed = False;
- bChangeWeapon = false;
- bMuzzleFlash = 0;
- SetTimer(0,false);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment