Push ZScript version to 3.8 and adapt accordingly to level global removal.

This isn't guaranteed to be 100% stable at the moment.
This commit is contained in:
Marisa the Magician 2019-01-20 16:32:26 +01:00
commit e3cf50b32c
16 changed files with 72 additions and 69 deletions

View file

@ -7,3 +7,8 @@ GameInfo
BorderFlat = "TEMPBG" BorderFlat = "TEMPBG"
Border = 0,0,"","","","","","","","" Border = 0,0,"","","","","","","",""
} }
// titlemaps need a mapinfo entry in devbuilds
map TITLEMAP "UT Logo Map"
{
}

View file

@ -1,4 +1,4 @@
version "3.7" version "3.8"
#include "zscript/mk_matrix.zsc" #include "zscript/mk_matrix.zsc"
#include "zscript/mk_coordutil.zsc" #include "zscript/mk_coordutil.zsc"

View file

@ -158,7 +158,7 @@ Class BioXLight : DynamicLight
override void Tick() override void Tick()
{ {
Super.Tick(); Super.Tick();
if ( globalfreeze || level.frozen ) return; if ( isFrozen() ) return;
args[LIGHT_RED] = int(64*lifetime); args[LIGHT_RED] = int(64*lifetime);
args[LIGHT_GREEN] = int(255*lifetime); args[LIGHT_GREEN] = int(255*lifetime);
args[LIGHT_BLUE] = int(48*lifetime); args[LIGHT_BLUE] = int(48*lifetime);
@ -213,7 +213,7 @@ Class BioGel : Actor
override void Tick() override void Tick()
{ {
Super.Tick(); Super.Tick();
if ( globalfreeze || level.frozen ) return; if ( isFrozen() ) return;
if ( !bNOGRAVITY ) if ( !bNOGRAVITY )
{ {
roll += rollvel; roll += rollvel;
@ -608,7 +608,7 @@ Class BioGlob : BioGel
override void Tick() override void Tick()
{ {
Super.Tick(); Super.Tick();
if ( globalfreeze || level.frozen ) return; if ( isFrozen() ) return;
Vector3 ofs = (cos(angle)*cos(pitch),sin(angle)*cos(pitch),-sin(pitch)); Vector3 ofs = (cos(angle)*cos(pitch),sin(angle)*cos(pitch),-sin(pitch));
for ( int i=0; i<2; i++ ) for ( int i=0; i<2; i++ )
{ {

View file

@ -411,7 +411,7 @@ Class UTRocketLauncher : UTWeapon
// lock-on check // lock-on check
action void A_CheckTarget() action void A_CheckTarget()
{ {
let t = ThinkerIterator.Create("Actor"); let t = level.CreateThinkerIterator("Actor");
Actor a; Actor a;
double closest = double.max; double closest = double.max;
invoker.LockedTarget = null; invoker.LockedTarget = null;

View file

@ -117,7 +117,7 @@ Class UTCasing : Actor
override void Tick() override void Tick()
{ {
Super.Tick(); Super.Tick();
if ( level.frozen || globalfreeze ) return; if ( isFrozen() ) return;
if ( InStateSequence(CurState,ResolveState("Death")) ) if ( InStateSequence(CurState,ResolveState("Death")) )
{ {
deadtimer++; deadtimer++;

View file

@ -55,7 +55,7 @@ Class ChunkLight : DynamicLight
Destroy(); Destroy();
return; return;
} }
if ( globalfreeze || level.frozen ) return; if ( isFrozen() ) return;
args[LIGHT_RED] = int(255*(10-target.frame)*0.1); args[LIGHT_RED] = int(255*(10-target.frame)*0.1);
args[LIGHT_GREEN] = int(224*(10-target.frame)*0.1); args[LIGHT_GREEN] = int(224*(10-target.frame)*0.1);
args[LIGHT_BLUE] = int(128*(10-target.frame)*0.1); args[LIGHT_BLUE] = int(128*(10-target.frame)*0.1);
@ -84,7 +84,7 @@ Class ChunkTrail : Actor
override void Tick() override void Tick()
{ {
Super.Tick(); Super.Tick();
if ( globalfreeze || level.frozen ) return; if ( isFrozen() ) return;
if ( InStateSequence(CurState,FindState("Death")) ) return; if ( InStateSequence(CurState,FindState("Death")) ) return;
if ( !target ) if ( !target )
{ {
@ -121,7 +121,7 @@ Class FlakAccumulator : Thinker
static void Accumulate( Actor victim, int amount ) static void Accumulate( Actor victim, int amount )
{ {
let ti = ThinkerIterator.Create("FlakAccumulator",STAT_USER); let ti = victim.level.CreateThinkerIterator("FlakAccumulator",STAT_USER);
FlakAccumulator a, match = null; FlakAccumulator a, match = null;
while ( a = FlakAccumulator(ti.Next()) ) while ( a = FlakAccumulator(ti.Next()) )
{ {
@ -131,7 +131,7 @@ Class FlakAccumulator : Thinker
} }
if ( !match ) if ( !match )
{ {
match = new("FlakAccumulator"); match = new("FlakAccumulator"); // another thinker created through new(), this all looks like a big catastrophe waiting to happen
match.ChangeStatNum(STAT_USER); match.ChangeStatNum(STAT_USER);
match.victim = victim; match.victim = victim;
} }
@ -141,7 +141,7 @@ Class FlakAccumulator : Thinker
static int GetAmount( Actor victim ) static int GetAmount( Actor victim )
{ {
let ti = ThinkerIterator.Create("FlakAccumulator",STAT_USER); let ti = victim.level.CreateThinkerIterator("FlakAccumulator",STAT_USER);
FlakAccumulator a; FlakAccumulator a;
while ( a = FlakAccumulator(ti.Next()) ) while ( a = FlakAccumulator(ti.Next()) )
{ {
@ -194,7 +194,7 @@ Class FlakChunk : Actor
override void Tick() override void Tick()
{ {
Super.Tick(); Super.Tick();
if ( globalfreeze || level.frozen ) return; if ( isFrozen() ) return;
if ( waterlevel > 0 ) if ( waterlevel > 0 )
{ {
vel.xy *= 0.98; vel.xy *= 0.98;
@ -336,7 +336,7 @@ Class SlugSmoke : Actor
override void Tick() override void Tick()
{ {
Super.Tick(); Super.Tick();
if ( globalfreeze || level.frozen ) return; if ( isFrozen() ) return;
lifetime += lifespeed; lifetime += lifespeed;
let s = Spawn("UTSmoke",pos); let s = Spawn("UTSmoke",pos);
s.vel = (FRandom[Flak](-0.5,0.5),FRandom[Flak](-0.5,0.5),FRandom[Flak](-0.5,0.5)); s.vel = (FRandom[Flak](-0.5,0.5),FRandom[Flak](-0.5,0.5),FRandom[Flak](-0.5,0.5));
@ -370,7 +370,7 @@ Class SlugLight : DynamicLight
override void Tick() override void Tick()
{ {
Super.Tick(); Super.Tick();
if ( globalfreeze || level.frozen ) return; if ( isFrozen() ) return;
args[LIGHT_RED] = int(255*lifetime); args[LIGHT_RED] = int(255*lifetime);
args[LIGHT_GREEN] = int(224*lifetime); args[LIGHT_GREEN] = int(224*lifetime);
args[LIGHT_BLUE] = int(128*lifetime); args[LIGHT_BLUE] = int(128*lifetime);

View file

@ -152,7 +152,7 @@ Class ImpactHammer : UTWeapon
if ( d.HitType == TRACE_HitWall ) d.HitLine.RemoteActivate(self,d.LineSide,SPAC_Impact,d.HitLocation-d.HitDir*4); if ( d.HitType == TRACE_HitWall ) d.HitLine.RemoteActivate(self,d.LineSide,SPAC_Impact,d.HitLocation-d.HitDir*4);
} }
// push aside projectiles // push aside projectiles
let t = ThinkerIterator.Create("Actor"); let t = level.CreateThinkerIterator("Actor");
Actor m; Actor m;
while ( m = Actor(t.Next()) ) while ( m = Actor(t.Next()) )
{ {

View file

@ -47,7 +47,7 @@ Class MinigunTracer : Actor
override void Tick() override void Tick()
{ {
Super.Tick(); Super.Tick();
if ( level.frozen || globalfreeze ) return; if ( isFrozen() ) return;
Vector3 dir = level.Vec3Diff(pos,dest); Vector3 dir = level.Vec3Diff(pos,dest);
if ( dir.length() < 160 ) if ( dir.length() < 160 )
{ {

View file

@ -9,7 +9,7 @@ Class dt_CoordUtil
{ {
// projects a world point onto screen // projects a world point onto screen
// view matrix setup mostly pulled from gutawer's code // view matrix setup mostly pulled from gutawer's code
static Vector3 WorldToScreen( Vector3 vect, Vector3 eye, double pitch, double yaw, double roll, double vfov ) static Vector3 WorldToScreen( LevelLocals level, Vector3 vect, Vector3 eye, double pitch, double yaw, double roll, double vfov )
{ {
double ar = Screen.getWidth()/double(Screen.getHeight()); double ar = Screen.getWidth()/double(Screen.getHeight());
double fovr = (ar>=1.3)?1.333333:ar; double fovr = (ar>=1.3)?1.333333:ar;

View file

@ -91,7 +91,7 @@ Class ViewPulseSpark : PulseSpark
Vector3 origin = x*ofs.x+y*ofs.y+z*ofs.z+(0,0,target.player.viewz); Vector3 origin = x*ofs.x+y*ofs.y+z*ofs.z+(0,0,target.player.viewz);
SetOrigin(target.Vec2OffsetZ(origin.x,origin.y,origin.z),true); SetOrigin(target.Vec2OffsetZ(origin.x,origin.y,origin.z),true);
bInvisible = (players[consoleplayer].camera != target); bInvisible = (players[consoleplayer].camera != target);
if ( level.frozen || globalfreeze ) return; if ( isFrozen() ) return;
ofs += vvel; ofs += vvel;
vvel *= 0.9; vvel *= 0.9;
scale *= 0.8; scale *= 0.8;
@ -149,7 +149,7 @@ Class PulseExplLight : DynamicLight
override void Tick() override void Tick()
{ {
Super.Tick(); Super.Tick();
if ( globalfreeze || level.frozen ) return; if ( isFrozen() ) return;
args[LIGHT_RED] = int(64*lifetime); args[LIGHT_RED] = int(64*lifetime);
args[LIGHT_GREEN] = int(255*lifetime); args[LIGHT_GREEN] = int(255*lifetime);
lifetime -= 1./ReactionTime; lifetime -= 1./ReactionTime;
@ -372,7 +372,7 @@ Class PulseBolt : Actor
{ {
if ( !damagedactor ) if ( !damagedactor )
{ {
accdamage = min(0.5*(level.time-lasthit),0.1); accdamage = min(0.5*(level.maptime-lasthit),0.1);
t.Results.HitActor.DamageMobj(self,target,int(Random[Pulse](80,100)*accdamage),'zapped',DMG_USEANGLE,atan2(x.y,x.x)); t.Results.HitActor.DamageMobj(self,target,int(Random[Pulse](80,100)*accdamage),'zapped',DMG_USEANGLE,atan2(x.y,x.x));
accdamage = 0; accdamage = 0;
} }
@ -381,7 +381,7 @@ Class PulseBolt : Actor
t.Results.HitActor.DamageMobj(self,target,int(Random[Pulse](80,100)*accdamage),'zapped',DMG_USEANGLE,atan2(x.y,x.x)); t.Results.HitActor.DamageMobj(self,target,int(Random[Pulse](80,100)*accdamage),'zapped',DMG_USEANGLE,atan2(x.y,x.x));
accdamage = 0; accdamage = 0;
} }
lasthit = level.time; lasthit = level.maptime;
damagedactor = t.Results.HitActor; damagedactor = t.Results.HitActor;
accdamage += 1./TICRATE; accdamage += 1./TICRATE;
if ( accdamage > 0.17 ) if ( accdamage > 0.17 )
@ -506,7 +506,7 @@ Class StarterBolt : PulseBolt
override void Tick() override void Tick()
{ {
Super.Tick(); Super.Tick();
if ( globalfreeze || level.frozen ) return; if ( isFrozen() ) return;
if ( !target ) if ( !target )
{ {
Destroy(); Destroy();

View file

@ -171,7 +171,7 @@ Class Razor2AltLight : DynamicLight
override void Tick() override void Tick()
{ {
Super.Tick(); Super.Tick();
if ( globalfreeze || level.frozen ) return; if ( isFrozen() ) return;
args[LIGHT_RED] = int(255*lifetime); args[LIGHT_RED] = int(255*lifetime);
args[LIGHT_GREEN] = int(240*lifetime); args[LIGHT_GREEN] = int(240*lifetime);
args[LIGHT_BLUE] = int(224*lifetime); args[LIGHT_BLUE] = int(224*lifetime);

View file

@ -72,7 +72,7 @@ Class ShockRifleWave : Actor
override void Tick() override void Tick()
{ {
Super.Tick(); Super.Tick();
if ( globalfreeze || level.frozen ) return; if ( isFrozen() ) return;
alpha -= 1/50.; alpha -= 1/50.;
} }
States States
@ -99,7 +99,7 @@ Class SuperShockRifleWave : Actor
override void Tick() override void Tick()
{ {
Super.Tick(); Super.Tick();
if ( globalfreeze || level.frozen ) return; if ( isFrozen() ) return;
alpha -= 1/50.; alpha -= 1/50.;
} }
States States
@ -127,7 +127,7 @@ Class ShockBeamRing : Actor
override void Tick() override void Tick()
{ {
Super.Tick(); Super.Tick();
if ( globalfreeze || level.frozen ) return; if ( isFrozen() ) return;
alpha -= 1./ReactionTime; alpha -= 1./ReactionTime;
} }
States States
@ -154,7 +154,7 @@ Class SuperShockBeamRing : Actor
override void Tick() override void Tick()
{ {
Super.Tick(); Super.Tick();
if ( globalfreeze || level.frozen ) return; if ( isFrozen() ) return;
alpha -= 1./ReactionTime; alpha -= 1./ReactionTime;
} }
States States
@ -295,7 +295,7 @@ Class ShockBeam : Actor
override void Tick() override void Tick()
{ {
Super.Tick(); Super.Tick();
if ( globalfreeze || level.frozen ) return; if ( isFrozen() ) return;
if ( !moving ) return; if ( !moving ) return;
// step trace // step trace
tracedir = (cos(angle)*cos(pitch),sin(angle)*cos(pitch),-sin(pitch)); tracedir = (cos(angle)*cos(pitch),sin(angle)*cos(pitch),-sin(pitch));
@ -522,7 +522,7 @@ Class SuperShockBeam : Actor
override void Tick() override void Tick()
{ {
Super.Tick(); Super.Tick();
if ( globalfreeze || level.frozen ) return; if ( isFrozen() ) return;
if ( !moving ) return; if ( !moving ) return;
// step trace // step trace
tracedir = (cos(angle)*cos(pitch),sin(angle)*cos(pitch),-sin(pitch)); tracedir = (cos(angle)*cos(pitch),sin(angle)*cos(pitch),-sin(pitch));
@ -765,7 +765,7 @@ Class ShockExplLight : DynamicLight
override void Tick() override void Tick()
{ {
Super.Tick(); Super.Tick();
if ( globalfreeze || level.frozen ) return; if ( isFrozen() ) return;
args[LIGHT_RED] = int(160*lifetime); args[LIGHT_RED] = int(160*lifetime);
args[LIGHT_GREEN] = int(128*lifetime); args[LIGHT_GREEN] = int(128*lifetime);
args[LIGHT_BLUE] = int(255*lifetime); args[LIGHT_BLUE] = int(255*lifetime);
@ -791,7 +791,7 @@ Class SuperShockExplLight : DynamicLight
override void Tick() override void Tick()
{ {
Super.Tick(); Super.Tick();
if ( globalfreeze || level.frozen ) return; if ( isFrozen() ) return;
args[LIGHT_RED] = int(255*lifetime); args[LIGHT_RED] = int(255*lifetime);
args[LIGHT_GREEN] = int(160*lifetime); args[LIGHT_GREEN] = int(160*lifetime);
args[LIGHT_BLUE] = int(128*lifetime); args[LIGHT_BLUE] = int(128*lifetime);
@ -982,7 +982,7 @@ Class ViewShockSpark : ShockSpark
Vector3 origin = x*ofs.x+y*ofs.y+z*ofs.z+(0,0,target.player.viewz); Vector3 origin = x*ofs.x+y*ofs.y+z*ofs.z+(0,0,target.player.viewz);
SetOrigin(target.Vec2OffsetZ(origin.x,origin.y,origin.z),true); SetOrigin(target.Vec2OffsetZ(origin.x,origin.y,origin.z),true);
bInvisible = (players[consoleplayer].camera != target); bInvisible = (players[consoleplayer].camera != target);
if ( level.frozen || globalfreeze ) return; if ( isFrozen() ) return;
ofs += vvel; ofs += vvel;
vvel *= 0.9; vvel *= 0.9;
scale *= 0.8; scale *= 0.8;

View file

@ -213,7 +213,7 @@ Class UTPlayer : DoomPlayer
} }
if ( !footsteps ) footsteps = CVar.GetCVar('flak_footsteps',players[consoleplayer]); if ( !footsteps ) footsteps = CVar.GetCVar('flak_footsteps',players[consoleplayer]);
if ( !footsteps.GetBool() ) return; if ( !footsteps.GetBool() ) return;
double ang = level.time/(20*TICRATE/35.)*360.; double ang = level.maptime/(20*TICRATE/35.)*360.;
bool forcefootstep = false; bool forcefootstep = false;
if ( player.onground && !bNoGravity && !lastground && (waterlevel < 2) ) if ( player.onground && !bNoGravity && !lastground && (waterlevel < 2) )
{ {
@ -899,7 +899,7 @@ Class UTViewSpark : UTSpark
Vector3 origin = x*ofs.x+y*ofs.y+z*ofs.z+(0,0,target.player.viewz); Vector3 origin = x*ofs.x+y*ofs.y+z*ofs.z+(0,0,target.player.viewz);
SetOrigin(target.Vec2OffsetZ(origin.x,origin.y,origin.z),true); SetOrigin(target.Vec2OffsetZ(origin.x,origin.y,origin.z),true);
bInvisible = (players[consoleplayer].camera != target); bInvisible = (players[consoleplayer].camera != target);
if ( level.frozen || globalfreeze ) return; if ( isFrozen() ) return;
ofs += vvel; ofs += vvel;
vvel.z -= 0.1; vvel.z -= 0.1;
scale *= 0.8; scale *= 0.8;
@ -941,7 +941,7 @@ Class UTChip : Actor
override void Tick() override void Tick()
{ {
Super.Tick(); Super.Tick();
if ( level.frozen || globalfreeze ) return; if ( isFrozen() ) return;
if ( InStateSequence(CurState,ResolveState("Death")) ) if ( InStateSequence(CurState,ResolveState("Death")) )
{ {
deadtimer++; deadtimer++;
@ -1004,7 +1004,7 @@ Class UTBubble : Actor
override void Tick() override void Tick()
{ {
Super.Tick(); Super.Tick();
if ( level.frozen || globalfreeze ) return; if ( isFrozen() ) return;
vel *= 0.96; vel *= 0.96;
vel.z += 0.05; vel.z += 0.05;
if ( (waterlevel <= 0) || !Random[Puff](0,100) ) Destroy(); if ( (waterlevel <= 0) || !Random[Puff](0,100) ) Destroy();
@ -1052,7 +1052,7 @@ Class UTSmoke : Actor
override void Tick() override void Tick()
{ {
Super.Tick(); Super.Tick();
if ( level.frozen || globalfreeze ) return; if ( isFrozen() ) return;
vel *= 0.96; vel *= 0.96;
vel.z += 0.01; vel.z += 0.01;
A_FadeOut(1/32.); A_FadeOut(1/32.);
@ -1144,7 +1144,7 @@ Class UTViewSmoke : UTSmoke
Vector3 origin = x*ofs.x+y*ofs.y+z*ofs.z+(0,0,target.player.viewz); Vector3 origin = x*ofs.x+y*ofs.y+z*ofs.z+(0,0,target.player.viewz);
SetOrigin(target.Vec2OffsetZ(origin.x,origin.y,origin.z),true); SetOrigin(target.Vec2OffsetZ(origin.x,origin.y,origin.z),true);
bInvisible = (players[consoleplayer].camera != target); bInvisible = (players[consoleplayer].camera != target);
if ( level.frozen || globalfreeze ) return; if ( isFrozen() ) return;
ofs += vvel; ofs += vvel;
vvel *= 0.96; vvel *= 0.96;
vvel.z += 0.01; vvel.z += 0.01;
@ -1516,7 +1516,7 @@ Class UTMainHandler : StaticEventHandler
private Actor AddLight( Vector3 pos, Color col, int radius ) private Actor AddLight( Vector3 pos, Color col, int radius )
{ {
Actor l = Actor.Spawn("PointLightAttenuated",pos); Actor l = currentSession.levelinfo[0].Spawn("PointLightAttenuated",pos);
if ( !l ) return null; if ( !l ) return null;
l.args[0] = col.r; l.args[0] = col.r;
l.args[1] = col.g; l.args[1] = col.g;
@ -1527,7 +1527,7 @@ Class UTMainHandler : StaticEventHandler
private Actor AddAmbient( Vector3 pos, String snd, double volume = 1., double attenuation = ATTN_NORM ) private Actor AddAmbient( Vector3 pos, String snd, double volume = 1., double attenuation = ATTN_NORM )
{ {
Actor a = Actor.Spawn("MapSpot",pos); Actor a = currentSession.levelinfo[0].Spawn("MapSpot",pos);
if ( !a ) return null; if ( !a ) return null;
a.A_PlaySound(snd,CHAN_BODY,volume,true,attenuation); a.A_PlaySound(snd,CHAN_BODY,volume,true,attenuation);
return a; return a;
@ -1537,6 +1537,7 @@ Class UTMainHandler : StaticEventHandler
{ {
if ( gamestate != GS_LEVEL || e.IsSaveGame ) return; if ( gamestate != GS_LEVEL || e.IsSaveGame ) return;
// prettify Kinsie's test map for a more Unreal feel // prettify Kinsie's test map for a more Unreal feel
let level = currentSession.levelinfo[0];
if ( level.GetChecksum() ~== "FBC3B6622A8B74AE06DE01E70007AC33" ) if ( level.GetChecksum() ~== "FBC3B6622A8B74AE06DE01E70007AC33" )
{ {
TextureID deftex = TexMan.CheckForTexture("-noflat-",TexMan.Type_Any); TextureID deftex = TexMan.CheckForTexture("-noflat-",TexMan.Type_Any);
@ -1735,7 +1736,7 @@ Class UTMainHandler : StaticEventHandler
return; return;
} }
// generic gibbing // generic gibbing
let a = Actor.Spawn("UTGibber",e.Thing.pos); let a = e.Thing.level.Spawn("UTGibber",e.Thing.pos);
a.vel = e.Thing.vel; a.vel = e.Thing.vel;
a.Scale = e.Thing.Scale; a.Scale = e.Thing.Scale;
a.Translation = e.Thing.BloodTranslation; a.Translation = e.Thing.BloodTranslation;
@ -1750,7 +1751,7 @@ Class UTMainHandler : StaticEventHandler
} }
// attach damage accumulator for corpses // attach damage accumulator for corpses
if ( !flak_corpsedamage ) return; if ( !flak_corpsedamage ) return;
let a = Actor.Spawn("ShredCorpseHitbox",e.Thing.pos); let a = e.Thing.level.Spawn("ShredCorpseHitbox",e.Thing.pos);
a.target = e.Thing; a.target = e.Thing;
} }
@ -1775,7 +1776,7 @@ Class UTMainHandler : StaticEventHandler
if ( !a || !a.bSHOOTABLE || !Source.CheckSight(a,0xf) || (a == Source) || (Source.Distance3D(a) > ExplosionRadius) ) if ( !a || !a.bSHOOTABLE || !Source.CheckSight(a,0xf) || (a == Source) || (Source.Distance3D(a) > ExplosionRadius) )
continue; continue;
Vector3 midpoint = a.Vec3Offset(0,0,a.height*0.5); Vector3 midpoint = a.Vec3Offset(0,0,a.height*0.5);
a.vel += Level.Vec3Diff(Source.pos,midpoint).unit()*(MomentumTransfer/(Thinker.TICRATE*a.mass)); a.vel += Source.level.Vec3Diff(Source.pos,midpoint).unit()*(MomentumTransfer/(Thinker.TICRATE*a.mass));
} }
} }
@ -1789,7 +1790,7 @@ Class UTMainHandler : StaticEventHandler
static void DoSwing( Actor target, Vector2 dir, double initial, double inc, int steps, int mode = 0, int delay = 0, double rmul = 1.0 ) static void DoSwing( Actor target, Vector2 dir, double initial, double inc, int steps, int mode = 0, int delay = 0, double rmul = 1.0 )
{ {
if ( !flak_swingers ) return; if ( !flak_swingers ) return;
let s = new("Swinger"); let s = new("Swinger"); // this looks unsafe, shouldn't there be a way to create thinkers in specifc level?
s.ChangeStatNum(Thinker.STAT_USER); s.ChangeStatNum(Thinker.STAT_USER);
s.target = target; s.target = target;
s.dir = dir; s.dir = dir;

View file

@ -151,7 +151,7 @@ Class UTBloodTrail : Actor
override void Tick() override void Tick()
{ {
Super.Tick(); Super.Tick();
if ( level.frozen || globalfreeze ) return; if ( isFrozen() ) return;
if ( !target ) return; if ( !target ) return;
SetOrigin(target.pos,true); SetOrigin(target.pos,true);
double ang, pt; double ang, pt;

View file

@ -42,9 +42,6 @@ Class UTHud : BaseStatusBar
double CurX, CurY; double CurX, CurY;
double FracTic; double FracTic;
// Ugh...
const TINTSTYLE = (1|2<<8|1<<16|12<<24);
override void Init() override void Init()
{ {
Super.Init(); Super.Init();
@ -211,7 +208,7 @@ Class UTHud : BaseStatusBar
if ( opacity == -1 ) opacity = self.opacity; if ( opacity == -1 ) opacity = self.opacity;
if ( opacity >= 16 ) Screen.DrawTexture(tx,false,dx,dy,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_FillColor,bgcolor); if ( opacity >= 16 ) Screen.DrawTexture(tx,false,dx,dy,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_FillColor,bgcolor);
double alpha = clamp(opacity/15.,0.0,1.0); double alpha = clamp(opacity/15.,0.0,1.0);
Screen.DrawTexture(tx,false,dx,dy,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_Alpha,alpha,DTA_RenderStyle,TINTSTYLE,DTA_FillColor,(tint!="Black")?tint:tintcolor); Screen.DrawTexture(tx,false,dx,dy,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_Alpha,alpha,DTA_LegacyRenderStyle,STYLE_AddShaded,DTA_FillColor,(tint!="Black")?tint:tintcolor);
} }
private void UTDrawPlainTex( TextureID tx, double sx = 1.0, int opacity = -1 ) private void UTDrawPlainTex( TextureID tx, double sx = 1.0, int opacity = -1 )
{ {
@ -264,13 +261,13 @@ Class UTHud : BaseStatusBar
if ( value < 0 ) if ( value < 0 )
{ {
if ( opacity+7 > 15 ) Screen.DrawTexture(BigNum[11],false,CurX/ss,CurY/ss,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_FillColor,bgcolor); if ( opacity+7 > 15 ) Screen.DrawTexture(BigNum[11],false,CurX/ss,CurY/ss,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_FillColor,bgcolor);
Screen.DrawTexture(BigNum[11],false,CurX/ss,CurY/ss,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_Alpha,alpha,DTA_RenderStyle,TINTSTYLE,DTA_FillColor,DrawColor); Screen.DrawTexture(BigNum[11],false,CurX/ss,CurY/ss,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_Alpha,alpha,DTA_LegacyRenderStyle,STYLE_AddShaded,DTA_FillColor,DrawColor);
CurX += step; CurX += step;
} }
for ( int i=0; i<digits.length(); i++ ) for ( int i=0; i<digits.length(); i++ )
{ {
if ( opacity+7 > 15 ) Screen.DrawTexture(BigNum[digits.CharCodeAt(i)-0x30],false,CurX/ss,CurY/ss,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_FillColor,bgcolor); if ( opacity+7 > 15 ) Screen.DrawTexture(BigNum[digits.CharCodeAt(i)-0x30],false,CurX/ss,CurY/ss,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_FillColor,bgcolor);
Screen.DrawTexture(BigNum[digits.CharCodeAt(i)-0x30],false,CurX/ss,CurY/ss,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_Alpha,alpha,DTA_RenderStyle,TINTSTYLE,DTA_FillColor,DrawColor); Screen.DrawTexture(BigNum[digits.CharCodeAt(i)-0x30],false,CurX/ss,CurY/ss,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_Alpha,alpha,DTA_LegacyRenderStyle,STYLE_AddShaded,DTA_FillColor,DrawColor);
CurX += ((i<digits.length()-1)&&(digits.CharAt(i+1)=="1"))?step*0.5:step; CurX += ((i<digits.length()-1)&&(digits.CharAt(i+1)=="1"))?step*0.5:step;
} }
} }
@ -404,7 +401,7 @@ Class UTHud : BaseStatusBar
if ( CPlayer.mo.Health < CPlayer.mo.SpawnHealth()/2 ) if ( CPlayer.mo.Health < CPlayer.mo.SpawnHealth()/2 )
{ {
Color blinkcolor; Color blinkcolor;
double blinky = ((level.time+fractic)/Thinker.TICRATE)*1.5; double blinky = ((currentsession.time+fractic)/Thinker.TICRATE)*1.5;
blinky = blinky-floor(blinky); blinky = blinky-floor(blinky);
blinkcolor = LerpColor(tintcolor,WhiteColor,blinky); blinkcolor = LerpColor(tintcolor,WhiteColor,blinky);
UTDrawTintedTex(Boxes[2],hudsize,-1,blinkcolor); UTDrawTintedTex(Boxes[2],hudsize,-1,blinkcolor);
@ -520,7 +517,7 @@ Class UTHud : BaseStatusBar
CurY = Screen.GetHeight()-64*hudsize*HScale; CurY = Screen.GetHeight()-64*hudsize*HScale;
if ( showweapons && ((weaponsize*hudsize)>=1.0) ) CurY -= 64*hudsize*HScale; if ( showweapons && ((weaponsize*hudsize)>=1.0) ) CurY -= 64*hudsize*HScale;
DrawColor = tintcolor; DrawColor = tintcolor;
double whiten = ((level.time+fractic)-lastfrag)/Thinker.TICRATE; double whiten = ((currentsession.time+fractic)-lastfrag)/Thinker.TICRATE;
if ( whiten < 3.0 ) if ( whiten < 3.0 )
{ {
if ( tintcolor == GoldColor ) if ( tintcolor == GoldColor )
@ -542,7 +539,7 @@ Class UTHud : BaseStatusBar
} }
private void DrawIdentifyInfo() private void DrawIdentifyInfo()
{ {
double lalpha = 2.0-((level.time+fractic)-lastseentic)/Thinker.TICRATE; double lalpha = 2.0-((currentsession.time+fractic)-lastseentic)/Thinker.TICRATE;
if ( !lastseen || (lalpha <= 0) ) return; if ( !lastseen || (lalpha <= 0) ) return;
String cl1 = "Teal", cl2 = "Cyan"; String cl1 = "Teal", cl2 = "Cyan";
if ( deathmatch && (lastseen.player.GetTeam() < teams.size()) ) if ( deathmatch && (lastseen.player.GetTeam() < teams.size()) )
@ -616,19 +613,19 @@ Class UTHud : BaseStatusBar
Super.Tick(); Super.Tick();
if ( deathmatch||teamplay ) if ( deathmatch||teamplay )
{ {
if ( CPlayer.fragcount != lastfragcnt ) lastfrag = level.time; if ( CPlayer.fragcount != lastfragcnt ) lastfrag = currentsession.time;
lastfragcnt = CPlayer.fragcount; lastfragcnt = CPlayer.fragcount;
} }
else else
{ {
if ( CPlayer.killcount != lastfragcnt ) lastfrag = level.time; if ( CPlayer.killcount != lastfragcnt ) lastfrag = currentsession.time;
lastfragcnt = CPlayer.killcount; lastfragcnt = CPlayer.killcount;
} }
vtracer.ignore = CPlayer.mo; vtracer.ignore = CPlayer.mo;
vtracer.trace(CPlayer.mo.Vec2OffsetZ(0,0,CPlayer.viewz),CPlayer.mo.CurSector,(cos(CPlayer.mo.angle)*cos(CPlayer.mo.pitch),sin(CPlayer.mo.angle)*cos(CPlayer.mo.pitch),-sin(CPlayer.mo.pitch)),1000,0); vtracer.trace(CPlayer.mo.Vec2OffsetZ(0,0,CPlayer.viewz),CPlayer.mo.CurSector,(cos(CPlayer.mo.angle)*cos(CPlayer.mo.pitch),sin(CPlayer.mo.angle)*cos(CPlayer.mo.pitch),-sin(CPlayer.mo.pitch)),1000,0);
if ( vtracer.Results.HitType != TRACE_HitActor ) return; if ( vtracer.Results.HitType != TRACE_HitActor ) return;
lastseen = vtracer.Results.HitActor; lastseen = vtracer.Results.HitActor;
lastseentic = level.time; lastseentic = currentsession.time;
} }
private void DrawUTHUD() private void DrawUTHUD()

View file

@ -48,9 +48,9 @@ Class ShockWave : Actor
override void Tick() override void Tick()
{ {
Super.Tick(); Super.Tick();
if ( globalfreeze || level.frozen ) return; if ( isFrozen() ) return;
if ( alpha <= 0 ) return; if ( alpha <= 0 ) return;
if ( !t ) t = ThinkerIterator.Create("Actor"); if ( !t ) t = level.CreateThinkerIterator("Actor");
icount++; icount++;
if ( icount == 4 ) Spawn("WarheadSubExplosion",pos); if ( icount == 4 ) Spawn("WarheadSubExplosion",pos);
lifespan--; lifespan--;
@ -164,7 +164,7 @@ Class WarheadExplodLight : DynamicLight
override void Tick() override void Tick()
{ {
Super.Tick(); Super.Tick();
if ( globalfreeze || level.frozen ) return; if ( isFrozen() ) return;
args[LIGHT_RED] = int(255*lifetime); args[LIGHT_RED] = int(255*lifetime);
args[LIGHT_GREEN] = int(192*lifetime); args[LIGHT_GREEN] = int(192*lifetime);
args[LIGHT_BLUE] = int(128*lifetime); args[LIGHT_BLUE] = int(128*lifetime);
@ -224,7 +224,7 @@ Class WarheadTrail : Actor
override void Tick() override void Tick()
{ {
Super.Tick(); Super.Tick();
if ( level.frozen || globalfreeze ) return; if ( isFrozen() ) return;
vel *= 0.99; vel *= 0.99;
A_FadeOut(0.1); A_FadeOut(0.1);
} }
@ -275,7 +275,7 @@ Class WarShell : Actor
override void Tick() override void Tick()
{ {
Super.Tick(); Super.Tick();
if ( globalfreeze || level.frozen ) return; if ( isFrozen() ) return;
if ( !bMISSILE ) return; if ( !bMISSILE ) return;
if ( vel.length() > 0 ) if ( vel.length() > 0 )
{ {
@ -375,7 +375,7 @@ Class GuidedWarShell : WarShell
justleft = false; justleft = false;
bHITOWNER = true; bHITOWNER = true;
} }
if ( globalfreeze || level.frozen ) return; if ( isFrozen() ) return;
if ( !bMISSILE ) return; if ( !bMISSILE ) return;
if ( !target || !target.player || (target.Health <= 0) ) if ( !target || !target.player || (target.Health <= 0) )
{ {
@ -482,7 +482,7 @@ Class RedeemerHUD : HUDMessageBase
// shootable targetting // shootable targetting
if ( CVar.GetCVar('flak_redeemerreadout',players[consoleplayer]).GetBool() && !CVar.GetCVar('flak_redeemerreadout_perframe',players[consoleplayer]).GetBool() ) if ( CVar.GetCVar('flak_redeemerreadout',players[consoleplayer]).GetBool() && !CVar.GetCVar('flak_redeemerreadout_perframe',players[consoleplayer]).GetBool() )
{ {
if ( !t ) t = ThinkerIterator.Create("Actor"); if ( !t ) t = camera.level.CreateThinkerIterator("Actor");
if ( !tr ) tr = new("MidTracer"); if ( !tr ) tr = new("MidTracer");
t.Reinit(); t.Reinit();
ta.Clear(); ta.Clear();
@ -490,10 +490,10 @@ Class RedeemerHUD : HUDMessageBase
Vector3 vdir = (cos(ViewAngle)*cos(ViewPitch),sin(ViewAngle)*cos(ViewPitch),-sin(ViewPitch)); Vector3 vdir = (cos(ViewAngle)*cos(ViewPitch),sin(ViewAngle)*cos(ViewPitch),-sin(ViewPitch));
while ( a = Actor(t.Next()) ) while ( a = Actor(t.Next()) )
{ {
Vector3 tdir = Level.Vec3Diff(ViewPos,a.Pos+(0,0,a.Height*0.5)); Vector3 tdir = camera.level.Vec3Diff(ViewPos,a.Pos+(0,0,a.Height*0.5));
if ( !a.bSHOOTABLE || (a.Health <= 0) || ((Camera is 'GuidedWarShell') && (a == GuidedWarShell(Camera).b)) || (tdir.length() > 2000) || (acos(tdir.unit() dot vdir) > players[consoleplayer].FOV) || tr.Trace(ViewPos,Camera.CurSector,tdir.unit(),tdir.length(),0) ) continue; if ( !a.bSHOOTABLE || (a.Health <= 0) || ((Camera is 'GuidedWarShell') && (a == GuidedWarShell(Camera).b)) || (tdir.length() > 2000) || (acos(tdir.unit() dot vdir) > players[consoleplayer].FOV) || tr.Trace(ViewPos,Camera.CurSector,tdir.unit(),tdir.length(),0) ) continue;
Vector3 wpos = ViewPos+tdir; Vector3 wpos = ViewPos+tdir;
Vector3 spos = dt_CoordUtil.WorldToScreen(wpos,ViewPos,ViewPitch,ViewAngle,ViewRoll,players[consoleplayer].FOV); Vector3 spos = dt_CoordUtil.WorldToScreen(camera.level,wpos,ViewPos,ViewPitch,ViewAngle,ViewRoll,players[consoleplayer].FOV);
if ( spos.z > 1.0 ) continue; if ( spos.z > 1.0 ) continue;
TargetActor te = new("TargetActor"); TargetActor te = new("TargetActor");
te.vpos = dt_CoordUtil.ToViewport(spos); te.vpos = dt_CoordUtil.ToViewport(spos);
@ -513,7 +513,7 @@ Class RedeemerHUD : HUDMessageBase
{ {
if ( CVar.GetCVar('flak_redeemerreadout_perframe',players[consoleplayer]).GetBool() ) if ( CVar.GetCVar('flak_redeemerreadout_perframe',players[consoleplayer]).GetBool() )
{ {
if ( !t ) t = ThinkerIterator.Create("Actor"); if ( !t ) t = camera.level.CreateThinkerIterator("Actor");
if ( !tr ) tr = new("MidTracer"); if ( !tr ) tr = new("MidTracer");
t.Reinit(); t.Reinit();
ta.Clear(); ta.Clear();
@ -521,10 +521,10 @@ Class RedeemerHUD : HUDMessageBase
Vector3 vdir = (cos(ViewAngle)*cos(ViewPitch),sin(ViewAngle)*cos(ViewPitch),-sin(ViewPitch)); Vector3 vdir = (cos(ViewAngle)*cos(ViewPitch),sin(ViewAngle)*cos(ViewPitch),-sin(ViewPitch));
while ( a = Actor(t.Next()) ) while ( a = Actor(t.Next()) )
{ {
Vector3 tdir = Level.Vec3Diff(ViewPos,a.Pos+(0,0,a.Height*0.5)); Vector3 tdir = camera.level.Vec3Diff(ViewPos,a.Pos+(0,0,a.Height*0.5));
if ( !a.bSHOOTABLE || (a.Health <= 0) || ((Camera is 'GuidedWarShell') && (a == GuidedWarShell(Camera).b)) || (tdir.length() > 2000) || (acos(tdir.unit() dot vdir) > players[consoleplayer].FOV) || tr.Trace(ViewPos,Camera.CurSector,tdir.unit(),tdir.length(),0) ) continue; if ( !a.bSHOOTABLE || (a.Health <= 0) || ((Camera is 'GuidedWarShell') && (a == GuidedWarShell(Camera).b)) || (tdir.length() > 2000) || (acos(tdir.unit() dot vdir) > players[consoleplayer].FOV) || tr.Trace(ViewPos,Camera.CurSector,tdir.unit(),tdir.length(),0) ) continue;
Vector3 wpos = ViewPos+tdir; Vector3 wpos = ViewPos+tdir;
Vector3 spos = dt_CoordUtil.WorldToScreen(wpos,ViewPos,ViewPitch,ViewAngle,ViewRoll,players[consoleplayer].FOV); Vector3 spos = dt_CoordUtil.WorldToScreen(camera.level,wpos,ViewPos,ViewPitch,ViewAngle,ViewRoll,players[consoleplayer].FOV);
if ( spos.z > 1.0 ) continue; if ( spos.z > 1.0 ) continue;
TargetActor te = new("TargetActor"); TargetActor te = new("TargetActor");
te.vpos = dt_CoordUtil.ToViewport(spos); te.vpos = dt_CoordUtil.ToViewport(spos);