forked from pa1nki113r/Project_Brutality
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathZSCRIPT.zc
491 lines (461 loc) · 13.5 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
version "4.5.0"
const MAXITERATIONS = 32676;
#include "zscript/Weapons/FlamerStuff.zsc"
#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/PbWheel/parse.zsc"
#include "zscript/PbWheel/ev_core_special.zsc"
#include "zscript/PbWheel/ev_drawer_special.zsc"
#include "zscript/DeathFader.zc"
#include "zscript/PlayerPawn.zc"
#include "zscript/ZMoveMenu.ZMV"
#include "zscript/PBHitbox.zc"
#include "zscript/TiltPlus/TiltPlusPlus.zc"
#include "zscript/TiltPlus/TiltPlusPlusMenu.zc"
#include "zscript/PBPDA.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"
#include "zscript/Decorations/PBDeadGeneric.zc"
#include "zscript/Decorations/PBKeys.zc"
//Monsters
#include "zscript/Monsters/PBMonster.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/Imps/Imp.zc"
//Effects
#include "zscript/Effects/Casings.txt"
#include "zscript/Effects/IceShards.txt"
#include "zscript/Effects/JunkedBarrel.txt"
//Lewisk3Lasers
#include "zscript/LaserAPI/LaserAPI.txt"
//Weapons
#include "zscript/Weapons/BaseWeapon.zc"
//Spawners
#include "zscript/Spawner/PB_SpawnerBase.zc"
#include "zscript/Spawner/Weapons/PB_ShotgunSpawner.zc"
//Le Funny Hat Simulator
#include "zscript/SpecialShit/HatExtravaganza.zc"
//PBVP
#include "zscript/PBVP/PBVP.zc"
Class PB_SpecialWheel_Mode
{
string specialName;
string specialAlias;
TextureID specialIcon;
Vector2 iconScale;
int specialPriority;
bool hidden;
bool mergeDir;
}
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() ;
Shader.SetUniform2f( plr, "MBlur", "steps", travel * increment );
Shader.SetUniform1f( plr, "MBlur", "samples", copies );
Shader.SetUniform1f( plr, "MBlur", "increment", increment );
Shader.SetUniform1f( plr, "MBlur", "blendmode", Cvar.GetCVar( "mblur_blendmode", plr ).GetInt() );
Shader.SetEnabled( plr, "MBlur", true );
}
else
{
Shader.SetEnabled( plr, "MBlur", false );
}
}
}
}