Backported changes from experimental branch.
Fixed crash on screen flashes due to misuse of StaticEventHandler.Find instead of EventHandler.Find (oops).
This commit is contained in:
parent
691fb8cee6
commit
d69eaa682f
8 changed files with 60 additions and 18 deletions
|
|
@ -1,8 +1,8 @@
|
||||||
version "3.7"
|
version "3.7"
|
||||||
|
|
||||||
#include "zscript/mk_matrix.zsc"
|
#include "zscript/dt_matrix.zsc"
|
||||||
#include "zscript/mk_coordutil.zsc"
|
#include "zscript/dt_coordutil.zsc"
|
||||||
#include "zscript/mk_quaternion.zsc"
|
#include "zscript/dt_quaternion.zsc"
|
||||||
#include "zscript/utgore.zsc"
|
#include "zscript/utgore.zsc"
|
||||||
#include "zscript/utcommon.zsc"
|
#include "zscript/utcommon.zsc"
|
||||||
#include "zscript/impacthammer.zsc"
|
#include "zscript/impacthammer.zsc"
|
||||||
|
|
|
||||||
|
|
@ -264,10 +264,10 @@ Class BioGel : Actor
|
||||||
for ( int i=0; i<numpt; i++ )
|
for ( int i=0; i<numpt; i++ )
|
||||||
{
|
{
|
||||||
Vector3 pvel = (FRandom[GES](-1,1),FRandom[GES](-1,1),FRandom[GES](-1,1)).unit()*FRandom[GES](1,3);
|
Vector3 pvel = (FRandom[GES](-1,1),FRandom[GES](-1,1),FRandom[GES](-1,1)).unit()*FRandom[GES](1,3);
|
||||||
Vector3 spos = pos;
|
Vector3 spos = pos+normal*2*scale.x;
|
||||||
if ( atplane == 1 ) spos += Normal*2;
|
|
||||||
let s = Spawn("BioSpark",spos);
|
let s = Spawn("BioSpark",spos);
|
||||||
s.vel = pvel;
|
s.vel = pvel;
|
||||||
|
if ( normal != (0,0,0) ) s.vel += normal*2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( deadtimer <= -1 ) return;
|
if ( deadtimer <= -1 ) return;
|
||||||
|
|
|
||||||
|
|
@ -306,7 +306,14 @@ Class UTRocketLauncher : UTWeapon
|
||||||
{
|
{
|
||||||
Super.Tick();
|
Super.Tick();
|
||||||
if ( !Owner ) return;
|
if ( !Owner ) return;
|
||||||
if ( LockedOn && (!LockedTarget || (LockedTarget.Health <= 0) || !LockedTarget.bIsMonster || LockedTarget.bKilled || LockedTarget.bCorpse || !LockedTarget.bShootable) )
|
if ( Owner.Health <= 0 )
|
||||||
|
{
|
||||||
|
LockedTarget = null;
|
||||||
|
LockedOn = false;
|
||||||
|
crosshair = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ( LockedOn && (!LockedTarget || (LockedTarget.Health <= 0) || !LockedTarget.bIsMonster || LockedTarget.bKilled || LockedTarget.bCorpse || !LockedTarget.bShootable || (Owner.player.ReadyWeapon != self)) )
|
||||||
{
|
{
|
||||||
LockedTarget = null;
|
LockedTarget = null;
|
||||||
LockedOn = false;
|
LockedOn = false;
|
||||||
|
|
|
||||||
|
|
@ -158,6 +158,7 @@ Class FlakChunk : Actor
|
||||||
double rollvel, pitchvel, yawvel;
|
double rollvel, pitchvel, yawvel;
|
||||||
double lifetime, lifespeed;
|
double lifetime, lifespeed;
|
||||||
int lifetics;
|
int lifetics;
|
||||||
|
Vector3 oldvel;
|
||||||
Default
|
Default
|
||||||
{
|
{
|
||||||
Obituary "%o was ripped to shreds by %k's Flak Cannon.";
|
Obituary "%o was ripped to shreds by %k's Flak Cannon.";
|
||||||
|
|
@ -167,13 +168,14 @@ Class FlakChunk : Actor
|
||||||
DamageFunction Random[Flak](15,20);
|
DamageFunction Random[Flak](15,20);
|
||||||
DamageType 'Shredded';
|
DamageType 'Shredded';
|
||||||
BounceType "Hexen";
|
BounceType "Hexen";
|
||||||
BounceFactor 0.8;
|
BounceFactor 1.0;
|
||||||
WallBounceFactor 0.8;
|
WallBounceFactor 1.0;
|
||||||
PROJECTILE;
|
PROJECTILE;
|
||||||
+USEBOUNCESTATE;
|
+USEBOUNCESTATE;
|
||||||
+CANBOUNCEWATER;
|
+CANBOUNCEWATER;
|
||||||
+SKYEXPLODE;
|
+SKYEXPLODE;
|
||||||
+INTERPOLATEANGLES;
|
+INTERPOLATEANGLES;
|
||||||
|
+HITTRACER;
|
||||||
Scale 0.3;
|
Scale 0.3;
|
||||||
}
|
}
|
||||||
override void PostBeginPlay()
|
override void PostBeginPlay()
|
||||||
|
|
@ -192,6 +194,7 @@ Class FlakChunk : Actor
|
||||||
}
|
}
|
||||||
override void Tick()
|
override void Tick()
|
||||||
{
|
{
|
||||||
|
oldvel = vel;
|
||||||
Super.Tick();
|
Super.Tick();
|
||||||
if ( globalfreeze || level.frozen ) return;
|
if ( globalfreeze || level.frozen ) return;
|
||||||
if ( waterlevel > 0 )
|
if ( waterlevel > 0 )
|
||||||
|
|
@ -228,8 +231,39 @@ Class FlakChunk : Actor
|
||||||
pitch += pitchvel;
|
pitch += pitchvel;
|
||||||
angle += pitchvel;
|
angle += pitchvel;
|
||||||
}
|
}
|
||||||
action void A_HandleBounce()
|
void A_HandleBounce()
|
||||||
{
|
{
|
||||||
|
// chunks in vanilla have a special variation on the standard reflect formula that causes them to bounce differently when hitting a surface head-on
|
||||||
|
// (0.5 to 0.8 reduction perpendicular to the surface normal, to be specific)
|
||||||
|
Vector3 HitNormal = -vel.unit();
|
||||||
|
if ( BlockingFloor ) HitNormal = BlockingFloor.floorplane.Normal;
|
||||||
|
else if ( BlockingCeiling ) HitNormal = BlockingCeiling.ceilingplane.Normal;
|
||||||
|
else if ( BlockingLine )
|
||||||
|
{
|
||||||
|
HitNormal = (-BlockingLine.delta.y,BlockingLine.delta.x,0).unit();
|
||||||
|
if ( !BlockingLine.sidedef[1] || (CurSector == BlockingLine.frontsector) )
|
||||||
|
HitNormal *= -1;
|
||||||
|
}
|
||||||
|
else if ( BlockingMobj )
|
||||||
|
{
|
||||||
|
Vector3 diff = level.Vec3Diff(pos,BlockingMobj.pos);
|
||||||
|
if ( (pos.x+radius) <= (BlockingMobj.pos.x-BlockingMobj.radius) )
|
||||||
|
HitNormal = (-1,0,0);
|
||||||
|
else if ( (pos.x-radius) >= (BlockingMobj.pos.x+BlockingMobj.radius) )
|
||||||
|
HitNormal = (1,0,0);
|
||||||
|
else if ( (pos.y+radius) <= (BlockingMobj.pos.y-BlockingMobj.radius) )
|
||||||
|
HitNormal = (0,-1,0);
|
||||||
|
else if ( (pos.y-radius) >= (BlockingMobj.pos.y+BlockingMobj.radius) )
|
||||||
|
HitNormal = (0,1,0);
|
||||||
|
else if ( pos.z >= (BlockingMobj.pos.z+BlockingMobj.height) )
|
||||||
|
HitNormal = (0,0,1);
|
||||||
|
else if ( (pos.z+height) <= BlockingMobj.pos.z )
|
||||||
|
HitNormal = (0,0,-1);
|
||||||
|
}
|
||||||
|
// undo the bounce, we need to hook in our own
|
||||||
|
vel = oldvel;
|
||||||
|
// re-do the bounce with our formula
|
||||||
|
vel = 0.8*((vel dot HitNormal)*HitNormal*(-1.8+FRandom[Flak](0.0,0.8))+vel);
|
||||||
bHITOWNER = true;
|
bHITOWNER = true;
|
||||||
int numpt = Random[Flak](2,3);
|
int numpt = Random[Flak](2,3);
|
||||||
if ( (frame < 10) && Random[Flak](0,1) )
|
if ( (frame < 10) && Random[Flak](0,1) )
|
||||||
|
|
@ -244,13 +278,9 @@ Class FlakChunk : Actor
|
||||||
else A_SprayDecal("WallCrack",-8);
|
else A_SprayDecal("WallCrack",-8);
|
||||||
A_Gravity();
|
A_Gravity();
|
||||||
gravity = 0.35;
|
gravity = 0.35;
|
||||||
invoker.rollvel = FRandom[Flak](50,100)*RandomPick[Flak](-1,1)*(vel.length()/speed);
|
rollvel = FRandom[Flak](50,100)*RandomPick[Flak](-1,1)*(vel.length()/speed);
|
||||||
invoker.pitchvel = FRandom[Flak](50,100)*RandomPick[Flak](-1,1)*(vel.length()/speed);
|
pitchvel = FRandom[Flak](50,100)*RandomPick[Flak](-1,1)*(vel.length()/speed);
|
||||||
invoker.yawvel = FRandom[Flak](50,100)*RandomPick[Flak](-1,1)*(vel.length()/speed);
|
yawvel = FRandom[Flak](50,100)*RandomPick[Flak](-1,1)*(vel.length()/speed);
|
||||||
vel = (vel.unit()+(FRandom[Flak](-0.2,0.2),FRandom[Flak](-0.2,0.2),FRandom[Flak](-0.2,0.2))).unit()*vel.length();
|
|
||||||
// TODO chunks in vanilla have a special variation on the standard reflect formula that causes them to bounce differently when hitting a surface head-on
|
|
||||||
// (0.5 to 0.8 reduction perpendicular to the surface normal, to be specific)
|
|
||||||
// I have no idea how I'll even implement this reduction reliably
|
|
||||||
A_PlaySound("flak/bounce",volume:0.3);
|
A_PlaySound("flak/bounce",volume:0.3);
|
||||||
A_AlertMonsters();
|
A_AlertMonsters();
|
||||||
if ( vel.length() < 5.0 ) ExplodeMissile();
|
if ( vel.length() < 5.0 ) ExplodeMissile();
|
||||||
|
|
@ -302,7 +332,12 @@ Class FlakChunk : Actor
|
||||||
Crash:
|
Crash:
|
||||||
TNT1 A 0
|
TNT1 A 0
|
||||||
{
|
{
|
||||||
Spawn("BulletPuff",pos);
|
let l = Spawn("BulletImpact",pos);
|
||||||
|
Vector3 dir;
|
||||||
|
if ( tracer ) dir = level.Vec3Diff(pos,tracer.Vec3Offset(0,0,tracer.height/2)).unit();
|
||||||
|
else dir = vel.unit();
|
||||||
|
l.angle = atan2(dir.y,dir.x);
|
||||||
|
l.pitch = asin(-dir.z);
|
||||||
A_PlaySound("flak/hit",volume:0.3);
|
A_PlaySound("flak/hit",volume:0.3);
|
||||||
A_AlertMonsters();
|
A_AlertMonsters();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1964,7 +1964,7 @@ Class UTMainHandler : EventHandler
|
||||||
qf.c = c;
|
qf.c = c;
|
||||||
qf.tic = gametic;
|
qf.tic = gametic;
|
||||||
qf.cam = camera;
|
qf.cam = camera;
|
||||||
let hnd = UTMainHandler(StaticEventHandler.Find("UTMainHandler"));
|
let hnd = UTMainHandler(EventHandler.Find("UTMainHandler"));
|
||||||
hnd.flashes.push(qf);
|
hnd.flashes.push(qf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue