Advertisement
Guest User

Untitled

a guest
Jul 16th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.03 KB | None | 0 0
  1. class Scanner extends Weapon;
  2.  
  3. #exec TEXTURE IMPORT NAME=hand FILE=Textures\hand.bmp GROUP=Skins
  4.  
  5. // Scanner off black screen
  6. #exec TEXTURE IMPORT NAME=black_none FILE=Textures\black_none.bmp GROUP=Skins
  7. // Hand texture
  8. #exec TEXTURE IMPORT NAME=JBlueHand FILE=Textures\JBlueHand.bmp GROUP=Skins
  9. // Case texture
  10. #exec TEXTURE IMPORT NAME=JMediGun1 FILE=Textures\JMediGun1.bmp GROUP=Skins FLAGS=2
  11. // Scanner Idle texture
  12. #exec TEXTURE IMPORT NAME=ScannerReady FILE=Textures\ScannerReady.bmp GROUP=Skins
  13. // Scanner: Door Open Texture
  14. #exec TEXTURE IMPORT NAME=SendingOpen FILE=Textures\SendingOpen.bmp GROUP=Skins
  15. // Scanner: Door Close Texture
  16. #exec TEXTURE IMPORT NAME=SendingClose FILE=Textures\SendingClose.bmp GROUP=Skins
  17.  
  18. // Fire-AltFire Sounds
  19. #exec AUDIO IMPORT FILE="Sounds\ScannerWav.WAV" NAME="ScannerWav"
  20. #exec AUDIO IMPORT FILE="Sounds\ScannerWavR.WAV" NAME="ScannerWavR"
  21.  
  22. // Pickup model
  23. #exec MESH IMPORT MESH=MediGunS ANIVFILE=MODELS\MediGunS_a.3d DATAFILE=MODELS\MediGunS_d.3d X=0 Y=0 Z=0
  24. #exec MESH ORIGIN MESH=MediGunS X=0 Y=0 Z=0
  25.  
  26. #exec MESH SEQUENCE MESH=MediGunS SEQ=All STARTFRAME=0 NUMFRAMES=69 RATE=23
  27. #exec MESH SEQUENCE MESH=MediGunS SEQ=Wave1 STARTFRAME=0 NUMFRAMES=13 RATE=13
  28. #exec MESH SEQUENCE MESH=MediGunS SEQ=Idle STARTFRAME=13 NUMFRAMES=13 RATE=13
  29. #exec MESH SEQUENCE MESH=MediGunS SEQ=still0 STARTFRAME=13 NUMFRAMES=1 RATE=2
  30. #exec MESH SEQUENCE MESH=MediGunS SEQ=Down STARTFRAME=26 NUMFRAMES=13 RATE=13
  31. #exec MESH SEQUENCE MESH=MediGunS SEQ=Select STARTFRAME=39 NUMFRAMES=13 RATE=13
  32. // Corrupt frame at 16, clipped the anim
  33. #exec MESH SEQUENCE MESH=MediGunS SEQ=Wave2 STARTFRAME=52 NUMFRAMES=15 RATE=17
  34.  
  35. #exec MESHMAP NEW MESHMAP=MediGunS MESH=MediGunS
  36. #exec MESHMAP SCALE MESHMAP=MediGunS X=0.1 Y=0.1 Z=0.2
  37.  
  38. #exec MESHMAP SETTEXTURE MESHMAP=MediGunS NUM=0 TEXTURE=JMediGun1
  39. #exec MESHMAP SETTEXTURE MESHMAP=MediGunS NUM=1 TEXTURE=JMediGun1
  40. #exec MESHMAP SETTEXTURE MESHMAP=MediGunS NUM=2 TEXTURE=ScannerReady
  41. #exec MESHMAP SETTEXTURE MESHMAP=MediGunS NUM=3 TEXTURE=BlackTexture
  42.  
  43. // First person model (with arm)
  44. #exec MESH IMPORT MESH=MediGun ANIVFILE=MODELS\MediGun_a.3d DATAFILE=MODELS\MediGun_d.3d X=0 Y=0 Z=0
  45. #exec MESH ORIGIN MESH=MediGun X=0 Y=0 Z=0
  46.  
  47. #exec MESH SEQUENCE MESH=MediGun SEQ=All STARTFRAME=0 NUMFRAMES=69 RATE=23
  48. #exec MESH SEQUENCE MESH=MediGun SEQ=Wave1 STARTFRAME=0 NUMFRAMES=13 RATE=13
  49. #exec MESH SEQUENCE MESH=MediGun SEQ=Idle STARTFRAME=13 NUMFRAMES=13 RATE=13
  50. #exec MESH SEQUENCE MESH=MediGun SEQ=still0 STARTFRAME=13 NUMFRAMES=1 RATE=2
  51. #exec MESH SEQUENCE MESH=MediGun SEQ=Down STARTFRAME=26 NUMFRAMES=13 RATE=13
  52. #exec MESH SEQUENCE MESH=MediGun SEQ=Select STARTFRAME=39 NUMFRAMES=13 RATE=13
  53. #exec MESH SEQUENCE MESH=MediGun SEQ=Wave2 STARTFRAME=52 NUMFRAMES=15 RATE=17
  54.  
  55. #exec MESHMAP NEW MESHMAP=MediGun MESH=MediGun
  56. #exec MESHMAP SCALE MESHMAP=MediGun X=0.1 Y=0.1 Z=0.2
  57.  
  58. #exec MESHMAP SETTEXTURE MESHMAP=MediGun NUM=0 TEXTURE=JBlueHand
  59. #exec MESHMAP SETTEXTURE MESHMAP=MediGun NUM=1 TEXTURE=JMediGun1
  60. #exec MESHMAP SETTEXTURE MESHMAP=MediGun NUM=2 TEXTURE=JMediGun1
  61. #exec MESHMAP SETTEXTURE MESHMAP=MediGun NUM=3 TEXTURE=BlackTexture
  62.  
  63. #exec MESH NOTIFY MESH=MediGun SEQ=Select TIME=0.5 FUNCTION=TurnOn
  64. #exec MESH NOTIFY MESH=MediGun SEQ=Down TIME=0.5 FUNCTION=TurnOff
  65. #exec MESH NOTIFY MESH=MediGun SEQ=Wave1 TIME=0.01 FUNCTION=ScanOn
  66. #exec MESH NOTIFY MESH=MediGun SEQ=Wave1 TIME=0.85 FUNCTION=ScanOff
  67. #exec MESH NOTIFY MESH=MediGun SEQ=Wave2 TIME=0.01 FUNCTION=AltScanOn
  68. #exec MESH NOTIFY MESH=MediGun SEQ=Wave2 TIME=0.85 FUNCTION=ScanOff
  69.  
  70. //Needed text for radar
  71. #exec New TrueTypeFontFactory FontName="LucidaSansTypewriter" Name="BeaconNameFontSmall" Height=8 USize=256 VSize=128 CharactersPerPage=256
  72. #exec New TrueTypeFontFactory FontName="LucidaSansTypewriter" Name="BeaconNameFontMedium" Height=10 USize=256 VSize=128 CharactersPerPage=256
  73. #exec New TrueTypeFontFactory FontName="LucidaSansTypewriter" Name="BeaconNameFontLarge" Height=12 USize=256 VSize=256 CharactersPerPage=256
  74. #exec Texture Import Name=TeamBeacon2 File="Textures\TeamBeacon2.bmp" Flags=2
  75.  
  76. // I "found a mover" beep
  77. #exec AUDIO IMPORT FILE="Sounds\TAG.WAV" NAME="TAG"
  78.  
  79. //Add
  80. var() bool bHasHand;
  81. var() int HandSkinNUM;
  82.  
  83. // For mover XRay function
  84. var Texture TeamBeaconIcon;
  85. var int d;
  86.  
  87. // Sets personal light
  88. var pawn Beacon;
  89.  
  90. //I found a mover!
  91. var sound SuccessSound;
  92.  
  93. function float RateSelf(out int bUseAltMode)
  94. {
  95. return -2;
  96. }
  97.  
  98. // Skin swaps called from mesh notifies
  99. simulated function TurnOn()
  100. {
  101. MultiSkins[3] = Texture'ScannerReady';
  102. }
  103. simulated function TurnOff()
  104. {
  105. MultiSkins[3] = Texture'BlackTexture';
  106. MultiSkins[2] = Texture'JMediGun1';
  107. }
  108. simulated function ScanOn()
  109. {
  110. MultiSkins[3] = Texture'SendingOpen';
  111. MultiSkins[2] = Texture'damagewet';
  112. }
  113. simulated function AltScanOn()
  114. {
  115. MultiSkins[3] = Texture'SendingClose';
  116. MultiSkins[2] = Texture'damagewet';
  117. }
  118. simulated function ScanOff()
  119. {
  120. MultiSkins[3] = Texture'ScannerReady';
  121. MultiSkins[2] = Texture'JMediGun1';
  122. }
  123.  
  124. function PlayFiring()
  125. {
  126. PlayAnim('Wave1',1.5,0.02);
  127. Owner.PlaySound(AltFireSound, SLOT_None,Pawn(Owner).SoundDampening,,,1.0);
  128. Owner.PlaySound(FireSound, SLOT_Misc,2.0*Pawn(Owner).SoundDampening,,,1.0);
  129. }
  130.  
  131. function PlayAltFiring()
  132. {
  133. PlayAnim('Wave2',1.5,0.02);
  134. Owner.PlaySound(AltFireSound, SLOT_None,Pawn(Owner).SoundDampening,,,1.0);
  135. }
  136.  
  137. function Fire(float Value)
  138. {
  139. if(AmmoType.UseAmmo(1))
  140. {
  141. GotoState('NormalFire');
  142. bPointing=True;
  143. PlayFiring();
  144. if (!bRapidFire && (FiringSpeed > 0))
  145. Pawn(Owner).PlayRecoil(FiringSpeed);
  146. TraceFire(0.0);
  147. }
  148. }
  149.  
  150. function AltFire(float Value)
  151. {
  152. if(AmmoType.UseAmmo(1))
  153. {
  154. GotoState('AltFiring');
  155. bPointing=True;
  156. PlayAltFiring();
  157. if (bRapidFire || (FiringSpeed > 0))
  158. Pawn(Owner).PlayRecoil(FiringSpeed);
  159. OtherTraceFire(0.0);
  160. }
  161. }
  162.  
  163. function OtherTraceFire(float Accuracy)
  164. {
  165. local vector HitLocation, HitNormal, StartTrace, EndTrace, X,Y,Z;
  166. local actor Other;
  167. local Pawn PawnOwner;
  168.  
  169. PawnOwner = Pawn(Owner);
  170.  
  171. Owner.MakeNoise(PawnOwner.SoundDampening);
  172. GetAxes(PawnOwner.ViewRotation,X,Y,Z);
  173. StartTrace = Owner.Location + CalcDrawOffset() + FireOffset.X * X + FireOffset.Y * Y + FireOffset.Z * Z;
  174. AdjustedAim = PawnOwner.AdjustAim(1000000, StartTrace, 2.75*AimError, False, False);
  175. EndTrace = StartTrace + Accuracy * (FRand() - 0.5)* Y * 1000 + Accuracy * (FRand() - 0.5) * Z * 1000;
  176. X = vector(AdjustedAim);
  177. EndTrace += (10000 * X);
  178. Other = PawnOwner.TraceShot(HitLocation,HitNormal,EndTrace,StartTrace);
  179. OtherProcessTraceHit(Other, HitLocation, HitNormal, X,Y,Z);
  180. }
  181.  
  182. // Setup for finding a mover
  183. function EffectsTraceFire(float Accuracy)
  184. {
  185. local vector HitLocation, HitNormal, StartTrace, EndTrace, X,Y,Z;
  186. local actor Other;
  187. local Pawn PawnOwner;
  188.  
  189. PawnOwner = Pawn(Owner);
  190. Owner.MakeNoise(PawnOwner.SoundDampening);
  191. GetAxes(PawnOwner.ViewRotation,X,Y,Z);
  192. StartTrace = Owner.Location + CalcDrawOffset() + FireOffset.X * X + FireOffset.Y * Y + FireOffset.Z * Z;
  193. AdjustedAim = PawnOwner.AdjustAim(1000000, StartTrace, 2.75*AimError, False, False);
  194. EndTrace = StartTrace + Accuracy * (FRand() - 0.5)* Y * 1000 + Accuracy * (FRand() - 0.5) * Z * 1000;
  195. X = vector(AdjustedAim);
  196. EndTrace += (10000 * X);
  197. Other = PawnOwner.TraceShot(HitLocation,HitNormal,EndTrace,StartTrace);
  198. TimerProcessTraceHit(Other, HitLocation, HitNormal, X,Y,Z);
  199. }
  200.  
  201. // Trace hit for the fire command, sends the 'open' order to the mover
  202. function ProcessTraceHit(Actor Other, Vector HitLocation, Vector HitNormal, Vector X, Vector Y, Vector Z)
  203. {
  204. local Mover M;
  205.  
  206. if ((Other != none) && (Other.IsA('Mover')) && VSize(Other.Location-Owner.Location) < 2000)
  207. {
  208. M = Mover(Other);
  209. M.DoOpen();
  210. }
  211. }
  212.  
  213. // Trace hit for the alt-fire, sends the 'close' order to the mover
  214. function OtherProcessTraceHit(Actor Other, Vector HitLocation, Vector HitNormal, Vector X, Vector Y, Vector Z)
  215. {
  216. local Mover M;
  217.  
  218. if ((Other != none) && (Other.IsA('Mover')) && VSize(Other.Location-Owner.Location) < 2000)
  219. {
  220. M = Mover(Other);
  221. M.DoClose();
  222. }
  223. }
  224.  
  225. // Trace hit for hovering over a mover
  226. function TimerProcessTraceHit(Actor Other, Vector HitLocation, Vector HitNormal, Vector X, Vector Y, Vector Z)
  227. {
  228. if ((Other != none) && (Other.IsA('Mover')) && VSize(Other.Location-Owner.Location) < 2000)
  229. {
  230. Spawn(class'MoverWallHitEffect',,, HitLocation+HitNormal*9, Rotator(HitNormal));
  231. Owner.PlaySound(SuccessSound, SLOT_None, Pawn(Owner).SoundDampening*3.0);
  232. }
  233. }
  234.  
  235. // Creates the overlay in the HUD that shows movers
  236. // Needs improvement, some movers don't render properly
  237. simulated function PostRender(canvas Canvas)
  238. {
  239. local Mover thisMover;
  240. local vector X, Y, Z, CamLoc, TargetDir, Dir, XY;
  241. local rotator CamRot;
  242. local Actor Camera;
  243. local float BaseBeaconScale, BeaconScale, Dist, DistScale;
  244. local float TanFOVx, TanFOVy;
  245. local float dx, dy, FontY;
  246. local string BeaconText;
  247.  
  248. Canvas.Style = ERenderStyle.STY_Masked;
  249.  
  250. if (Canvas.ClipX > 1024)
  251. Canvas.Font = Font'BeaconNameFontLarge';
  252. else if (Canvas.ClipX > 640)
  253. Canvas.Font = Font'BeaconNameFontMedium';
  254. else
  255. Canvas.Font = Font'BeaconNameFontSmall';
  256. Canvas.TextSize("X", dx, FontY);
  257. Canvas.SetPos(0,0.5 * Canvas.ClipY);
  258. Canvas.DrawText(" SCANNER INFORMATION", False);
  259. Canvas.SetPos(0,0.5 * Canvas.ClipY + 16);
  260. Canvas.DrawText(" Monsters Left: "$ Charge, False);
  261. Canvas.SetPos(0, 0);
  262. BaseBeaconScale = 1.5 * FontY / Texture'TeamBeacon2'.VSize;
  263.  
  264. Canvas.ViewPort.Actor.PlayerCalcView(Camera, CamLoc, CamRot);
  265.  
  266. TanFOVx = Tan(Canvas.ViewPort.Actor.FOVAngle / 114.591559);
  267. TanFOVy = (Canvas.ClipY / Canvas.ClipX) * TanFOVx;
  268. GetAxes(CamRot, X, Y, Z);
  269.  
  270. Canvas.bNoSmooth = False;
  271. Canvas.Style = ERenderStyle.STY_Masked;
  272.  
  273. //foreach RadiusActors(class 'Mover', thisMover, 7000)
  274. foreach Owner.RadiusActors(class 'Mover', thisMover, 7000,CamLoc)
  275. {
  276. if (thisMover != none && thisMover != Camera)
  277. {
  278. TargetDir = thisMover.Location - CamLoc;
  279. Dist = VSize(TargetDir) * FMin(TanFOVx, 1.0);
  280. TargetDir = Normal(TargetDir + vect(0,0,1)); // * thisMover.CollisionHeight);
  281. DistScale = FMin(100.0 * thisMover.CollisionRadius / Dist, 1.0);
  282. d = Dist;
  283.  
  284. if ((DistScale > 0.0 && TargetDir dot X > 0) && (FastTrace(thisMover.Location, CamLoc)
  285. || FastTrace(thisMover.Location + vect(0,0,0.8) * thisMover.CollisionHeight, CamLoc)))
  286. {
  287. BeaconScale = BaseBeaconScale * DistScale;
  288. Dir = X * (X dot TargetDir);
  289. XY = TargetDir - Dir;
  290.  
  291. dx = Canvas.ClipX * 0.5 * (1.0 + (XY dot Y) / (VSize(Dir) * TanFOVx));
  292. dy = Canvas.ClipY * 0.5 * (1.0 - (XY dot Z) / (VSize(Dir) * TanFOVy));
  293.  
  294. //Canvas.SetPos(dx - 0.5 * BeaconScale * TeamBeaconIcon.USize, dy - 2 * FontY * DistScale);
  295. Canvas.SetPos(dx - 0.5 * BeaconScale, dy - 2 * FontY * DistScale);
  296.  
  297. if (DistScale <= 1.0)
  298. {
  299. if (Canvas.ClipX > 600)
  300. BeaconText = "Mover: " $ d $ "";
  301. Canvas.DrawIcon(texture'CrossHair6', 1.0);
  302. Canvas.SetPos(dx + 0.6 * BeaconScale * TeamBeaconIcon.USize + 1, dy - 1.75 * FontY + 1);
  303. Canvas.DrawTextClipped(BeaconText, False);
  304. }
  305. }
  306. }
  307. }
  308. }
  309.  
  310. function PlaySelect()
  311. {
  312. local Texture handtex;
  313.  
  314. Super.PlaySelect();
  315.  
  316. if(!bHasHand || Pawn(Owner) == none || mesh == PickupViewMesh) return;
  317.  
  318. handtex = Texture'hand';
  319.  
  320. if(HandSkinNUM == 0) skin = handtex;
  321. else MultiSkins[HandSkinNUM] = handtex;
  322.  
  323. PlayAnim('Select',2.5,0.0);
  324. Owner.PlaySound(SelectSound, SLOT_Misc, Pawn(Owner).SoundDampening);
  325.  
  326. Beacon = pawn(owner);
  327. Beacon.ClientMessage("Turning personal light on");
  328. Beacon.AmbientGlow = 254;
  329. Beacon.LightEffect=LE_NonIncidence;
  330. Beacon.LightBrightness=255;
  331. Beacon.LightHue=210;
  332. Beacon.LightRadius=30;
  333. Beacon.LightSaturation=200;
  334. Beacon.LightType=LT_Steady;
  335. }
  336.  
  337. simulated function DropFrom(vector StartLocation)
  338. {
  339. if(HandSkinNUM == 0) skin = Texture'black_none';
  340. else MultiSkins[HandSkinNUM] = Texture'black_none';
  341.  
  342. Super.DropFrom(StartLocation);
  343. }
  344.  
  345. simulated function PlayIdleAnim()
  346. {
  347. //PlayAnim('still0',1.25,1.2); //speed me up some
  348. PlayAnim('still0',3.25,0.25);
  349. }
  350.  
  351. simulated function TweenToStill()
  352. {
  353. TweenAnim('still0', 0.1);
  354. }
  355.  
  356. function TweenDown()
  357. {
  358. if ((AnimSequence != '') && (GetAnimGroup(AnimSequence) == 'Select'))
  359. TweenAnim(AnimSequence, AnimFrame * 0.4);
  360. else
  361. PlayAnim('Down', 2.5, 0.05);
  362.  
  363. Beacon.ClientMessage("Turning personal light off");
  364. Beacon.AmbientGlow = Beacon.Default.AmbientGlow;
  365. Beacon.LightType = LT_None;
  366. }
  367.  
  368. state Idle //added only to disable animend
  369. {
  370. function AnimEnd()
  371. {
  372. PlayIdleAnim();
  373. EffectsTraceFire(0.0);
  374. }
  375.  
  376. function bool PutDown()
  377. {
  378. GotoState('DownWeapon');
  379. return True;
  380. }
  381.  
  382. Begin:
  383. bPointing=False;
  384. if ((AmmoType != None) && (AmmoType.AmmoAmount<=0))
  385. Pawn(Owner).SwitchToBestWeapon(); //Goto Weapon that has Ammo
  386. if (Pawn(Owner).bFire!=0) Fire(0.0);
  387. if (Pawn(Owner).bAltFire!=0) AltFire(0.0);
  388. // Disable('AnimEnd');
  389. PlayIdleAnim();
  390. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement