Small refactoring/cleanup.

This commit is contained in:
Mari the Deer 2023-09-24 22:21:57 +02:00
commit 749ccd80b6
7 changed files with 55 additions and 72 deletions

View file

@ -1,3 +1,3 @@
[default]
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r959 \cu(Sun 24 Sep 18:44:16 CEST 2023)\c-";
SWWM_SHORTVER="\cw1.3pre r959 \cu(2023-09-24 18:44:16)\c-";
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r960 \cu(Sun 24 Sep 22:21:57 CEST 2023)\c-";
SWWM_SHORTVER="\cw1.3pre r960 \cu(2023-09-24 22:21:57)\c-";

View file

@ -59,12 +59,12 @@ extend Class SWWMHandler
if ( gametic < hflash[camplayer] )
{
double fstr = (hflash[camplayer]-(gametic+e.FracTic))/5.;
Screen.Dim(Color(64,128,255),.1875*fstr*pickup_fade_scalar,0,0,Screen.GetWidth(),Screen.GetHeight());
Screen.Dim(Color(64,128,255),.1875*fstr*pickup_fade_scalar,0,0,Screen.GetWidth(),Screen.GetHeight(),STYLE_Add);
}
if ( gametic < aflash[camplayer] )
{
double fstr = (aflash[camplayer]-(gametic+e.FracTic))/5.;
Screen.Dim(Color(96,255,64),.1875*fstr*pickup_fade_scalar,0,0,Screen.GetWidth(),Screen.GetHeight());
Screen.Dim(Color(96,255,64),.1875*fstr*pickup_fade_scalar,0,0,Screen.GetWidth(),Screen.GetHeight(),STYLE_Add);
}
}
}

View file

@ -19,64 +19,58 @@ extend Class SWWMHandler
private void IWantDieSpawn( WorldEvent e )
{
if ( iwantdie == -1 ) iwantdie = (G_SkillName() == StringTable.Localize("$SWWM_SKLUNATIC"));
if ( iwantdie )
if ( iwantdie <= 0 ) return;
if ( SWWMUtility.ValidProjectile(e.Thing) && !e.Thing.FindInventory("DontDuplicate") && (e.Thing.target && e.Thing.target.bISMONSTER && !e.Thing.target.player) )
{
if ( SWWMUtility.ValidProjectile(e.Thing) && !e.Thing.FindInventory("DontDuplicate") && (e.Thing.target && e.Thing.target.bISMONSTER && !e.Thing.target.player) )
e.Thing.speed *= 2;
e.Thing.vel *= 2;
double ang = e.Thing.target.target?e.Thing.AngleTo(e.Thing.target.target):e.Thing.angle;
double pt = e.Thing.target.target?e.Thing.PitchTo(e.Thing.target.target,e.Thing.target.missileheight,e.Thing.target.target.Height/2.):e.Thing.pitch;
let [x, y, z] = SWWMUtility.GetAxes(ang,pt,e.Thing.roll);
int numpt = Random[ExtraMissiles](1,2);
for ( int i=0; i<numpt; i++ )
{
e.Thing.speed *= 2;
e.Thing.vel *= 2;
double ang = e.Thing.target.target?e.Thing.AngleTo(e.Thing.target.target):e.Thing.angle;
double pt = e.Thing.target.target?e.Thing.PitchTo(e.Thing.target.target,e.Thing.target.missileheight,e.Thing.target.target.Height/2.):e.Thing.pitch;
let [x, y, z] = SWWMUtility.GetAxes(ang,pt,e.Thing.roll);
int numpt = Random[ExtraMissiles](1,2);
for ( int i=0; i<numpt; i++ )
{
double a = FRandom[ExtraMissiles](0,360);
double s = FRandom[ExtraMissiles](0,.1);
Vector3 dir = SWWMUtility.ConeSpread(x,y,z,a,s);
let p = Actor.Spawn(e.Thing.GetClass(),e.Thing.pos);
p.GiveInventory("DontDuplicate",1);
p.target = e.Thing.target;
p.tracer = e.Thing.tracer;
p.master = e.Thing.master;
p.speed *= FRandom[ExtraMissiles](1.,3.);
p.vel = dir*p.speed;
p.angle = atan2(dir.y,dir.x);
p.pitch = asin(-dir.z);
p.roll = e.Thing.roll;
}
double a = FRandom[ExtraMissiles](0,360);
double s = FRandom[ExtraMissiles](0,.1);
Vector3 dir = SWWMUtility.ConeSpread(x,y,z,a,s);
let p = Actor.Spawn(e.Thing.GetClass(),e.Thing.pos);
p.GiveInventory("DontDuplicate",1);
p.target = e.Thing.target;
p.tracer = e.Thing.tracer;
p.master = e.Thing.master;
p.speed *= FRandom[ExtraMissiles](1.,3.);
p.vel = dir*p.speed;
p.angle = atan2(dir.y,dir.x);
p.pitch = asin(-dir.z);
p.roll = e.Thing.roll;
}
if ( e.Thing.bISMONSTER && !(e.Thing is 'PlayerPawn') )
}
if ( !e.Thing.bISMONSTER || (e.Thing is 'PlayerPawn') ) return;
e.Thing.GiveInventory("GOTTAGOFAST",1);
// avoid if it has some sort of special handling
if ( e.Thing.special || e.Thing.tid || e.Thing.bDORMANT ) return;
// random chance to spawn doubles
if ( e.Thing.FindInventory("DontDuplicate") || Random[ExtraMissiles](0,2) ) return;
int numpt = Random[ExtraMissiles](1,2);
for ( int i=0; i<numpt; i++ )
{
// three attempts for each
for ( int j=0; j<3; j++ )
{
e.Thing.GiveInventory("GOTTAGOFAST",1);
// avoid if it has some sort of special handling
if ( e.Thing.special || e.Thing.tid || e.Thing.bDORMANT ) return;
// random chance to spawn doubles
if ( !e.Thing.FindInventory("DontDuplicate") && !Random[ExtraMissiles](0,2) )
let x = Actor.Spawn(e.Thing.GetClass(),e.Thing.Vec3Angle(e.Thing.Radius*FRandom[ExtraMissiles](1.5,4.),FRandom[ExtraMissiles](0,360)));
if ( x.pos.z+x.height > x.ceilingz ) x.SetZ(x.ceilingz-x.height);
if ( x.pos.z < x.floorz ) x.SetZ(x.floorz);
if ( !x.TestMobjLocation() || !x.TestMobjZ() || !level.IsPointInLevel(x.pos) )
{
int numpt = Random[ExtraMissiles](1,2);
for ( int i=0; i<numpt; i++ )
{
// three attempts for each
for ( int j=0; j<3; j++ )
{
let x = Actor.Spawn(e.Thing.GetClass(),e.Thing.Vec3Angle(e.Thing.Radius*FRandom[ExtraMissiles](1.5,4.),FRandom[ExtraMissiles](0,360)));
if ( x.pos.z+x.height > x.ceilingz ) x.SetZ(x.ceilingz-x.height);
if ( x.pos.z < x.floorz ) x.SetZ(x.floorz);
if ( !x.TestMobjLocation() || !x.TestMobjZ() || !level.IsPointInLevel(x.pos) )
{
x.ClearCounters();
x.Destroy();
}
else
{
x.angle = e.Thing.angle;
x.bAMBUSH = e.Thing.bAMBUSH;
x.GiveInventory("DontDuplicate",1);
break;
}
}
}
x.ClearCounters();
x.Destroy();
}
else
{
x.angle = e.Thing.angle;
x.bAMBUSH = e.Thing.bAMBUSH;
x.GiveInventory("DontDuplicate",1);
break;
}
}
}

View file

@ -310,6 +310,8 @@ extend Class SWWMHandler
continue;
if ( (a is 'Inventory') && (!a.bSPECIAL || Inventory(a).Owner || (a.GetClassName() == 'aas_token')) ) // autoautosave hotfix
continue;
if ( isproj && SWWMUtility.ValidProjectile(a) )
continue;
if ( (a is 'Chancebox') && (a.CurState != a.SpawnState) )
continue;
if ( isproj && !level.allmap && !(a.target && a.target.IsFriend(players[consoleplayer].mo)) && !a.CheckSight(players[consoleplayer].Camera,SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY) )

View file

@ -232,20 +232,7 @@ Class SWWMStaticHandler : StaticEventHandler
override void ConsoleProcess( ConsoleEvent e )
{
if ( e.Name ~== "swwmresetmmcolors" )
{
Array<String> cvarlist;
SWWMUtility.GetCVars(cvarlist);
foreach ( cv:cvarlist )
{
if ( (cv.Left(8) != "swwm_mm_")
|| (cv.IndexOf("color") == -1)
|| (cv == "swwm_mm_colorset") )
continue;
CVar.FindCVar(cv).ResetToDefault();
}
}
else if ( e.Name ~== "swwmresetcvars" )
if ( e.Name ~== "swwmresetcvars" )
{
Array<String> cvarlist;
SWWMUtility.GetCVars(cvarlist);

View file

@ -355,6 +355,7 @@ Class SWWMStatusBar : BaseStatusBar
mhudfontcol[MCR_FLASH] = Font.FindFontColor("MiniFlash");
mhudfontcol[MCR_REDFLASH] = Font.FindFontColor("MiniRedFlash");
mhudfontcol[MCR_WHITEFLASH] = Font.FindFontColor("MiniWhiteFlash");
GetMinimapColors();
tclabel = mhudfontcol[MCR_CYANBLU];
tcvalue = mhudfontcol[MCR_WHITE];
tcextra = mhudfontcol[MCR_IBUKIHUD];

View file

@ -748,7 +748,6 @@ extend Class SWWMStatusBar
// obviously, don't draw the minimap if the automap is open
if ( !automapactive && swwm_mm_enable )
{
GetMinimapColors();
xx = int(ss.x-(margin+(HALFMAPSIZE+2)*2));
Screen.DrawTexture(MiniBox,false,xx,yy,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
DrawMinimap(xx,yy);