Additional microoptimizations.

This commit is contained in:
Mari the Deer 2020-06-27 21:23:24 +02:00
commit 07c2cd25db
38 changed files with 49 additions and 99 deletions

View file

@ -1,2 +1,2 @@
[default]
SWWM_MODVER="\chSWWM \cwGZ\c- r402 (Sat 27 Jun 19:19:54 CEST 2020)";
SWWM_MODVER="\chSWWM \cwGZ\c- r403 (Sat 27 Jun 21:23:24 CEST 2020)";

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 249 B

After

Width:  |  Height:  |  Size: 401 B

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 263 B

After

Width:  |  Height:  |  Size: 427 B

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 274 B

After

Width:  |  Height:  |  Size: 449 B

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 296 B

After

Width:  |  Height:  |  Size: 483 B

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 319 B

After

Width:  |  Height:  |  Size: 509 B

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 337 B

After

Width:  |  Height:  |  Size: 541 B

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 360 B

After

Width:  |  Height:  |  Size: 575 B

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 376 B

After

Width:  |  Height:  |  Size: 575 B

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 383 B

After

Width:  |  Height:  |  Size: 563 B

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 385 B

After

Width:  |  Height:  |  Size: 529 B

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 397 B

After

Width:  |  Height:  |  Size: 501 B

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 389 B

After

Width:  |  Height:  |  Size: 463 B

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 380 B

After

Width:  |  Height:  |  Size: 422 B

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 359 B

After

Width:  |  Height:  |  Size: 380 B

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 350 B

After

Width:  |  Height:  |  Size: 358 B

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 388 B

After

Width:  |  Height:  |  Size: 314 B

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 323 B

After

Width:  |  Height:  |  Size: 283 B

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 248 B

After

Width:  |  Height:  |  Size: 243 B

Before After
Before After

View file

@ -213,7 +213,7 @@ Class HellblazerMissile : Actor
Vector3 traildir = -(cos(angle)*cos(pitch),sin(angle)*cos(pitch),sin(-pitch));
for ( int i=0; i<3; i++ )
{
let s = Spawn("SWWMSmoke",level.Vec3Offset(pos,traildir*3));
let s = Spawn("SWWMHalfSmoke",level.Vec3Offset(pos,traildir*3));
s.SetShade(smokecol*Random[Hellblazer](48,63));
s.scale *= FRandom[Hellblazer](.8,1.2);
s.special1 = Random[Hellblazer](0,2);
@ -759,7 +759,7 @@ Class HellblazerClusterMini : HellblazerMissile2
Vector3 traildir = -(cos(angle)*cos(pitch),sin(angle)*cos(pitch),sin(-pitch));
for ( int i=0; i<2; i++ )
{
let s = Spawn("SWWMSmoke",level.Vec3Offset(pos,traildir*3));
let s = Spawn("SWWMHalfSmoke",level.Vec3Offset(pos,traildir*3));
s.SetShade(smokecol*Random[Hellblazer](48,63));
s.scale *= FRandom[Hellblazer](.6,.8);
s.special1 = Random[Hellblazer](0,1);
@ -1045,7 +1045,7 @@ Class HellblazerRavagerArm : Actor
Vector3 pvel = (FRandom[ExploS](-1,1),FRandom[ExploS](-1,1),FRandom[ExploS](-1,1)).unit()*FRandom[ExploS](1,5);
if ( !(ReactionTime%2) )
{
let s = Spawn("SWWMSmoke",pos);
let s = Spawn("SWWMHalfSmoke",pos);
s.vel = pvel+vel*.2;
s.SetShade(Color(4,2,2)*Random[ExploS](48,63));
s.special1 = Random[ExploS](2,4);
@ -1124,7 +1124,7 @@ Class HellblazerWarheadArm : Actor
SWWMHandler.DoBlast(self,30+2*reactiontime,3000+500*reactiontime);
A_Explode(10+reactiontime*4,120+4*reactiontime);
Vector3 pvel = (FRandom[ExploS](-1,1),FRandom[ExploS](-1,1),FRandom[ExploS](-1,1)).unit()*FRandom[ExploS](1,5);
let s = Spawn("SWWMSmoke",pos);
let s = Spawn("SWWMHalfSmoke",pos);
s.vel = pvel+vel*.2;
s.SetShade(Color(4,3,2)*Random[ExploS](48,63));
s.special1 = Random[ExploS](1,3);

View file

@ -199,9 +199,11 @@ Class mkBloodSmoke : Actor
A_FadeOut(.03);
A_SetScale(scale.x*1.02);
if ( tics > 0 ) tics--;
if ( !SetState(CurState.NextState) )
return;
tics = CurState.tics;
while ( !tics )
{
if ( !SetState(CurState.NextState) )
return;
}
}
States
{

View file

@ -1375,7 +1375,6 @@ Class SWWMHalfSmoke : Actor
roll = Frandom[Puff](0,360);
scale.x *= RandomPick[Puff](-1,1);
scale.y *= RandomPick[Puff](-1,1);
tics = 1+special1;
}
override void Tick()
{
@ -1393,20 +1392,22 @@ Class SWWMHalfSmoke : Actor
return;
}
if ( tics > 0 ) tics--;
if ( !SetState(CurState.NextState) )
return;
tics = 1+special1;
while ( !tics )
{
if ( !SetState(CurState.NextState) )
return;
}
}
States
{
Spawn:
XSMK ABCDEFGHIJKLMNOPQRST 1;
XSMK ABCDEFGHIJKLMNOPQRST 1 A_SetTics(1+special1);
Stop;
}
}
Class SWWMSmallSmoke : SWWMSmoke
Class SWWMSmallSmoke : SWWMHalfSmoke
{
override void PostBeginPlay()
{
@ -1417,8 +1418,19 @@ Class SWWMSmallSmoke : SWWMSmoke
ang = FRandom[Puff](0,360);
pt = FRandom[Puff](-90,90);
vel += (cos(pt)*cos(ang),cos(pt)*sin(ang),-sin(pt))*FRandom[Puff](0.04,0.16);
roll = Frandom[Puff](0,360);
scale.x *= RandomPick[Puff](-1,1);
scale.y *= RandomPick[Puff](-1,1);
}
States
{
Spawn:
QSM6 ABCDEFGHIJKLMNOPQR 1 A_SetTics(1+special1);
Stop;
}
}
Class SWWMViewSmoke : SWWMSmoke
{
Vector3 ofs, vvel;

View file

@ -437,7 +437,7 @@ Class EvisceratorProj : Actor
invoker.heat -= 0.004+0.0004*vel.length();
if ( invoker.heat > 0 )
{
let s = Spawn("SWWMSmoke",pos);
let s = Spawn("SWWMHalfSmoke",pos);
s.alpha *= heat;
}
}

View file

@ -168,7 +168,7 @@ Class YnykronImpactArm : Actor
A_CountDown();
Spawn("YnykronImpactTrail",pos);
Vector3 pvel = (FRandom[ExploS](-1,1),FRandom[ExploS](-1,1),FRandom[ExploS](-1,1)).unit()*FRandom[ExploS](1,5);
let s = Spawn("SWWMSmoke",pos);
let s = Spawn("SWWMHalfSmoke",pos);
s.vel = pvel+vel*.2;
s.special1 = Random[ExploS](1,3);
s.scale *= 2.4;
@ -246,16 +246,6 @@ Class YnykronImpact : Actor
s.scale *= 3.;
s.alpha *= .4;
}
if ( bAMBUSH )
{
numpt = Random[ExploS](2,4);
for ( int i=0; i<numpt; i++ )
{
Vector3 pvel = (FRandom[ExploS](-1,1),FRandom[ExploS](-1,1),FRandom[ExploS](-1,1)).unit()*FRandom[ExploS](2,24);
let s = Spawn("SWWMChip",pos);
s.vel = pvel;
}
}
Spawn("YnykronImpactLight",pos);
Spawn("YnykronImpactRing",pos);
numpt = Random[ExploS](0,2);
@ -371,49 +361,6 @@ Class YnykronTracer : LineTracer
}
}
Class YnykronBeamTrail : Actor
{
override void PostBeginPlay()
{
Super.PostBeginPlay();
roll = FRandom[Ynykron](0,360);
SetState(FindState("Spawn")+Random[Ynykron](0,8));
}
override void Tick()
{
if ( isFrozen() ) return;
A_FadeOut(FRandom[Ynykron](.0005,.001));
if ( !CheckNoDelay() || (tics == -1) ) return;
if ( tics > 0 ) tics--;
while ( !tics )
{
if ( !SetState(CurState.NextState) )
return;
}
}
Default
{
RenderStyle "Add";
Radius 0.1;
Height 0;
Alpha .1;
+NOGRAVITY;
+NOBLOCKMAP;
+NOTELEPORT;
+DONTSPLASH;
+FORCEXYBILLBOARD;
+ROLLSPRITE;
+ROLLCENTER;
+NOINTERACTION;
}
States
{
Spawn:
MOTR ABCDEFGHI -1 Bright;
Stop;
}
}
Class YnykronBeam : Actor
{
void SpreadOut()
@ -439,12 +386,12 @@ Class YnykronBeam : Actor
}
for ( int i=0; i<t.Results.Distance; i+=32 )
{
if ( Random[Ynykron](0,8) ) continue;
let b = Spawn("SWWMSmoke",level.Vec3Offset(pos,x*i));
b.Scale *= FRandom[Ynykron](1.6,1.8);
if ( Random[Ynykron](0,10) ) continue;
let b = Spawn("SWWMHalfSmoke",level.Vec3Offset(pos,x*i));
b.Scale *= FRandom[Ynykron](1.6,2.8);
b.special1 = Random[Ynykron](3,10);
b.A_SetRenderStyle(.3,STYLE_AddShaded);
b.vel += x*FRandom[Ynykron](.1,.5);
b.vel += x*FRandom[Ynykron](-.2,.4);
}
for ( int i=0; i<t.HitList.Size(); i++ )
{
@ -501,7 +448,6 @@ Class YnykronBeam : Actor
b.angle = atan2(norm.y,norm.x);
b.pitch = asin(-norm.z);
b.A_SprayDecal("YnykronBlast",-172);
b.bAMBUSH = true;
if ( YnykronShot(master) ) YnykronShot(master).blastcount++;
// find exit point
int maxdist = (25600-special1);
@ -522,7 +468,7 @@ Class YnykronBeam : Actor
}
return;
}
if ( ((special1%256) < 128) && !Random[Ynykron](0,3) )
if ( ((special1%256) < 128) && !Random[Ynykron](0,5) )
Spawn("YnykronBeamLight",level.Vec3Offset(pos,x*64));
if ( special1 >= 25600 )
{
@ -531,7 +477,7 @@ Class YnykronBeam : Actor
for ( int i=0; i<numpt; i++ )
{
let b = Spawn("SWWMSmoke",level.Vec3Offset(pos,x*128));
b.Scale *= FRandom[Ynykron](.6,.8);
b.Scale *= FRandom[Ynykron](.6,1.8);
b.special1 = Random[Ynykron](1,2);
b.A_SetRenderStyle(.3,STYLE_AddShaded);
b.SetShade(Color(255,255,255));
@ -553,15 +499,6 @@ Class YnykronBeam : Actor
{
if ( YnykronShot(master) )
YnykronShot(master).beamcount++;
// sprite trail
Vector3 x, y, z;
[x, y, z] = swwm_CoordUtil.GetAxes(pitch,angle,roll);
for ( int i=0; i<128; i+=8 )
{
if ( Random[Ynykron](0,3) ) return;
let t = Spawn("YnykronBeamTrail",level.Vec3Offset(pos,x*i));
t.Scale *= .15+.0005*(special1+i);
}
}
override void Tick()
{
@ -689,7 +626,6 @@ Class DelayedWallBeam : Actor
b.angle = atan2(x.y,x.x);
b.pitch = asin(-x.z);
b.A_SprayDecal("YnykronBlast",-172);
b.bAMBUSH = true;
if ( YnykronShot(master) )
YnykronShot(master).blastcount++;
// trace back to get the proper "exit surface" so we can trigger lines if needed
@ -797,7 +733,7 @@ Class YnykronShot : Actor
b.pitch = asin(-dir.z);
b.roll = FRandom[Ynykron](0,360);
}
rings += 4;
rings += 3;
}
Spawn("YnykronShotLight",level.Vec3Offset(pos,x*30));
}
@ -947,11 +883,11 @@ Class Ynykron : SWWMWeapon
Vector3 x, y, z, origin;
[x, y, z] = swwm_CoordUtil.GetAxes(pitch,angle,roll);
origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),-x*15+y*4);
int numpt = Random[Ynykron](40,80);
int numpt = Random[Ynykron](10,20);
for ( int i=0; i<numpt; i++ )
{
let s = Spawn("SWWMSmoke",origin);
s.scale *= 2.4;
s.scale *= 3.;
s.alpha *= .4*invoker.specialf1;
s.special1 = Random[Ynykron](2,8);
s.vel += x*FRandom[Ynykron](-40.,-4.)*invoker.specialf1+y*FRandom[Ynykron](-1.,1.)+z*FRandom[Ynykron](-1.,1.);

View file

@ -650,14 +650,14 @@ Class ParriedBuff : Inventory
Actor s;
if ( special1&1 )
{
s = Spawn("SWWMSmoke",Owner.pos);
s = Spawn("SWWMHalfSmoke",Owner.pos);
s.vel = Owner.vel*.3+(FRandom[Ponch](-1,1),FRandom[Ponch](-1,1),FRandom[Ponch](-1,1)).unit()*FRandom[Ponch](.1,.6);
s.scale *= 1.2;
s.alpha *= .3;
}
if ( special1 > 1 )
{
s = Spawn("SWWMSmoke",Owner.pos);
s = Spawn("SWWMHalfSmoke",Owner.pos);
s.vel = Owner.vel*.3+(FRandom[Ponch](-1,1),FRandom[Ponch](-1,1),FRandom[Ponch](-1,1)).unit()*FRandom[Ponch](.1,1.2);
s.scale *= 2.;
s.A_SetRenderStyle(s.alpha,STYLE_AddShaded);

View file

@ -464,7 +464,7 @@ Class DragonBreathArm : Actor
Vector3 pvel = (FRandom[ExploS](-1,1),FRandom[ExploS](-1,1),FRandom[ExploS](-1,1)).unit()*FRandom[ExploS](1,5);
if ( !(ReactionTime%2) )
{
let s = Spawn("SWWMSmoke",pos);
let s = Spawn("SWWMHalfSmoke",pos);
s.vel = pvel+vel*.2;
s.SetShade(Color(1,1,1)*Random[ExploS](96,192));
s.special1 = Random[ExploS](2,4);
@ -673,7 +673,7 @@ Class SaltBeam : Actor
for ( int i=4; i<t.Results.Distance; i+=8 )
{
if ( Random[Spreadgun](0,Stamina) ) continue;
let b = Actor.Spawn("SWWMSmoke",level.Vec3Offset(pos,x*i));
let b = Actor.Spawn("SWWMHalfSmoke",level.Vec3Offset(pos,x*i));
b.Scale *= FRandom[Spreadgun](.6,.8);
b.special1 = Random[Spreadgun](1,2);
b.A_SetRenderStyle(.3,STYLE_AddShaded);
@ -1447,7 +1447,7 @@ Class TheBall : Actor
heat -= 0.004+0.0004*vel.length();
A_SoundVolume(CHAN_WEAPON,vel.length()/75.);
if ( heat <= 0 ) return;
let s = Spawn("SWWMSmoke",pos);
let s = Spawn("SWWMHalfSmoke",pos);
s.alpha *= heat;
}
void A_HandleBounce()

View file

@ -69,7 +69,7 @@ Class ExplodiumMagArm : Actor
SWWMHandler.DoBlast(self,30+2*reactiontime,3000+500*reactiontime);
A_Explode(2+reactiontime/3,30+2*reactiontime);
Vector3 pvel = (FRandom[ExploS](-1,1),FRandom[ExploS](-1,1),FRandom[ExploS](-1,1)).unit()*FRandom[ExploS](1,5);
let s = Spawn("SWWMSmoke",pos);
let s = Spawn("SWWMHalfSmoke",pos);
s.vel = pvel+vel*.2;
s.SetShade(Color(1,1,1)*Random[ExploS](64,224));
s.special1 = Random[ExploS](1,3);

View file

@ -145,7 +145,7 @@ Class CandyBeam : Actor
invoker.nextpos = level.Vec3Offset(t.Results.HitPos,normal);
invoker.nextdir = (dir+cos(a)*y*s+sin(a)*z*s).unit();
}
action void A_Spread( Class<Actor> pop = "CandyPop", Class<Actor> smk = "SWWMSmoke" )
action void A_Spread( Class<Actor> pop = "CandyPop", Class<Actor> smk = "SWWMHalfSmoke" )
{
Vector3 tdir = level.Vec3Diff(pos,invoker.nextpos);
Vector3 pvel = .1*tdir+(FRandom[ExploS](-1,1),FRandom[ExploS](-1,1),FRandom[ExploS](-1,1)).unit()*FRandom[ExploS](.1,.3);
@ -378,7 +378,7 @@ Class CandyMagArm : Actor
vel = (vel*.1+(FRandom[ExploS](-.7,.7),FRandom[ExploS](-.7,.7),FRandom[ExploS](-.7,.7))).unit()*spd;
A_Explode(80+reactiontime*7,50+6*reactiontime);
Vector3 pvel = (FRandom[ExploS](-1,1),FRandom[ExploS](-1,1),FRandom[ExploS](-1,1)).unit()*FRandom[ExploS](1,5);
let s = Spawn("SWWMSmoke",pos);
let s = Spawn("SWWMHalfSmoke",pos);
s.vel = pvel+vel*.2;
s.SetShade(Color(1,1,1)*Random[ExploS](64,224));
s.special1 = Random[ExploS](2,7);
@ -455,7 +455,7 @@ Class CandyMagArmBig : CandyMagArm
vel = (vel*.1+(FRandom[ExploS](-.5,.5),FRandom[ExploS](-.5,.5),FRandom[ExploS](-.5,.5))).unit()*spd;
A_Explode(120+reactiontime*10,100+8*reactiontime);
Vector3 pvel = (FRandom[ExploS](-1,1),FRandom[ExploS](-1,1),FRandom[ExploS](-1,1)).unit()*FRandom[ExploS](1,5);
let s = Spawn("SWWMSmoke",pos);
let s = Spawn("SWWMHalfSmoke",pos);
s.vel = pvel+vel*.2;
s.SetShade(Color(1,1,1)*Random[ExploS](64,224));
s.special1 = Random[ExploS](2,7);

View file

@ -403,7 +403,7 @@ Class SilverBullet : SWWMWeapon
if ( !Random[Boolet](0,1) ) continue;
Vector3 ofs = level.Vec3Offset(origin,dir*i);
if ( !level.IsPointInLevel(ofs) ) continue;
let b = Spawn("SWWMSmoke",ofs);
let b = Spawn("SWWMHalfSmoke",ofs);
b.Scale *= FRandom[Boolet](.9,1.6);
b.alpha *= .5;
b.special1 = Random[Boolet](0,2);