-
Notifications
You must be signed in to change notification settings - Fork 403
/
ZSCRIPT.zc
687 lines (623 loc) · 21 KB
/
ZSCRIPT.zc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
version "4.11.3"
const MAXITERATIONS = 32676;
#include "zscript/FastMaterialCheck.zs"
#include "actors/Weapons/Slot9/BlackHole.zc"
#include "actors/Weapons/Slot9/SuperBFGBall.zc"
//PB_CORE
#include "zscript/PBCore.zsc"
#include "zscript/MathNMixins.zsc"
#include "zscript/PBHandler.zc"
//#include "zscript/PBPDA.zc"
#include "zscript/PB_Hud.zs"
#include "zscript/PB_Hud_FX.zs"
#include "zscript/PB_HudMessages.zs"
#include "zscript/PB_StatScreen.zs"
#include "zscript/Player/PlayerPawn.zc"
#include "zscript/Player/ZSPlayer.zsc"
#include "zscript/PlayerStats/GlobalStats.zsc"
#include "zscript/FestiveHats/HatExtravaganza.zc"
#include "zscript/PB_Flashlight.zs"
#include "zscript/Weapons/executionGUI/pb_viewport.zs"
#include "zscript/Weapons/executionGUI/pb_projector.zs"
#include "zscript/Weapons/executionGUI/pb_uihack.zs"
#include "zscript/Weapons/executionGUI/pb_execution_handler.zs"
#include "zscript/ZMoveMenu.ZMV"
//#include "zscript/PbWheel/parse.zsc"
//#include "zscript/PbWheel/ev_core_special.zsc"
//#include "zscript/PbWheel/ev_drawer_special.zsc"
////////////////////////////////////////////////////////
// Gearbox includes
///////////////////////////////////////////////////////
#include "zscript/gearbox/weapon_data.zs"
#include "zscript/gearbox/weapon_data_loader.zs"
#include "zscript/gearbox/printer.zs"
#include "zscript/MD5/MD5.zs"
#include "zscript/gearbox/custom_weapon_order_storage.zs"
#include "zscript/gearbox/activity.zs"
#include "zscript/gearbox/input.zs"
#include "zscript/gearbox/input_processor.zs"
#include "zscript/gearbox/event_processor.zs"
#include "zscript/gearbox/sounds.zs"
#include "zscript/gearbox/weapon_menu.zs"
#include "zscript/gearbox/inventory_menu.zs"
//pb things
#include "zscript/gearbox/specials_menu.zs"
#include "zscript/gearbox/EquipmentMenu.zs"
#include "zscript/gearbox/pb/tokens.zs" //this is were specials and equipments are defined to be used by the handler
#include "zscript/gearbox/inventory_user.zs"
#include "zscript/gearbox/sender.zs"
#include "zscript/gearbox/netevent_processor.zs"
#include "zscript/gearbox/changer.zs"
#include "zscript/gearbox/view_model.zs"
// Displaying data on screen.
#include "zscript/gearbox/display/dim.zs"
#include "zscript/gearbox/display/blur.zs"
#include "zscript/gearbox/display/blocky_view.zs"
#include "zscript/gearbox/display/text_view.zs"
#include "zscript/gearbox/display/fade_in_out.zs"
#include "zscript/gearbox/display/caption.zs"
#include "zscript/gearbox/options.zs"
#include "zscript/gearbox/font_selector.zs"
// Weapon Wheel implementation.
#include "zscript/gearbox/wheel/view.zs"
#include "zscript/gearbox/wheel/controller.zs"
#include "zscript/gearbox/wheel/controller_model.zs"
#include "zscript/gearbox/wheel/inner_indexer.zs"
#include "zscript/gearbox/wheel/indexer.zs"
#include "zscript/gearbox/wheel/multiwheel.zs"
#include "zscript/gearbox/wheel/multiwheel_mode.zs"
#include "zscript/gearbox/wheel/text.zs"
#include "zscript/gearbox/wheel/screen.zs"
// Utility tools.
#include "zscript/gearbox/tools/cvar.zs"
#include "zscript/gearbox/tools/log.zs"
#include "zscript/gearbox/tools/texture_cache.zs"
#include "zscript/gearbox/tools/ammo.zs"
// Helper classes gearbox/that wrap access to game information provided by the engine.
#include "zscript/gearbox/engine/level.zs"
#include "zscript/gearbox/engine/weapon_watcher.zs"
#include "zscript/gearbox/engine/player.zs"
#include "zscript/gearbox/freezer.zs"
#include "zscript/gearbox/event_handler.zs"
#include "zscript/gearbox/service/service.zs"
#include "zscript/gearbox/service/icon_service.zs"
#include "zscript/gearbox/service/hide_service.zs"
// Libraries
#include "zscript/m_gizmos/previous_weapon.zs"
#include "zscript/zabor/event_handler.zs"
//
// end of gearbox includes
//
//Spices and Seasoning
#include "zscript/TiltPlus/TiltPlusPlus.zc"
#include "zscript/TiltPlus/TiltPlusPlusMenu.zc"
#include "zscript/Footsteps.zs"
#include "zscript/DeathFader.zc"
#include "zscript/Gore/NashGore/NashGoreCommon.zc"
#include "zscript/Gore/NashGore/NashGoreStatics.zc"
#include "zscript/Gore/NashGore/NashGoreHandler.zc"
#include "zscript/Gore/NashGore/NashGoreBlood.zc"
#include "zscript/Gore/NashGore/NashGoreBloodPlane.zc"
#include "zscript/Gore/NashGore/NashGoreGibs.zc"
#include "zscript/Gore/NashGore/NashGoreCrushedGibs.zc"
#include "zscript/Gore/NashGore/NashGoreSquishyGibs.zc"
#include "zscript/Gore/NashGore/NashGoreIceChunk.zc"
#include "zscript/Gore/NashGore/NashGoreLiquidBlood.zc"
#include "zscript/Gore/NashGore/NashGoreWallBlood.zc"
#include "zscript/Gore/NashGore/NashGoreActor.zc"
#include "zscript/Gore/NashGore/NashGoreMenu.zc"
#include "zscript/Gore/PBBlood.zc"
#include "zscript/Gore/PBGore.zc"
#include "zscript/Gore/PBGoreEffects.zc"
//PB_ITEM_CORE
#include "zscript/Items/PowerupsBase.zsc"
#include "zscript/Items/AmmoBase.zsc"
#include "zscript/Items/HPAPBase.zsc"
//PB Items
#include "zscript/Items/PowerUps/Powerups.zsc"
#include "zscript/Items/Ammo/AmmoBullet.zsc"
#include "zscript/Items/Ammo/AmmoShell.zsc"
#include "zscript/Items/Ammo/AmmoExplosive.zsc"
#include "zscript/Items/Ammo/AmmoCell.zsc"
#include "zscript/Items/Ammo/AmmoFuel.zsc"
#include "zscript/Items/Ammo/AmmoDemon.zsc"
#include "zscript/Items/Ammo/AmmoPacks.zsc"
#include "zscript/Items/HealthArmor/HP.zsc"
#include "zscript/Items/HealthArmor/AP.zsc"
//PB_CORE_DECORATION
#include "zscript/Decorations/PBKeys.zc"
//Monsters
#include "zscript/PBHitbox.zc"
#include "zscript/Decorations/PBDeadGeneric.zc"
#include "zscript/Monsters/PBMonster.zsc"
#include "zscript/Monsters/PBMonsterAmmo.zsc"
#include "zscript/Monsters/Special/BossBrain.zc"
#include "zscript/Monsters/ZombieMen/ZombieMan.zc"
#include "zscript/Monsters/ZombieMen/ZombieManDeath.zc"
#include "zscript/Monsters/ZombieMen/ZombieManHelmet.zc"
#include "zscript/Monsters/ZombieMen/ZombieManPistol.zc"
#include "zscript/Monsters/ZombieMen/ZombieManHelmetPistol.zc"
#include "zscript/Monsters/ZombieMen/ZombieManCarbine.zc"
#include "zscript/Monsters/ZombieMen/ZombieManPlasma.zc"
#include "zscript/Monsters/ZombieMen/ZombieScientist.zc"
#include "zscript/Monsters/ZombieMen/ZombieScientistChainsaw.zc"
#include "zscript/Monsters/Sergeants/ZombieSergeant.zc"
#include "zscript/Monsters/Sergeants/ZombieSergeantHelmet.zc"
#include "zscript/Monsters/Sergeants/ZombieSergeantShield.zc"
#include "zscript/Monsters/Chaingunner/Commando.zc"
#include "zscript/Monsters/Chaingunner/HelmetCommando.zc"
#include "zscript/Monsters/Imps/Imp.zc"
#include "zscript/Monsters/Cacodemons/Cacodemon.zc"
//Effects
#include "zscript/Effects/Casings.txt"
#include "zscript/Effects/EmptyMag.txt"
#include "zscript/Effects/IceShards.txt"
#include "zscript/Effects/BulletPuffs.txt"
#include "zscript/Effects/Smoke.zs"
#include "zscript/Effects/FxBase.zs"
#include "zscript/Effects/MonsterBeam.zs"
#include "zscript/Effects/Fireworks.zs"
//Weapons
#include "zscript/Weapons/BaseWeapon.zc"
#include "zscript/Weapons/BaseWeapon_Functions.zsc"
#include "zscript/Weapons/BaseWeapon_Equipment.zsc"
#include "zscript/Weapons/BaseWeapon_Melee.zsc"
#include "zscript/Weapons/BaseWeapon_Executions.zsc"
#include "zscript/Weapons/BaseWeapon_Barrels.zsc"
#include "zscript/Weapons/Taunting.zc"
#include "zscript/Weapons/FlamerStuff.zsc"
#include "zscript/Weapons/Projectiles/BulletProjectile.zsc"
#include "zscript/Weapons/Projectiles/BulletDef.SmallCal.zsc"
#include "zscript/Weapons/Projectiles/BulletDef.Shell.zsc"
#include "zscript/Weapons/Projectiles/BulletDef.HighCal.zsc"
#include "zscript/Weapons/Projectiles/BulletDef.SpecialProjectiles.zsc"
#include "zscript/Weapons/Projectiles/BulletDef.EnemyProjectiles.zsc"
#include "zscript/Weapons/Projectiles/RailGunPj.zs"
#include "zscript/Weapons/Projectiles/DragonsBreath.zs"
#include "zscript/Weapons/Projectiles/Shrapnel.zsc"
#include "zscript/Weapons/ThrownGrenades.zs"
#include "zscript/Weapons/Keepweapmanager.zsc"
#include "actors/Weapons/Slot0/UnmakerCharge.zsc"
#include "zscript/Weapons/Slot2/Revolver.zs"
#include "zscript/Weapons/Slot2/Deagle.zs"
#include "zscript/Weapons/Slot3/Shotgun.zs"
#include "zscript/Weapons/Slot6/SuperGL.zs"
#include "zscript/Weapons/Slot7/PlasmaM1.zs"
//Spawners
#include "zscript/Spawner/PB_SpawnerBase.zc"
#include "zscript/Spawner/PB_SpawnerTypes.zc"
#include "zscript/Spawner/Weapons/PB_PistolSpawner.zc"
#include "zscript/Spawner/Weapons/PB_ChainsawSpawner.zc"
#include "zscript/Spawner/Weapons/PB_ShotgunSpawner.zc"
#include "zscript/Spawner/Weapons/PB_SSGSpawner.zc"
#include "zscript/Spawner/Weapons/PB_ChaingunSpawner.zc"
#include "zscript/Spawner/Weapons/PB_RLSpawner.zc"
#include "zscript/Spawner/Weapons/PB_PlasmaRifleSpawner.zc"
#include "zscript/Spawner/Weapons/PB_BFGSpawner.zc"
#include "zscript/Spawner/Items/PB_HPBonusSpawner.zc"
#include "zscript/Spawner/Items/PB_StimSpawner.zc"
#include "zscript/Spawner/Items/PB_MedkitSpawner.zc"
#include "zscript/Spawner/Items/PB_APBonusSpawner.zc"
#include "zscript/Spawner/Items/PB_GreenSpawner.zc"
#include "zscript/Spawner/Items/PB_BlueSpawner.zc"
#include "zscript/Spawner/Items/PB_PowerUpsSpawner.zs"
#include "zscript/Spawner/Monsters/PBZombiemanSpawner.zc"
#include "zscript/Spawner/Monsters/PBShotgunGuySpawner.zc"
#include "zscript/Spawner/Monsters/PBCommandoSpawner.zc"
#include "zscript/Spawner/Monsters/PBImpSpawner.zc"
#include "zscript/Spawner/Monsters/PBPinkySpawner.zc"
#include "zscript/Spawner/Monsters/PBSpectreSpawner.zc"
#include "zscript/Spawner/Monsters/PBCacoDemonSpawner.zc"
#include "zscript/Spawner/Monsters/PBPESpawner.zc"
#include "zscript/Spawner/Monsters/PBLostSoulSpawner.zc"
#include "zscript/Spawner/Monsters/PBRevSpawner.zc"
#include "zscript/Spawner/Monsters/PBArachSpawner.zc"
#include "zscript/Spawner/Monsters/PBHKSpawner.zc"
#include "zscript/Spawner/Monsters/PBBOHSpawner.zc"
#include "zscript/Spawner/Monsters/PBMancubusSpawner.zc"
#include "zscript/Spawner/Monsters/PBAVSpawner.zc"
#include "zscript/Spawner/Monsters/PBMastermindSpawner.zc"
#include "zscript/Spawner/Monsters/PBCyberDemonSpawner.zc"
#include "zscript/Spawner/Monsters/PBNaziSpawner.zc"
#include "zscript/Spawner/Monsters/PBStealthMonsterSpawner.zc"
#include "zscript/Spawner/Ammo/PB_PackSpawner.zc"
#include "zscript/Spawner/Ammo/PB_MagSpawner.zc"
#include "zscript/Spawner/Ammo/PB_MagBoxSpawner.zc"
#include "zscript/Spawner/Ammo/PB_CellSpawner.zc"
#include "zscript/Spawner/Ammo/PB_CellPackSpawner.zc"
#include "zscript/Spawner/Ammo/PB_ShellSpawner.zc"
#include "zscript/Spawner/Ammo/PB_ShellBoxSpawner.zc"
#include "zscript/Spawner/Ammo/PB_RocketSpawner.zc"
#include "zscript/Spawner/Ammo/PB_RocketBoxSpawner.zc"
//PBVP
#include "zscript/PBVP/PBVP.zc"
class Demonpickup: CustomInventory
{
Default
{
Height 26;
-COUNTITEM
+INVENTORY.ALWAYSPICKUP
Inventory.PickupMessage "Lesser demon energy";
Inventory.PickupSound "demonsoulpickup";
renderstyle 'translucent';
Scale 0.28;
alpha 0.65;
}
States
{
Spawn:
MDHP ABCDEFGH 3 bright A_Fadeout(0.001);
Loop;
Pickup:
TNT1 A 0 A_GiveInventory("Demonpower",10);
TNT1 A 0 A_GiveInventory("Armorshard", 1) ;
// TNT1 A 0 A_GiveInventory("Healthplus", 1) - too easy!
Stop;
}
}
class Demonpickup2: Demonpickup
{
Default
{
renderstyle 'translucent';
alpha 0.70;
Scale 0.45;
Inventory.PickupMessage "Greater demon energy";
}
States
{
Spawn:
MDHP ABCDEFGH 2 bright A_Fadeout(0.001);
Loop;
Pickup:
TNT1 A 0 A_GiveInventory("LargeDemonpower",30);
TNT1 A 0 A_GiveInventory("Armorshard", 2);
TNT1 A 0 A_GiveInventory("Healthplus", 2);
Stop;
}
}
// global constants
const STAT_NashGore_Gore = Thinker.STAT_USER + 1;
const STAT_PB_BULLETS = Thinker.STAT_USER_MAX - 1;
const C_TID = 1000; //Default camera tid
const MAX_R = 56+32; //Maximum radius (or distance from the player)
const ADJUST_R = 8; //Amount to adjust the camera by
const VIEW_HEIGHT = 61.0; //The approximate hight of the player's view
class DoNotDoubleJump : Inventory {}
class BossBrainBase : Actor
{
void RemoveCubes()
{
ThinkerIterator ti = ThinkerIterator.Create("Actor");
Actor a;
while (a = Actor(ti.Next()))
{
if (a is "SpawnShot" || a is "BossEye") a.Destroy();
if (a.bISMONSTER && a.bCOUNTKILL) a.A_Die("Massacre");
}
}
}
// Spawner code courtesy of Marisa Kirisame.
class SpawnerBase : Actor
{
void SpawnActor(class<Actor> spawnactor, bool HandleSpawnFlags = true)
{
Actor a = self;
Actor r = a.Spawn(spawnactor,a.pos);
r.spawnangle = a.spawnangle;
r.angle = a.angle;
r.pitch = a.pitch;
r.roll = a.roll;
r.spawnpoint = a.spawnpoint;
r.special = a.special;
r.args[0] = a.args[0];
r.args[1] = a.args[1];
r.args[2] = a.args[2];
r.args[3] = a.args[3];
r.args[4] = a.args[4];
r.special1 = a.special1;
r.special2 = a.special2;
r.spawnflags = a.spawnflags&~MTF_SECRET;
if (HandleSpawnFlags) r.HandleSpawnFlags();
r.spawnflags = a.spawnflags;
r.bCOUNTSECRET = a.spawnflags&MTF_SECRET;
r.ChangeTid(a.tid);
r.Vel = a.vel;
}
}
extend class Demonpickup
{
void SpawnActor(class<Actor> spawnactor, bool HandleSpawnFlags = true)
{
Actor a = self;
Actor r = a.Spawn(spawnactor,a.pos);
r.spawnangle = a.spawnangle;
r.angle = a.angle;
r.pitch = a.pitch;
r.roll = a.roll;
r.spawnpoint = a.spawnpoint;
r.special = a.special;
r.args[0] = a.args[0];
r.args[1] = a.args[1];
r.args[2] = a.args[2];
r.args[3] = a.args[3];
r.args[4] = a.args[4];
r.special1 = a.special1;
r.special2 = a.special2;
r.spawnflags = a.spawnflags&~MTF_SECRET;
if (HandleSpawnFlags) r.HandleSpawnFlags();
r.spawnflags = a.spawnflags;
r.bCOUNTSECRET = a.spawnflags&MTF_SECRET;
r.ChangeTid(a.tid);
r.Vel = a.vel;
}
}
enum EPBWeaponFlags
{
PBWEAP_KEEPYOFFSET = 1<<0, //Weapon must not move up/down when looking up/down.
PBWEAP_ISPISTOLSILENCERSTATE = 1<<3, // Weapon is equipped with a silencer.
PBWEAP_UNLOADED = 1<<4 // Weapon has been unloaded.
}
class InvisiblePuff : BulletPuff
{
Default
{
-ALLOWPARTICLES
}
}
class InvisiblePuffAlways : InvisiblePuff
{
Default
{
+ALWAYSPUFF
+THRUACTORS
+ALLOWTHRUFLAGS
}
}
class CameraRunner : Inventory
{
static bool CheckForCamera(class<Actor> classname,int tidnum)
{
ActorIterator at = Level.CreateActorIterator(tidnum);
Actor a = at.Next();
if (a != NULL && a.GetClassName() == classname) return true;
return false;
}
static Actor CheckForCameraActor(class<Actor> classname,int tidnum)
{
ActorIterator at = Level.CreateActorIterator(tidnum);
Actor a = at.Next();
if (a != NULL && a.GetClassName() == classname) return a;
return null;
}
static void SetActorAngle(int tidnum, double angle)
{
ActorIterator at = Level.CreateActorIterator(tidnum);
Actor a = at.Next();
if (a != NULL) a.angle = angle;
}
static void SetActorPitch(int tidnum, double pitch)
{
ActorIterator at = Level.CreateActorIterator(tidnum);
Actor a = at.Next();
if (a != NULL) a.pitch = pitch;
}
static void SetActorRoll(int tidnum, double roll)
{
ActorIterator at = Level.CreateActorIterator(tidnum);
Actor a = at.Next();
if (a != NULL) a.roll = roll;
}
static bool, Actor ExtSpawn(class<Actor> classname,Vector3 pos,int tid,double angle)
{
Actor a = Spawn(classname,pos,ALLOW_REPLACE);
if (a != NULL)
{
a.ChangeTid(tid);
a.angle = angle;
return true, a;
}
return false, null;
}
static bool SetActorPosition(int tidnum, Vector3 pos)
{
Actor a = CheckForCameraActor("ChaseCam2",tidnum);
if (a != NULL)
{
a.SetOrigin(pos,true);
if (a.pos == pos) return true;
}
return false;
}
void TerminateCamera()
{
owner.SetCamera(null);
Actor a = CheckForCameraActor("ChaseCam2",C_TID + PlayerPawn(owner).PlayerNumber());
if (a != NULL) a.Destroy();
}
static void WarpCamera(int tid, int plrnum = 1)
{
ActorIterator ai = Level.CreateActorIterator(tid);
Actor a = ai.Next();
if (a != NULL)
{
actor cameraactor;
if ((cameraactor = Level.CreateActorIterator(6400 + plrnum,"WarpCamera").Next()) != NULL)
{
Players[plrnum].mo.SetCamera(cameraactor);
cameraactor.Warp(a,flags: WARPF_INTERPOLATE | WARPF_COPYPITCH);
cameraactor.SetOrigin(Players[plrnum].mo.vel + cameraactor.pos,true);
}
}
else
{
players[consoleplayer].mo.SetCamera(null);
}
}
Vector3, double, double, actor ReturnCamPos(Actor a)
{
Actor linepuff = a.LineAttack(a.angle - 180,128 + (a.radius*2),-a.pitch,0,'None',"InvisiblePuffAlways",LAF_NOINTERACT|LAF_NORANDOMPUFFZ,null,-(a.height/2) + a.player.viewheight);
if (linepuff)
{
let vec3 = linepuff.pos + a.vel;
let anglevalue = linepuff.angle;
let pitchvalue = linepuff.pitch;
linepuff.bINVISIBLE = true;
//linepuff.Destroy();
return vec3, anglevalue, pitchvalue,linepuff;
}
return a.pos, a.angle, a.pitch, null;
}
//ACS Prefab chasecam script ported to ZScript with changes by Cacodemon345.
void RunCameraNew()
{
if (!owner.player || !owner) return; //Don't start camera if the owner isn't a player or is null.
Double anglevalue;
Double pitchvalue;
Double actualpitch = owner.pitch;
actor linepuff;
Vector3 campos;
int plrnum = PlayerPawn(owner).PlayerNumber();
[campos,anglevalue, pitchvalue,linepuff] = ReturnCamPos(owner);
if (!CheckForCamera("ChaseCam2",C_TID + plrnum))
{
Actor cameraactor;
bool cameraspawned;
[cameraspawned, cameraactor] = self.ExtSpawn ("ChaseCam2", campos, C_TID+plrnum, angle);
if (CheckForCamera ("ChaseCam2", C_TID + plrnum))
owner.SetCamera(cameraactor);
else
{
Console.MidPrint ("INDEXFONT_DOOM","Camera script failed to initialize.");
return;
}
}
else
{
Actor cameraactor = CheckForCameraActor("ChaseCam2",C_TID + plrnum);
cameraactor.SetOrigin(campos,true);
//cameraactor.Warp(owner,0,0,0,0,WARPF_INTERPOLATE);
self.SetActorAngle (C_TID + plrnum, anglevalue);
self.SetActorPitch (C_TID + plrnum, actualpitch);
self.SetActorRoll (C_TID + plrnum, owner.roll);
}
}
override void DoEffect()
{
let p = PlayerPawn(owner);
if (p)
{
self.RunCameraNew();
}
}
override void OnDestroy()
{
let p = PlayerPawn(owner);
if (p)
{
self.TerminateCamera();
}
Super.OnDestroy();
}
}
class LaserDeactivated : Inventory {}
class XDeathGibBase : Actor
{
void A_PBGibMissile(class<Actor> missiletype, double spawnheight = 32, double spawnofs_xy = 0, double angle = 0, int flags = 0, double pitch = 0, int ptr = AAPTR_TARGET)
{
let a = A_SpawnProjectile(missiletype, spawnheight, spawnofs_xy, angle, flags | CMF_BADPITCH | CMF_SAVEPITCH, pitch, ptr);
if (a)
{
a.VelFromAngle(vel.xy.Length() / 2, self.angle + frandom(-20, 20));
a.vel.z += vel.z + 5;
}
}
override void PostBeginPlay()
{
Super.PostBeginPlay();
if (target)
{
vel = target.vel;
A_FaceMovementDirection();
}
}
}
// Optional Motion Blur by Pixel Eater
class MBlurHandler : StaticEventHandler
{
int pitch, yaw ;
double xtravel, ytravel ;
override void PlayerEntered( PlayerEvent e )
{
PlayerInfo plr = players[ consoleplayer ];
if( plr )
{
xtravel = 0 ;
ytravel = 0 ;
}
}
override void WorldTick()
{
PlayerInfo plr = players[ consoleplayer ];
if( plr && plr.health > 0 && Cvar.GetCVar( "mblur", plr ).GetBool() && !plr.mo.FindInventory("PlayerWheelOpen"))
{
yaw = plr.mo.GetPlayerInput( ModInput_Yaw );
pitch = -plr.mo.GetPlayerInput( ModInput_Pitch );
}
}
override void NetworkProcess( ConsoleEvent e )
{
PlayerInfo plr = players[ consoleplayer ];
if( plr && plr.mo && e.Name == "liveupdate" && !plr.mo.FindInventory("PlayerWheelOpen"))
{
double pitchdimin = 1. - abs( plr.mo.pitch * 1. / 90 );
double decay = 1. - Cvar.GetCVar( "mblur_recovery", plr ).GetFloat() * .01 ;
double amount = Cvar.GetCVar( "mblur_strength", plr ).GetFloat() * 10. / 32767 * sqrt( pitchdimin );
if(plr.mo.FindInventory("PlayerWheelOpen")){
xtravel = 0 * decay + yaw * amount * .625 ;
ytravel = 0 * decay + pitch * amount ;
}
else
{
xtravel = xtravel * decay + yaw * amount * .625 ;
ytravel = ytravel * decay + pitch * amount ;
}
if( Cvar.GetCVar( "mblur_autostop", plr ).GetBool() )
{
double threshold = Cvar.GetCVar( "mblur_threshold", plr ).GetFloat() * 30 ;
double recovery2 = 1 - Cvar.GetCVar( "mblur_recovery2", plr ).GetFloat() * .01 ;
if( abs( yaw ) <= threshold ) xtravel *= recovery2 ;
if( abs( pitch ) <= threshold ) ytravel *= recovery2 ;
}
}
}
override void UiTick()
{
PlayerInfo plr = players[ consoleplayer ];
if( plr )
{
let player = players[ consoleplayer ].mo;
if( plr.health > 0 && Cvar.GetCVar( "mblur", plr ).GetBool() && !plr.mo.FindInventory("PlayerWheelOpen"))//&& yaw && pitch )
{
EventHandler.SendNetworkEvent( "liveupdate" );
int copies = 1 + Cvar.GetCVar( "mblur_samples", plr ).GetInt() ;
double increment = 1. / copies ;
vector2 travel = ( xtravel, ytravel ) / screen.getheight() ;
if(player && plr)
{
PPShader.SetUniform2f( "MBlur", "steps", travel * increment );
PPShader.SetUniform1f( "MBlur", "samples", copies );
PPShader.SetUniform1f( "MBlur", "increment", increment );
PPShader.SetUniform1f( "MBlur", "blendmode", Cvar.GetCVar( "mblur_blendmode", plr ).GetInt() );
PPShader.SetEnabled( "MBlur", true );
}
}
else
{
if(player && plr)
PPShader.SetEnabled( "MBlur", false );
}
}
}
}