4.10 support update (unfinished and untested).

This commit is contained in:
Mari the Deer 2022-12-05 02:10:56 +01:00
commit 8e952f412f
80 changed files with 2343 additions and 2356 deletions

View file

@ -113,9 +113,9 @@ Class AmmoFabricator : Inventory abstract
{
Array<Class<SWWMAmmo> > available;
// populate ammo production list
for ( int i=0; i<AllActorClasses.Size(); i++ )
foreach ( cls:AllActorClasses )
{
let a = (Class<SWWMAmmo>)(AllActorClasses[i]);
let a = (Class<SWWMAmmo>)(cls);
// skip over candy gun spares, they're "special ammo"
if ( a == 'CandyGunSpares' ) continue;
// only direct descendants of swwmammo with a set price below our max unit price
@ -151,11 +151,11 @@ Class AmmoFabricator : Inventory abstract
bool comma = false;
int tpertype = pertype;
int ttotal = maxunits;
for ( int i=0; i<available.Size(); i++ )
foreach ( type:available )
{
int amt, lim;
int cnt = 0;
SWWMAmmo cur = SWWMAmmo(Owner.FindInventory(available[i]));
SWWMAmmo cur = SWWMAmmo(Owner.FindInventory(type));
if ( cur )
{
amt = cur.Amount;
@ -163,7 +163,7 @@ Class AmmoFabricator : Inventory abstract
}
else
{
cur = SWWMAmmo(Spawn(available[i]));
cur = SWWMAmmo(Spawn(type));
amt = cur.Amount = 0;
lim = cur.MaxAmount;
cur.AttachToOwner(Owner);
@ -321,9 +321,9 @@ Class HammerspaceEmbiggener : Inventory
if ( !traded ) other.A_StartSound("powerup/embiggener",CHAN_ITEMEXTRA);
// Find every unique type of ammoitem. Give it to the player if
// they don't have it already, and increase its maximum capacity.
for ( int i=0; i<AllActorClasses.Size(); i++ )
foreach ( cls:AllActorClasses )
{
let type = (class<Ammo>)(AllActorClasses[i]);
let type = (class<Ammo>)(cls);
if ( !type || (type.GetParentClass() != 'SWWMAmmo') ) continue;
let ammoitem = Ammo(other.FindInventory(type));
int amount = GetDefaultByType(type).BackpackAmount*self.Amount;
@ -362,9 +362,9 @@ Class HammerspaceEmbiggener : Inventory
}
}
// do the same for mag ammo, in a separate loop
for ( int i=0; i<AllActorClasses.Size(); i++ )
foreach ( cls:AllActorClasses )
{
let type = (class<MagAmmo>)(AllActorClasses[i]);
let type = (class<MagAmmo>)(cls);
if ( !type || (type.GetParentClass() != 'MagAmmo') ) continue;
let magitem = MagAmmo(other.FindInventory(type));
int amount = GetDefaultByType(type).BackpackAmount*self.Amount;

View file

@ -111,10 +111,10 @@ Class SWWMAmmo : Ammo
// enumerate all subclasses
Array<Class<Ammo> > ammotypes;
ammotypes.Clear();
for ( int i=0; i<AllActorClasses.Size(); i++ )
foreach ( cls:AllActorClasses )
{
if ( AllActorClasses[i] is GetParentAmmo() )
ammotypes.Push((Class<Ammo>)(AllActorClasses[i]));
if ( cls is GetParentAmmo() )
ammotypes.Push((Class<Ammo>)(cls));
}
// sort from largest to smallest
qsort_ammotypes(ammotypes,0,ammotypes.Size()-1);
@ -122,12 +122,12 @@ Class SWWMAmmo : Ammo
Inventory last = null;
while ( amt > 0 )
{
for ( int i=0; i<ammotypes.Size(); i++ )
foreach ( type:ammotypes )
{
let def = GetDefaultByType(ammotypes[i]);
let def = GetDefaultByType(type);
if ( amt >= def.Amount )
{
last = DoDrop(ammotypes[i]);
last = DoDrop(type);
amt -= def.Amount;
Amount -= def.Amount;
break;
@ -149,10 +149,10 @@ Class SWWMAmmo : Ammo
// enumerate all subclasses
Array<Class<Ammo> > ammotypes;
ammotypes.Clear();
for ( int i=0; i<AllActorClasses.Size(); i++ )
foreach ( cls:AllActorClasses )
{
if ( AllActorClasses[i] is GetParentAmmo() )
ammotypes.Push((Class<Ammo>)(AllActorClasses[i]));
if ( cls is GetParentAmmo() )
ammotypes.Push((Class<Ammo>)(cls));
}
// sort from largest to smallest
qsort_ammotypes(ammotypes,0,ammotypes.Size()-1);
@ -177,13 +177,13 @@ Class SWWMAmmo : Ammo
continue;
}
}
for ( int i=0; i<ammotypes.Size(); i++ )
foreach ( type:ammotypes )
{
let def = GetDefaultByType(ammotypes[i]);
let def = GetDefaultByType(type);
if ( excess >= def.Amount )
{
double ang = FRandom[Junk](0,360);
last = DoDrop(ammotypes[i]);
last = DoDrop(type);
last.SetOrigin(item.pos,false);
last.vel.xy = AngleToVector(ang,FRandom[Junk](2,5));
excess -= def.Amount;
@ -252,10 +252,10 @@ Class SWWMAmmo : Ammo
{
Super.ModifyDropAmount(dropamount);
int maxdrop = 1;
for ( int i=0; i<AllActorClasses.Size(); i++ )
foreach ( cls:AllActorClasses )
{
if ( !(AllActorClasses[i] is GetParentAmmo()) ) continue;
let def = GetDefaultByType((Class<Ammo>)(AllActorClasses[i]));
if ( !(cls is GetParentAmmo()) ) continue;
let def = GetDefaultByType((Class<Ammo>)(cls));
maxdrop = max(maxdrop,def.amount);
}
Amount = Random[ShellDrop](1,clamp(dropamount,1,maxdrop));
@ -393,10 +393,10 @@ Class MagAmmo : Inventory abstract
// enumerate all subclasses
Array<Class<MagAmmo> > ammotypes;
ammotypes.Clear();
for ( int i=0; i<AllActorClasses.Size(); i++ )
foreach ( cls:AllActorClasses )
{
if ( AllActorClasses[i] is GetParentMagAmmo() )
ammotypes.Push((Class<MagAmmo>)(AllActorClasses[i]));
if ( cls is GetParentMagAmmo() )
ammotypes.Push((Class<MagAmmo>)(cls));
}
// sort from largest to smallest
qsort_ammotypes(ammotypes,0,ammotypes.Size()-1);
@ -415,13 +415,13 @@ Class MagAmmo : Inventory abstract
continue;
}
// drop bullets otherwise
for ( int i=0; i<ammotypes.Size(); i++ )
foreach ( type:ammotypes )
{
let def = GetDefaultByType(ammotypes[i]);
let def = GetDefaultByType(type);
if ( excess >= def.Amount )
{
double ang = FRandom[Junk](0,360);
last = DoDrop(ammotypes[i]);
last = DoDrop(type);
last.SetOrigin(item.pos,false);
last.vel.xy = AngleToVector(ang,FRandom[Junk](2,5));
excess -= def.Amount;
@ -566,10 +566,10 @@ Class MagAmmo : Inventory abstract
// enumerate all subclasses
Array<Class<MagAmmo> > ammotypes;
ammotypes.Clear();
for ( int i=0; i<AllActorClasses.Size(); i++ )
foreach ( cls:AllActorClasses )
{
if ( AllActorClasses[i] is GetParentMagAmmo() )
ammotypes.Push((Class<MagAmmo>)(AllActorClasses[i]));
if ( cls is GetParentMagAmmo() )
ammotypes.Push((Class<MagAmmo>)(cls));
}
// sort from largest to smallest
qsort_ammotypes(ammotypes,0,ammotypes.Size()-1);
@ -587,12 +587,12 @@ Class MagAmmo : Inventory abstract
continue;
}
// drop bullets otherwise
for ( int i=0; i<ammotypes.Size(); i++ )
foreach ( type:ammotypes )
{
let def = GetDefaultByType(ammotypes[i]);
let def = GetDefaultByType(type);
if ( amt >= def.Amount )
{
last = DoDrop(ammotypes[i]);
last = DoDrop(type);
amt -= def.Amount;
Amount -= def.Amount;
break;
@ -606,10 +606,10 @@ Class MagAmmo : Inventory abstract
{
Super.ModifyDropAmount(dropamount);
int maxdrop = 1;
for ( int i=0; i<AllActorClasses.Size(); i++ )
foreach ( cls:AllActorClasses )
{
if ( !(AllActorClasses[i] is GetParentMagAmmo()) ) continue;
let def = GetDefaultByType((Class<MagAmmo>)(AllActorClasses[i]));
if ( !(cls is GetParentMagAmmo()) ) continue;
let def = GetDefaultByType((Class<MagAmmo>)(cls));
maxdrop = max(maxdrop,def.amount);
}
Amount = Random[ShellDrop](1,clamp(dropamount,1,maxdrop));

View file

@ -72,9 +72,9 @@ Class SWWMCollectible : Inventory abstract
Super.AttachToOwner(other);
// count how many we have, set progress accordingly
int nc = 0, cnc = 0;
for ( int i=0; i<AllActorClasses.Size(); i++ )
foreach ( cls:AllActorClasses )
{
let c = (Class<SWWMCollectible>)(AllActorClasses[i]);
let c = (Class<SWWMCollectible>)(cls);
if ( !c || (c == 'SWWMCollectible') ) continue;
let def = GetDefaultByType(c);
// check that we can collect it in this IWAD

View file

@ -94,9 +94,9 @@ Class SayaBeanGesture : SWWMItemGesture
let realbean = SayaBean(FindInventory("SayaBean"));
if ( realbean && !realbean.callout && !Random[Gesture](0,3) )
{
for ( int i=0; i<AllActorClasses.size(); i++ )
foreach ( cls:AllActorClasses )
{
if ( AllActorClasses[i].GetClassName() != "HDoomPlayer" ) continue;
if ( cls.GetClassName() != "HDoomPlayer" ) continue;
A_StartSound("saya/pervert",CHAN_ITEMEXTRA,CHANF_OVERLAP);
realbean.callout = true;
return;

View file

@ -296,8 +296,7 @@ Class SWWMGasCloudSpawner : SWWMNonInteractiveActor
if ( isFrozen() ) return;
if ( !(special1%5) )
{
Vector3 x, y, z;
[x, y, z] = swwm_CoordUtil.GetAxes(pitch,angle,roll);
Vector3 x = SWWMUtility.Vec3FromAngles(angle,pitch);
let c = Spawn("SWWMGasCloud",level.Vec3Offset(pos,x*(20+special1*12)));
c.target = target;
c.specialf1 = 1+special1/10.;
@ -1004,17 +1003,15 @@ Class Chancebox : Actor
// find all secret sectors, find potential spawn spots within them
// after that, spawn up to 3 boxes total within them
int tboxes = 0;
for ( int i=0; i<level.Sectors.Size(); i++ )
foreach ( s:level.Sectors )
{
if ( !(level.Sectors[i].flags&Sector.SECF_SECRET) ) continue;
Sector s = level.Sectors[i];
if ( !(s.flags&Sector.SECF_SECRET) ) continue;
// find any spots in the sector that are within it and have no linedefs or blocking actors within a 32 unit box
// start from the center, expand in rings
Vector2 origin = s.centerspot;
double maxradius = 0;
for ( int j=0; j<s.lines.Size(); j++ )
foreach ( l:s.lines )
{
Line l = s.lines[j];
double v1len = (l.v1.p-origin).length(),
v2len = (l.v2.p-origin).length();
if ( v1len > maxradius ) maxradius = v1len;
@ -1122,9 +1119,9 @@ Class Chancebox : Actor
{
Array<Class <SWWMCollectible> > candidates;
candidates.Clear();
for ( int i=0; i<AllActorClasses.Size(); i++ )
foreach ( cls:AllActorClasses )
{
let c = (Class<SWWMCollectible>)(AllActorClasses[i]);
let c = (Class<SWWMCollectible>)(cls);
if ( !c || (c == 'SWWMCollectible') ) continue;
let def = GetDefaultByType(c);
// check that we can collect it in this IWAD
@ -1156,9 +1153,9 @@ Class Chancebox : Actor
{
// populate reward choices to randomize
Array<ChanceboxReward> rewards;
for ( int i=0; i<AllClasses.Size(); i++ )
foreach ( cls:AllClasses )
{
let cls = (Class<ChanceboxReward>)(AllClasses[i]);
let cls = (Class<ChanceboxReward>)(cls);
if ( !cls || cls.isAbstract() ) continue;
let cr = ChanceboxReward(new(cls));
rewards.Push(cr);
@ -1213,9 +1210,9 @@ Class Chancebox : Actor
SWWMCollectible c;
while ( c = SWWMCollectible(ti.Next()) ) col++;
int tcol = 0;
for ( int i=0; i<AllActorClasses.Size(); i++ )
foreach ( cls:AllActorClasses )
{
let c = (Class<SWWMCollectible>)(AllActorClasses[i]);
let c = (Class<SWWMCollectible>)(cls);
if ( !c || (c == 'SWWMCollectible') ) continue;
let def = GetDefaultByType(c);
// check that we can collect it in this IWAD

View file

@ -313,9 +313,8 @@ Class GhostTarget : Actor
if ( !master || (LastHeard == master) || !master.FindInventory("GhostPower") )
{
let hnd = SWWMHandler(EventHandler.Find("SWWMHandler"));
if ( hnd ) for ( int i=0; i<hnd.suckableactors.Size(); i++ )
if ( hnd ) foreach ( a:hnd.suckableactors )
{
let a = hnd.suckableactors[i];
if ( !a || !a.bISMONSTER || a.player || !a.IsHostile(master) || (a.Health <= 0) ) continue;
if ( a.target == self ) a.target = master;
}
@ -368,9 +367,8 @@ Class GhostPower : PowerInvisibility
// are any enemies targetting us? if so, make them focus on a fake target located where we currently are standing
let hnd = SWWMHandler(EventHandler.Find("SWWMHandler"));
Actor gt = null;
if ( hnd ) for ( int i=0; i<hnd.suckableactors.Size(); i++ )
if ( hnd ) foreach ( a:hnd.suckableactors )
{
let a = hnd.suckableactors[i];
if ( !a || !a.bISMONSTER || a.player || !a.IsHostile(Owner) || (a.Health <= 0) ) continue;
// make them forget the ghost if we make noise
if ( (a.LastHeard == Owner) && (a.target is 'GhostTarget') && (a.target.master == Owner) )
@ -1663,16 +1661,17 @@ Class CompanionLamp : Actor
Actor f = Spawn("SWWMItemFog",pos);
f.A_StartSound("lamp/disappear",CHAN_VOICE);
// carry over the moths
foreach ( m:moff )
for ( int i=0; i<moff.Size(); i++ )
{
if ( !moff[i] ) continue;
Vector3 whereto = level.Vec3Offset(moff[i].pos,rel);
if ( !m ) continue;
Vector3 whereto = level.Vec3Offset(m.pos,rel);
if ( !level.IsPointInLevel(whereto) )
continue;
Vector3 oldp = moff[i].pos;
moff[i].SetOrigin(whereto,false);
if ( !moff[i].TestMobjLocation() )
moff[i].SetOrigin(oldp,false);
Vector3 oldp = m.pos;
m.SetOrigin(whereto,false);
if ( !m.TestMobjLocation() )
m.SetOrigin(oldp,false);
}
SetOrigin(trail,false);
angle = AngleTo(parent);
@ -2238,7 +2237,7 @@ Class MykradvoTendril : SWWMNonInteractiveActor
{
tics = bMISSILEMORE?2:1;
Vector3 x, y, z;
[x, y, z] = swwm_CoordUtil.GetAxes(pitch,angle,roll);
[x, y, z] = SWWMUtility.GetAxes(angle,pitch,roll);
if ( !bSTANDSTILL )
{
let t = new("TendrilTracer");
@ -2246,21 +2245,21 @@ Class MykradvoTendril : SWWMNonInteractiveActor
t.hitlist.Clear();
t.ShootThroughList.Clear();
t.Trace(pos,CurSector,x,speed,0);
for ( int i=0; i<t.ShootThroughList.Size(); i++ )
foreach ( l:t.ShootThroughList )
{
t.ShootThroughList[i].Activate(target,0,SPAC_PCross);
t.ShootThroughList[i].Activate(target,0,SPAC_Impact);
l.Activate(target,0,SPAC_PCross);
l.Activate(target,0,SPAC_Impact);
}
for ( int i=0; i<t.hitlist.Size(); i++ )
foreach ( hit:t.hitlist )
{
if ( t.hitlist[i].hitactor.IsFriend(target) ) continue;
if ( (t.hitlist[i].hitactor == tracer) && bMISSILEMORE ) bMISSILEEVENMORE = true; // we split
int dmg = (t.hitlist[i].hitactor.bBOSS||t.hitlist[i].hitactor.FindInventory("BossMarker"))?(GetMissileDamage(0,0)*4):max(t.hitlist[i].hitactor.Health,GetMissileDamage(0,0));
SWWMUtility.DoKnockback(t.hitlist[i].hitactor,-t.hitlist[i].x+(0,0,.5),((t.hitlist[i].hitactor.Health-dmg)<=0)?60000:8000);
let p = SWWMPuff.Setup(t.hitlist[i].hitlocation,t.hitlist[i].x,self,target,t.hitlist[i].hitactor);
t.hitlist[i].hitactor.DamageMobj(p,target,dmg,'Plasma',DMG_THRUSTLESS|DMG_INFLICTOR_IS_PUFF);
if ( t.hitlist[i].hitactor && t.hitlist[i].hitactor.bISMONSTER && !Random[Mykradvo](0,3) )
t.hitlist[i].hitactor.Howl();
if ( hit.hitactor.IsFriend(target) ) continue;
if ( (hit.hitactor == tracer) && bMISSILEMORE ) bMISSILEEVENMORE = true; // we split
int dmg = (hit.hitactor.bBOSS||hit.hitactor.FindInventory("BossMarker"))?(GetMissileDamage(0,0)*4):max(hit.hitactor.Health,GetMissileDamage(0,0));
SWWMUtility.DoKnockback(hit.hitactor,-hit.x+(0,0,.5),((hit.hitactor.Health-dmg)<=0)?60000:8000);
let p = SWWMPuff.Setup(hit.hitlocation,hit.x,self,target,hit.hitactor);
hit.hitactor.DamageMobj(p,target,dmg,'Plasma',DMG_THRUSTLESS|DMG_INFLICTOR_IS_PUFF);
if ( hit.hitactor && hit.hitactor.bISMONSTER && !Random[Mykradvo](0,3) )
hit.hitactor.Howl();
}
}
nextpos = level.Vec3Offset(pos,x*speed);
@ -2296,7 +2295,7 @@ Class MykradvoTendril : SWWMNonInteractiveActor
{
// spread into sub-tendrils
Vector3 x, y, z;
[x, y, z] = swwm_CoordUtil.GetAxes(pitch,angle,roll);
[x, y, z] = SWWMUtility.GetAxes(angle,pitch,roll);
int ntendies = tracer?clamp(tracer.GetSpawnHealth()/400,2,10):2;
for ( int i=0; i<ntendies; i++ )
{
@ -2318,7 +2317,7 @@ Class MykradvoTendril : SWWMNonInteractiveActor
{
int numpt = bMISSILEMORE?9:3;
Vector3 x, y, z;
[x, y, z] = swwm_CoordUtil.GetAxes(pitch,angle,roll);
[x, y, z] = SWWMUtility.GetAxes(angle,pitch,roll);
for ( int i=0; i<numpt; i++ )
{
double a = FRandom[ExploS](0,360), s = FRandom[ExploS](0,1.);
@ -4034,18 +4033,18 @@ Class SaltBeam : SWWMNonInteractiveActor
{
special1 = 1;
Vector3 x, y, z;
[x, y, z] = swwm_CoordUtil.GetAxes(pitch,angle,roll);
[x, y, z] = SWWMUtility.GetAxes(angle,pitch,roll);
let t = new("SaltTracer");
t.ignore = target;
t.Trace(pos,cursector,x,speed,TRACE_HitSky);
for ( int i=0; i<t.ShootThroughList.Size(); i++ )
foreach ( l:t.ShootThroughList )
{
t.ShootThroughList[i].Activate(target,0,SPAC_PCross);
t.ShootThroughList[i].Activate(target,0,SPAC_Impact);
l.Activate(target,0,SPAC_PCross);
l.Activate(target,0,SPAC_Impact);
}
for ( int i=0; i<t.WaterHitList.Size(); i++ )
foreach ( w:t.WaterHitList )
{
let b = Actor.Spawn("InvisibleSplasher",t.WaterHitList[i].hitpos);
let b = Actor.Spawn("InvisibleSplasher",w.hitpos);
b.target = target;
b.A_CheckTerrain();
}