Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Scanner extends Weapon;
- #exec TEXTURE IMPORT NAME=hand FILE=Textures\hand.bmp GROUP=Skins
- // Scanner off black screen
- #exec TEXTURE IMPORT NAME=black_none FILE=Textures\black_none.bmp GROUP=Skins
- // Hand texture
- #exec TEXTURE IMPORT NAME=JBlueHand FILE=Textures\JBlueHand.bmp GROUP=Skins
- // Case texture
- #exec TEXTURE IMPORT NAME=JMediGun1 FILE=Textures\JMediGun1.bmp GROUP=Skins FLAGS=2
- // Scanner Idle texture
- #exec TEXTURE IMPORT NAME=ScannerReady FILE=Textures\ScannerReady.bmp GROUP=Skins
- // Scanner: Door Open Texture
- #exec TEXTURE IMPORT NAME=SendingOpen FILE=Textures\SendingOpen.bmp GROUP=Skins
- // Scanner: Door Close Texture
- #exec TEXTURE IMPORT NAME=SendingClose FILE=Textures\SendingClose.bmp GROUP=Skins
- // Fire-AltFire Sounds
- #exec AUDIO IMPORT FILE="Sounds\ScannerWav.WAV" NAME="ScannerWav"
- #exec AUDIO IMPORT FILE="Sounds\ScannerWavR.WAV" NAME="ScannerWavR"
- // Pickup model
- #exec MESH IMPORT MESH=MediGunS ANIVFILE=MODELS\MediGunS_a.3d DATAFILE=MODELS\MediGunS_d.3d X=0 Y=0 Z=0
- #exec MESH ORIGIN MESH=MediGunS X=0 Y=0 Z=0
- #exec MESH SEQUENCE MESH=MediGunS SEQ=All STARTFRAME=0 NUMFRAMES=69 RATE=23
- #exec MESH SEQUENCE MESH=MediGunS SEQ=Wave1 STARTFRAME=0 NUMFRAMES=13 RATE=13
- #exec MESH SEQUENCE MESH=MediGunS SEQ=Idle STARTFRAME=13 NUMFRAMES=13 RATE=13
- #exec MESH SEQUENCE MESH=MediGunS SEQ=still0 STARTFRAME=13 NUMFRAMES=1 RATE=2
- #exec MESH SEQUENCE MESH=MediGunS SEQ=Down STARTFRAME=26 NUMFRAMES=13 RATE=13
- #exec MESH SEQUENCE MESH=MediGunS SEQ=Select STARTFRAME=39 NUMFRAMES=13 RATE=13
- // Corrupt frame at 16, clipped the anim
- #exec MESH SEQUENCE MESH=MediGunS SEQ=Wave2 STARTFRAME=52 NUMFRAMES=15 RATE=17
- #exec MESHMAP NEW MESHMAP=MediGunS MESH=MediGunS
- #exec MESHMAP SCALE MESHMAP=MediGunS X=0.1 Y=0.1 Z=0.2
- #exec MESHMAP SETTEXTURE MESHMAP=MediGunS NUM=0 TEXTURE=JMediGun1
- #exec MESHMAP SETTEXTURE MESHMAP=MediGunS NUM=1 TEXTURE=JMediGun1
- #exec MESHMAP SETTEXTURE MESHMAP=MediGunS NUM=2 TEXTURE=ScannerReady
- #exec MESHMAP SETTEXTURE MESHMAP=MediGunS NUM=3 TEXTURE=BlackTexture
- // First person model (with arm)
- #exec MESH IMPORT MESH=MediGun ANIVFILE=MODELS\MediGun_a.3d DATAFILE=MODELS\MediGun_d.3d X=0 Y=0 Z=0
- #exec MESH ORIGIN MESH=MediGun X=0 Y=0 Z=0
- #exec MESH SEQUENCE MESH=MediGun SEQ=All STARTFRAME=0 NUMFRAMES=69 RATE=23
- #exec MESH SEQUENCE MESH=MediGun SEQ=Wave1 STARTFRAME=0 NUMFRAMES=13 RATE=13
- #exec MESH SEQUENCE MESH=MediGun SEQ=Idle STARTFRAME=13 NUMFRAMES=13 RATE=13
- #exec MESH SEQUENCE MESH=MediGun SEQ=still0 STARTFRAME=13 NUMFRAMES=1 RATE=2
- #exec MESH SEQUENCE MESH=MediGun SEQ=Down STARTFRAME=26 NUMFRAMES=13 RATE=13
- #exec MESH SEQUENCE MESH=MediGun SEQ=Select STARTFRAME=39 NUMFRAMES=13 RATE=13
- #exec MESH SEQUENCE MESH=MediGun SEQ=Wave2 STARTFRAME=52 NUMFRAMES=15 RATE=17
- #exec MESHMAP NEW MESHMAP=MediGun MESH=MediGun
- #exec MESHMAP SCALE MESHMAP=MediGun X=0.1 Y=0.1 Z=0.2
- #exec MESHMAP SETTEXTURE MESHMAP=MediGun NUM=0 TEXTURE=JBlueHand
- #exec MESHMAP SETTEXTURE MESHMAP=MediGun NUM=1 TEXTURE=JMediGun1
- #exec MESHMAP SETTEXTURE MESHMAP=MediGun NUM=2 TEXTURE=JMediGun1
- #exec MESHMAP SETTEXTURE MESHMAP=MediGun NUM=3 TEXTURE=BlackTexture
- #exec MESH NOTIFY MESH=MediGun SEQ=Select TIME=0.5 FUNCTION=TurnOn
- #exec MESH NOTIFY MESH=MediGun SEQ=Down TIME=0.5 FUNCTION=TurnOff
- #exec MESH NOTIFY MESH=MediGun SEQ=Wave1 TIME=0.01 FUNCTION=ScanOn
- #exec MESH NOTIFY MESH=MediGun SEQ=Wave1 TIME=0.85 FUNCTION=ScanOff
- #exec MESH NOTIFY MESH=MediGun SEQ=Wave2 TIME=0.01 FUNCTION=AltScanOn
- #exec MESH NOTIFY MESH=MediGun SEQ=Wave2 TIME=0.85 FUNCTION=ScanOff
- //Needed text for radar
- #exec New TrueTypeFontFactory FontName="LucidaSansTypewriter" Name="BeaconNameFontSmall" Height=8 USize=256 VSize=128 CharactersPerPage=256
- #exec New TrueTypeFontFactory FontName="LucidaSansTypewriter" Name="BeaconNameFontMedium" Height=10 USize=256 VSize=128 CharactersPerPage=256
- #exec New TrueTypeFontFactory FontName="LucidaSansTypewriter" Name="BeaconNameFontLarge" Height=12 USize=256 VSize=256 CharactersPerPage=256
- #exec Texture Import Name=TeamBeacon2 File="Textures\TeamBeacon2.bmp" Flags=2
- // I "found a mover" beep
- #exec AUDIO IMPORT FILE="Sounds\TAG.WAV" NAME="TAG"
- //Add
- var() bool bHasHand;
- var() int HandSkinNUM;
- // For mover XRay function
- var Texture TeamBeaconIcon;
- var int d;
- // Sets personal light
- var pawn Beacon;
- //I found a mover!
- var sound SuccessSound;
- function float RateSelf(out int bUseAltMode)
- {
- return -2;
- }
- // Skin swaps called from mesh notifies
- simulated function TurnOn()
- {
- MultiSkins[3] = Texture'ScannerReady';
- }
- simulated function TurnOff()
- {
- MultiSkins[3] = Texture'BlackTexture';
- MultiSkins[2] = Texture'JMediGun1';
- }
- simulated function ScanOn()
- {
- MultiSkins[3] = Texture'SendingOpen';
- MultiSkins[2] = Texture'damagewet';
- }
- simulated function AltScanOn()
- {
- MultiSkins[3] = Texture'SendingClose';
- MultiSkins[2] = Texture'damagewet';
- }
- simulated function ScanOff()
- {
- MultiSkins[3] = Texture'ScannerReady';
- MultiSkins[2] = Texture'JMediGun1';
- }
- function PlayFiring()
- {
- PlayAnim('Wave1',1.5,0.02);
- Owner.PlaySound(AltFireSound, SLOT_None,Pawn(Owner).SoundDampening,,,1.0);
- Owner.PlaySound(FireSound, SLOT_Misc,2.0*Pawn(Owner).SoundDampening,,,1.0);
- }
- function PlayAltFiring()
- {
- PlayAnim('Wave2',1.5,0.02);
- Owner.PlaySound(AltFireSound, SLOT_None,Pawn(Owner).SoundDampening,,,1.0);
- }
- function Fire(float Value)
- {
- if(AmmoType.UseAmmo(1))
- {
- GotoState('NormalFire');
- bPointing=True;
- PlayFiring();
- if (!bRapidFire && (FiringSpeed > 0))
- Pawn(Owner).PlayRecoil(FiringSpeed);
- TraceFire(0.0);
- }
- }
- function AltFire(float Value)
- {
- if(AmmoType.UseAmmo(1))
- {
- GotoState('AltFiring');
- bPointing=True;
- PlayAltFiring();
- if (bRapidFire || (FiringSpeed > 0))
- Pawn(Owner).PlayRecoil(FiringSpeed);
- OtherTraceFire(0.0);
- }
- }
- function OtherTraceFire(float Accuracy)
- {
- local vector HitLocation, HitNormal, StartTrace, EndTrace, X,Y,Z;
- local actor Other;
- local Pawn PawnOwner;
- PawnOwner = Pawn(Owner);
- Owner.MakeNoise(PawnOwner.SoundDampening);
- GetAxes(PawnOwner.ViewRotation,X,Y,Z);
- StartTrace = Owner.Location + CalcDrawOffset() + FireOffset.X * X + FireOffset.Y * Y + FireOffset.Z * Z;
- AdjustedAim = PawnOwner.AdjustAim(1000000, StartTrace, 2.75*AimError, False, False);
- EndTrace = StartTrace + Accuracy * (FRand() - 0.5)* Y * 1000 + Accuracy * (FRand() - 0.5) * Z * 1000;
- X = vector(AdjustedAim);
- EndTrace += (10000 * X);
- Other = PawnOwner.TraceShot(HitLocation,HitNormal,EndTrace,StartTrace);
- OtherProcessTraceHit(Other, HitLocation, HitNormal, X,Y,Z);
- }
- // Setup for finding a mover
- function EffectsTraceFire(float Accuracy)
- {
- local vector HitLocation, HitNormal, StartTrace, EndTrace, X,Y,Z;
- local actor Other;
- local Pawn PawnOwner;
- PawnOwner = Pawn(Owner);
- Owner.MakeNoise(PawnOwner.SoundDampening);
- GetAxes(PawnOwner.ViewRotation,X,Y,Z);
- StartTrace = Owner.Location + CalcDrawOffset() + FireOffset.X * X + FireOffset.Y * Y + FireOffset.Z * Z;
- AdjustedAim = PawnOwner.AdjustAim(1000000, StartTrace, 2.75*AimError, False, False);
- EndTrace = StartTrace + Accuracy * (FRand() - 0.5)* Y * 1000 + Accuracy * (FRand() - 0.5) * Z * 1000;
- X = vector(AdjustedAim);
- EndTrace += (10000 * X);
- Other = PawnOwner.TraceShot(HitLocation,HitNormal,EndTrace,StartTrace);
- TimerProcessTraceHit(Other, HitLocation, HitNormal, X,Y,Z);
- }
- // Trace hit for the fire command, sends the 'open' order to the mover
- function ProcessTraceHit(Actor Other, Vector HitLocation, Vector HitNormal, Vector X, Vector Y, Vector Z)
- {
- local Mover M;
- if ((Other != none) && (Other.IsA('Mover')) && VSize(Other.Location-Owner.Location) < 2000)
- {
- M = Mover(Other);
- M.DoOpen();
- }
- }
- // Trace hit for the alt-fire, sends the 'close' order to the mover
- function OtherProcessTraceHit(Actor Other, Vector HitLocation, Vector HitNormal, Vector X, Vector Y, Vector Z)
- {
- local Mover M;
- if ((Other != none) && (Other.IsA('Mover')) && VSize(Other.Location-Owner.Location) < 2000)
- {
- M = Mover(Other);
- M.DoClose();
- }
- }
- // Trace hit for hovering over a mover
- function TimerProcessTraceHit(Actor Other, Vector HitLocation, Vector HitNormal, Vector X, Vector Y, Vector Z)
- {
- if ((Other != none) && (Other.IsA('Mover')) && VSize(Other.Location-Owner.Location) < 2000)
- {
- Spawn(class'MoverWallHitEffect',,, HitLocation+HitNormal*9, Rotator(HitNormal));
- Owner.PlaySound(SuccessSound, SLOT_None, Pawn(Owner).SoundDampening*3.0);
- }
- }
- // Creates the overlay in the HUD that shows movers
- // Needs improvement, some movers don't render properly
- simulated function PostRender(canvas Canvas)
- {
- local Mover thisMover;
- local vector X, Y, Z, CamLoc, TargetDir, Dir, XY;
- local rotator CamRot;
- local Actor Camera;
- local float BaseBeaconScale, BeaconScale, Dist, DistScale;
- local float TanFOVx, TanFOVy;
- local float dx, dy, FontY;
- local string BeaconText;
- Canvas.Style = ERenderStyle.STY_Masked;
- if (Canvas.ClipX > 1024)
- Canvas.Font = Font'BeaconNameFontLarge';
- else if (Canvas.ClipX > 640)
- Canvas.Font = Font'BeaconNameFontMedium';
- else
- Canvas.Font = Font'BeaconNameFontSmall';
- Canvas.TextSize("X", dx, FontY);
- Canvas.SetPos(0,0.5 * Canvas.ClipY);
- Canvas.DrawText(" SCANNER INFORMATION", False);
- Canvas.SetPos(0,0.5 * Canvas.ClipY + 16);
- Canvas.DrawText(" Monsters Left: "$ Charge, False);
- Canvas.SetPos(0, 0);
- BaseBeaconScale = 1.5 * FontY / Texture'TeamBeacon2'.VSize;
- Canvas.ViewPort.Actor.PlayerCalcView(Camera, CamLoc, CamRot);
- TanFOVx = Tan(Canvas.ViewPort.Actor.FOVAngle / 114.591559);
- TanFOVy = (Canvas.ClipY / Canvas.ClipX) * TanFOVx;
- GetAxes(CamRot, X, Y, Z);
- Canvas.bNoSmooth = False;
- Canvas.Style = ERenderStyle.STY_Masked;
- //foreach RadiusActors(class 'Mover', thisMover, 7000)
- foreach Owner.RadiusActors(class 'Mover', thisMover, 7000,CamLoc)
- {
- if (thisMover != none && thisMover != Camera)
- {
- TargetDir = thisMover.Location - CamLoc;
- Dist = VSize(TargetDir) * FMin(TanFOVx, 1.0);
- TargetDir = Normal(TargetDir + vect(0,0,1)); // * thisMover.CollisionHeight);
- DistScale = FMin(100.0 * thisMover.CollisionRadius / Dist, 1.0);
- d = Dist;
- if ((DistScale > 0.0 && TargetDir dot X > 0) && (FastTrace(thisMover.Location, CamLoc)
- || FastTrace(thisMover.Location + vect(0,0,0.8) * thisMover.CollisionHeight, CamLoc)))
- {
- BeaconScale = BaseBeaconScale * DistScale;
- Dir = X * (X dot TargetDir);
- XY = TargetDir - Dir;
- dx = Canvas.ClipX * 0.5 * (1.0 + (XY dot Y) / (VSize(Dir) * TanFOVx));
- dy = Canvas.ClipY * 0.5 * (1.0 - (XY dot Z) / (VSize(Dir) * TanFOVy));
- //Canvas.SetPos(dx - 0.5 * BeaconScale * TeamBeaconIcon.USize, dy - 2 * FontY * DistScale);
- Canvas.SetPos(dx - 0.5 * BeaconScale, dy - 2 * FontY * DistScale);
- if (DistScale <= 1.0)
- {
- if (Canvas.ClipX > 600)
- BeaconText = "Mover: " $ d $ "";
- Canvas.DrawIcon(texture'CrossHair6', 1.0);
- Canvas.SetPos(dx + 0.6 * BeaconScale * TeamBeaconIcon.USize + 1, dy - 1.75 * FontY + 1);
- Canvas.DrawTextClipped(BeaconText, False);
- }
- }
- }
- }
- }
- function PlaySelect()
- {
- local Texture handtex;
- Super.PlaySelect();
- if(!bHasHand || Pawn(Owner) == none || mesh == PickupViewMesh) return;
- handtex = Texture'hand';
- if(HandSkinNUM == 0) skin = handtex;
- else MultiSkins[HandSkinNUM] = handtex;
- PlayAnim('Select',2.5,0.0);
- Owner.PlaySound(SelectSound, SLOT_Misc, Pawn(Owner).SoundDampening);
- Beacon = pawn(owner);
- Beacon.ClientMessage("Turning personal light on");
- Beacon.AmbientGlow = 254;
- Beacon.LightEffect=LE_NonIncidence;
- Beacon.LightBrightness=255;
- Beacon.LightHue=210;
- Beacon.LightRadius=30;
- Beacon.LightSaturation=200;
- Beacon.LightType=LT_Steady;
- }
- simulated function DropFrom(vector StartLocation)
- {
- if(HandSkinNUM == 0) skin = Texture'black_none';
- else MultiSkins[HandSkinNUM] = Texture'black_none';
- Super.DropFrom(StartLocation);
- }
- simulated function PlayIdleAnim()
- {
- //PlayAnim('still0',1.25,1.2); //speed me up some
- PlayAnim('still0',3.25,0.25);
- }
- simulated function TweenToStill()
- {
- TweenAnim('still0', 0.1);
- }
- function TweenDown()
- {
- if ((AnimSequence != '') && (GetAnimGroup(AnimSequence) == 'Select'))
- TweenAnim(AnimSequence, AnimFrame * 0.4);
- else
- PlayAnim('Down', 2.5, 0.05);
- Beacon.ClientMessage("Turning personal light off");
- Beacon.AmbientGlow = Beacon.Default.AmbientGlow;
- Beacon.LightType = LT_None;
- }
- state Idle //added only to disable animend
- {
- function AnimEnd()
- {
- PlayIdleAnim();
- EffectsTraceFire(0.0);
- }
- function bool PutDown()
- {
- GotoState('DownWeapon');
- return True;
- }
- Begin:
- bPointing=False;
- if ((AmmoType != None) && (AmmoType.AmmoAmount<=0))
- Pawn(Owner).SwitchToBestWeapon(); //Goto Weapon that has Ammo
- if (Pawn(Owner).bFire!=0) Fire(0.0);
- if (Pawn(Owner).bAltFire!=0) AltFire(0.0);
- // Disable('AnimEnd');
- PlayIdleAnim();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement