Bump zscript ver to 4.14.1, plus a whole lot of stuff.

- Try to get rid of all implicit casts from string to name, color or class.
 - Use FindClass where needed.
 - Used a map in a case where a dictionary was unneeded.
 - Use new bounce flags where needed.
 - Replace Legacy of Rust weapons/ammo.
This commit is contained in:
Mari the Deer 2025-03-13 14:45:01 +01:00
commit 80db58b0d0
128 changed files with 3074 additions and 3088 deletions

View file

@ -80,7 +80,7 @@ Class EnvmapDebugSphere : Actor
override void Tick() {}
Default
{
RenderStyle "Normal";
RenderStyle 'Normal';
Radius 16;
Height 48;
}

View file

@ -5,7 +5,7 @@ extend class SWWMUtility
static void MarkAchievement( String mvar, PlayerInfo p = null )
{
if ( !p || (p != players[consoleplayer]) ) return;
let hnd = SWWMStaticHandler(StaticEventHandler.Find("SWWMStaticHandler"));
let hnd = SWWMStaticHandler(StaticEventHandler.Find('SWWMStaticHandler'));
if ( !hnd ) return;
String val = hnd.achievementstate.At(mvar);
if ( val == "" )
@ -19,7 +19,7 @@ extend class SWWMUtility
static int GetAchievementProgress( String pvar, PlayerInfo p = null )
{
if ( !p || (p != players[consoleplayer]) ) return 0;
let hnd = SWWMStaticHandler(StaticEventHandler.Find("SWWMStaticHandler"));
let hnd = SWWMStaticHandler(StaticEventHandler.Find('SWWMStaticHandler'));
if ( !hnd ) return 0;
String pval = hnd.achievementprogress.At(pvar);
if ( pval == "" )
@ -32,7 +32,7 @@ extend class SWWMUtility
static void AchievementProgress( String pvar, int val, PlayerInfo p = null )
{
if ( !p || (p != players[consoleplayer]) ) return;
let hnd = SWWMStaticHandler(StaticEventHandler.Find("SWWMStaticHandler"));
let hnd = SWWMStaticHandler(StaticEventHandler.Find('SWWMStaticHandler'));
if ( !hnd ) return;
String pval = hnd.achievementprogress.At(pvar);
if ( pval == "" )
@ -46,7 +46,7 @@ extend class SWWMUtility
static void AchievementProgressInc( String pvar, int inc, PlayerInfo p = null )
{
if ( !p || (p != players[consoleplayer]) ) return;
let hnd = SWWMStaticHandler(StaticEventHandler.Find("SWWMStaticHandler"));
let hnd = SWWMStaticHandler(StaticEventHandler.Find('SWWMStaticHandler'));
if ( !hnd ) return;
String pval = hnd.achievementprogress.At(pvar);
if ( pval == "" )
@ -59,7 +59,7 @@ extend class SWWMUtility
static void AchievementProgressIncDouble( String pvar, double inc, PlayerInfo p = null )
{
if ( !p || (p != players[consoleplayer]) ) return;
let hnd = SWWMStaticHandler(StaticEventHandler.Find("SWWMStaticHandler"));
let hnd = SWWMStaticHandler(StaticEventHandler.Find('SWWMStaticHandler'));
if ( !hnd ) return;
String pval = hnd.achievementprogress.At(pvar);
if ( pval == "" )
@ -75,7 +75,7 @@ extend class SWWMUtility
static void AchievementProgressOr( String pvar, int val, PlayerInfo p = null )
{
if ( !p || (p != players[consoleplayer]) ) return;
let hnd = SWWMStaticHandler(StaticEventHandler.Find("SWWMStaticHandler"));
let hnd = SWWMStaticHandler(StaticEventHandler.Find('SWWMStaticHandler'));
if ( !hnd ) return;
String pval = hnd.achievementprogress.At(pvar);
if ( pval == "" )

View file

@ -49,14 +49,14 @@ extend Class SWWMUtility
// debug, display radius sphere
if ( swwm_debugblast )
{
let s = Actor.Spawn("RadiusDebugSphere",(flags&DE_CENTERHEIGHT)?Source.Vec3Offset(0,0,Source.height/2):Source.pos);
let s = Actor.Spawn('RadiusDebugSphere',(flags&DE_CENTERHEIGHT)?Source.Vec3Offset(0,0,Source.height/2):Source.pos);
s.Scale *= ExplosionRadius;
s.SetShade((Damage>0)?"Green":"Blue");
s.SetShade((Damage>0)?0xFF00FF00:0xFF0000FF);
if ( FullDamageRadius > 0. )
{
let s = Actor.Spawn("RadiusDebugSphere",(flags&DE_CENTERHEIGHT)?Source.Vec3Offset(0,0,Source.height/2):Source.pos);
let s = Actor.Spawn('RadiusDebugSphere',(flags&DE_CENTERHEIGHT)?Source.Vec3Offset(0,0,Source.height/2):Source.pos);
s.Scale *= FullDamageRadius;
s.SetShade("Red");
s.SetShade(0xFFFF0000);
}
}
if ( !(flags&DE_NOSPLASH) ) Source.CheckSplash(ExplosionRadius);
@ -164,7 +164,7 @@ extend Class SWWMUtility
}
if ( (Instigator is 'Demolitionist') && haskilled && !(flags&DE_NONEXPLOSIVE) )
{
let hnd = SWWMHandler(EventHandler.Find("SWWMHandler"));
let hnd = SWWMHandler(EventHandler.Find('SWWMHandler'));
let demo = Demolitionist(Instigator);
if ( hnd && (gametic > demo.lastbang+30) && (gametic > hnd.lastcombat+10) && !Random[DemoLines](0,3) )
demo.lastbang = SWWMHandler.AddOneLiner("blast",2,10);
@ -177,8 +177,8 @@ Class RadiusDebugSphere : SWWMNonInteractiveActor
{
Default
{
RenderStyle "AddStencil";
StencilColor "White";
RenderStyle 'AddStencil';
StencilColor "FF FF FF";
}
States
{

View file

@ -65,25 +65,13 @@ extend Class SWWMUtility
// detect eviternity (naive method)
static bool IsEviternity()
{
foreach ( cls:AllActorClasses )
{
if ( cls.GetClassName() != "Archangelus" )
continue;
return true;
}
return false;
return FindClass('Archangelus','Actor');
}
// detect eviternity 2 (naive method)
static bool IsEviternityTwo()
{
foreach ( cls:AllActorClasses )
{
if ( cls.GetClassName() != "The_Origin_Phase_1" )
continue;
return true;
}
return false;
return FindClass('The_Origin_Phase_1','Actor');
}
// detect doom vacation
@ -93,12 +81,7 @@ extend Class SWWMUtility
if ( Wads.FindLump("VACABEX") != -1 )
{
// just to make sure
foreach ( cls:AllActorClasses )
{
if ( cls.GetClassName() != "Babe" )
continue;
return true;
}
return FindClass('Babe','Actor');
}
return false;
}
@ -147,7 +130,7 @@ extend Class SWWMUtility
let ai = Level.CreateActorIterator(tid);
foreach ( a:ai )
{
let bb = a.Spawn("BossBrain",a.pos,NO_REPLACE);
let bb = a.Spawn('BossBrain',a.pos,NO_REPLACE);
bb.angle = a.angle;
}
}

View file

@ -167,7 +167,7 @@ extend Class SWWMUtility
}
}
// moderate: see if it's a busted crusher, we need to be able to break those in case they cause a softlock
let ti = ThinkerIterator.Create("SWWMCrusherBroken",Thinker.STAT_USER);
let ti = ThinkerIterator.Create('SWWMCrusherBroken',Thinker.STAT_USER);
SWWMCrusherBroken cb;
while ( cb = SWWMCrusherBroken(ti.Next()) )
{
@ -222,7 +222,7 @@ extend Class SWWMUtility
return true;
}
}
ti = ThinkerIterator.Create("Actor");
ti = ThinkerIterator.Create('Actor');
Actor a;
while ( a = Actor(ti.Next()) )
{
@ -442,8 +442,7 @@ extend Class SWWMUtility
}
// gets the hit normal vector for projectiles and hitscan
// bNoBounce: actor didn't just bounce, meaning the fallback normal shouldn't be the inverse of velocity
static Vector3 GetActorHitNormal( Actor a, bool bNoBounce = false )
static Vector3 GetActorHitNormal( Actor a )
{
Vector3 HitNormal = (0,0,0);
F3DFloor ff;
@ -496,7 +495,36 @@ extend Class SWWMUtility
else
{
double len = a.vel.length();
if ( len > 0. ) HitNormal = bNoBounce?(-a.vel/len):(a.vel/len);
if ( len > 0. ) HitNormal = -a.vel/len;
}
return HitNormal;
}
static Vector3 GetActorBounceHitNormal( Actor a, Actor bounceMobj, Line bounceLine, readonly<SecPlane> bouncePlane, bool is3DFloor )
{
Vector3 HitNormal = (0,0,0);
if ( bounceMobj )
{
Vector3 diff = level.Vec3Diff(bounceMobj.pos,a.pos);
if ( diff.x >= bounceMobj.radius ) HitNormal += (1,0,0);
else if ( diff.x <= -bounceMobj.radius ) HitNormal += (-1,0,0);
if ( diff.y >= bounceMobj.radius ) HitNormal += (0,1,0);
else if ( diff.y <= -bounceMobj.radius ) HitNormal += (0,-1,0);
if ( diff.z >= bounceMobj.height ) HitNormal += (0,0,1);
else if ( diff.z <= 0. ) HitNormal += (0,0,-1);
double len = HitNormal.length();
if ( len < double.epsilon ) HitNormal = Vec3FromAngles(FRandom[ExploS](0,360),FRandom[ExploS](-90,90));
else HitNormal /= len;
}
else if ( bouncePlane )
{
if ( is3DFloor ) HitNormal = -bouncePlane.Normal;
else HitNormal = bouncePlane.Normal;
}
else if ( bounceLine )
{
HitNormal = (-bounceLine.delta.y,bounceLine.delta.x,0).unit();
if ( !Level.PointOnLineSide(a.pos.xy,bounceLine) )
HitNormal *= -1;
}
return HitNormal;
}