Updates for GZDoom 4.12, part 1 (new functions, variables, flags, etc.).

This commit is contained in:
Mari the Deer 2024-04-22 14:34:22 +02:00
commit f38db38751
79 changed files with 349 additions and 183 deletions

View file

@ -1040,9 +1040,8 @@ Class MisterGrenade : Actor
// "safe delay" for main grenade
if ( !bAMBUSH && (ReactionTime > default.ReactionTime-20) ) return;
let bt = BlockThingsIterator.Create(self,bAMBUSH?80:120);
while ( bt.Next() )
foreach ( t,p,f:bt )
{
let t = bt.Thing;
if ( !t || !t.bSHOOTABLE || (!t.bISMONSTER && !(t is 'BossBrain') && !t.player) || (t.Health <= 0) || (target && t.IsFriend(target)) || !SWWMUtility.SphereIntersect(t,level.Vec3Offset(pos,vel),bAMBUSH?80:120) || !CheckSight(t,SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY) ) continue;
special1++;
tracer = t;

View file

@ -105,7 +105,7 @@ extend Class SWWMHandler
double frametime = (curframe-prevframe)/1000.;
double theta = clamp(15.*frametime,0.,.5); // naive, but whatever
// draw precise crosshair(s)
if ( automapactive || (players[consoleplayer].Camera != players[consoleplayer].mo) || (players[consoleplayer].cheats&CF_CHASECAM) || (numcrosshairs <= 0) ) return;
if ( (automapactive && !viewactive) || (players[consoleplayer].Camera != players[consoleplayer].mo) || (players[consoleplayer].cheats&CF_CHASECAM) || (numcrosshairs <= 0) ) return;
let sw = SWWMWeapon(players[consoleplayer].ReadyWeapon);
if ( sw && !sw.ShouldDrawCrosshair() ) return;
if ( !swwm_precisecrosshair ) return;

View file

@ -650,7 +650,7 @@ extend Class SWWMHandler
else if ( WeapSel && swwm_useweaponbar && !paused && (players[consoleplayer].playerstate == PST_LIVE) && players[consoleplayer].mo && (gamestate == GS_LEVEL) )
{
// special case: ignore if we used the mousewheel and the automap is active
if ( automapactive && ((e.KeyScan == InputEvent.Key_MWheelUp) || (e.KeyScan == InputEvent.Key_MWheelDown)) )
if ( (automapactive && !viewactive) && ((e.KeyScan == InputEvent.Key_MWheelUp) || (e.KeyScan == InputEvent.Key_MWheelDown)) )
return false;
// only if player owns any selectable weapons
if ( !wsel && SWWMWeaponSelect.PlayerHasWeapons(players[consoleplayer].mo) )

View file

@ -133,8 +133,7 @@ extend Class SWWMHandler
hnd.bossactors.Clear();
hnd.initialized = false;
let ai = level.CreateActorIterator(tid);
Actor a;
while ( a = ai.Next() )
foreach ( a:ai )
{
hnd.bossactors.Push(a);
a.GiveInventory('BossMarker',1);

View file

@ -446,8 +446,7 @@ extend Class SWWMHandler
if ( cls.GetClassName() != 'KdikdizdCompatEventHandler' )
continue;
ti = ThinkerIterator.Create("Thinker");
Thinker t;
while ( t = ti.Next() )
foreach ( t:ti )
{
if ( t.GetClassName() != 'VoodooPusher' )
continue;

View file

@ -72,8 +72,7 @@ Class SWWMStaticHandler : StaticEventHandler
Array<Thinker> stinkers;
if ( !sti ) sti = ThinkerIterator.Create("SWWMStaticThinker");
else sti.Reinit();
Thinker t;
while ( t = sti.Next() ) stinkers.Push(t);
foreach ( t:sti ) stinkers.Push(t);
if ( stinkers.Size() > 0 )
{
foreach ( s:stinkers ) Console.PrintfEx(PRINT_HIGH|PRINT_NONOTIFY,"%s is not STAT_STATIC!",s.GetClassName());
@ -341,8 +340,7 @@ Class SWWMStaticHandler : StaticEventHandler
for ( int i=Thinker.STAT_INFO; i<Thinker.MAX_STATNUM; i++ )
{
let ti = ThinkerIterator.Create("Thinker",i);
Thinker t;
while ( t = ti.Next() )
foreach ( t:ti )
{
if ( t is 'Actor' ) continue;
let cls = t.GetClass();

View file

@ -104,7 +104,7 @@ extend Class SWWMStaticHandler
}
// parses achievements.lst file(s)
private void ParseAchievementList( out Array<SWWMAchievementInfo> achievements )
private void ParseAchievementList( Array<SWWMAchievementInfo> &achievements )
{
achievements.Clear();
let lmp = Wads.FindLumpFullName("achievements.lst");
@ -241,36 +241,38 @@ extend Class SWWMStaticHandler
let di = DictionaryIterator.Create(achievementstate);
while ( di.Next() )
{
String key = di.Key();
let k = di.Key();
let v = di.Value();
bool deleteme = true;
foreach ( inf:achievementinfo )
{
if ( inf.basename != key ) continue;
if ( inf.basename != k ) continue;
deleteme = false;
break;
}
if ( deleteme )
{
if ( developer >= 2 ) Console.Printf("Deleting bogus achievement state %s = %s",key,di.Value());
achievementstate.Remove(key);
if ( developer >= 2 ) Console.Printf("Deleting bogus achievement state %s = %s",k,v);
achievementstate.Remove(k);
}
}
di = DictionaryIterator.Create(achievementprogress);
while ( di.Next() )
{
String key = di.Key();
let k = di.Key();
let v = di.Value();
bool deleteme = true;
foreach ( inf:achievementinfo )
{
if ( inf.basename != key ) continue;
if ( inf.basename != k ) continue;
if ( !inf.maxval ) continue;
deleteme = false;
break;
}
if ( deleteme )
{
if ( developer >= 2 ) Console.Printf("Deleting bogus achievement progress %s = %s",key,di.Value());
achievementprogress.Remove(key);
if ( developer >= 2 ) Console.Printf("Deleting bogus achievement progress %s = %s",k,v);
achievementprogress.Remove(k);
}
}
foreach ( inf:achievementinfo )

View file

@ -9,7 +9,7 @@ extend Class SWWMStatusBar
return String.Format("\cj%d\cc%s",int(meters),StringTable.Localize("$SWWM_UNIT_METER"));
}
private void DrawInterest( Vector3 viewvec, out bool projinit )
private void DrawInterest( Vector3 viewvec, bool &projinit )
{
String tag;
SWWMInterest poi = hnd.intpoints;
@ -84,7 +84,7 @@ extend Class SWWMStatusBar
return col;
}
private void DrawItemSense( Vector3 viewvec, out bool projinit )
private void DrawItemSense( Vector3 viewvec, bool &projinit )
{
let demo = Demolitionist(CPlayer.mo);
if ( !demo ) return;
@ -124,7 +124,7 @@ extend Class SWWMStatusBar
return false;
}
private void DrawTrackers( Vector3 viewvec, out bool projinit )
private void DrawTrackers( Vector3 viewvec, bool &projinit )
{
let cam = players[consoleplayer].camera;
if ( !cti ) cti = ThinkerIterator.Create("SWWMQuickCombatTracker",Thinker.STAT_INVENTORY);
@ -336,7 +336,7 @@ extend Class SWWMStatusBar
}
}
private void DrawNumbers( Vector3 viewvec, out bool projinit )
private void DrawNumbers( Vector3 viewvec, bool &projinit )
{
SWWMDamNum snum = hnd.damnums;
if ( !snum ) return;
@ -366,7 +366,7 @@ extend Class SWWMStatusBar
while ( snum = snum.next );
}
private void DrawScores( Vector3 viewvec, out bool projinit )
private void DrawScores( Vector3 viewvec, bool &projinit )
{
SWWMScoreObj snum = hnd.scorenums;
if ( !snum ) return;
@ -406,7 +406,7 @@ extend Class SWWMStatusBar
private void DrawTarget()
{
// don't draw when dead or with automap open
if ( (CPlayer.health <= 0) || automapactive ) return;
if ( (CPlayer.health <= 0) || (automapactive && !viewactive) ) return;
bool projinit = false;
Vector3 viewvec = SWWMUtility.Vec3FromAngles(viewrot.x,viewrot.y);
// points of interest

View file

@ -510,8 +510,7 @@ extend Class SWWMStatusBar
{
// oh bother, this will be dicks
let ai = level.CreateActorIterator(m.args[0]);
Actor a;
while ( a = ai.Next() )
foreach ( a:ai )
{
Vector2 rv = a.pos.xy-cpos;
bool isportal = false;
@ -829,7 +828,7 @@ extend Class SWWMStatusBar
{
int xx = xmargin, yy = ymargin;
// obviously, don't draw the minimap if the automap is open
if ( !automapactive && swwm_mm_enable )
if ( !(automapactive && !viewactive) && swwm_mm_enable )
{
bool smol = (min(ss.x,ss.y/.5625)<480);
int hsz = smol?HALFMAPSIZE_SMALL:HALFMAPSIZE;
@ -841,11 +840,11 @@ extend Class SWWMStatusBar
// draw stats and timer when automap is open
int fstats = swwm_forcestats;
bool pstats = swwm_percentstats;
if ( automapactive || (fstats > 0) )
if ( (automapactive && !viewactive) || (fstats > 0) )
{
xx = int(ss.x-(xmargin+2));
String str;
if ( automapactive || (fstats > 1) )
if ( (automapactive && !viewactive) || (fstats > 1) )
{
int label = am_showmaplabel;
String ln = level.levelname;

View file

@ -151,7 +151,7 @@ Class GenericFlash : HUDMessageBase
}
override void Draw( int bottom, int visibility )
{
if ( automapactive || (visibility != BaseStatusBar.HUDMSGLayer_UnderHUD) ) return;
if ( (automapactive && !viewactive) || (visibility != BaseStatusBar.HUDMSGLayer_UnderHUD) ) return;
if ( cam && (players[consoleplayer].camera != cam) ) return;
double fractic = System.GetTimeFrac();
double falpha = alpha-fractic*(1./duration);

View file

@ -51,7 +51,7 @@ Class SWWMAmmoSpawner : Inventory abstract
return false;
}
override bool TryPickup( in out Actor toucher )
override bool TryPickup( Actor &toucher )
{
return false;
}

View file

@ -75,7 +75,7 @@ Class SWWMArmor : Armor abstract
{
return damage;
}
override void AbsorbDamage( int damage, Name damageType, out int newdamage, Actor inflictor, Actor source, int flags )
override void AbsorbDamage( int damage, Name damageType, int &newdamage, Actor inflictor, Actor source, int flags )
{
int saved;
if ( (amount <= 0) || DamageTypeDefinition.IgnoreArmor(damageType) || (damage <= 0) )

View file

@ -113,7 +113,7 @@ Class SWWMHealth : Inventory abstract
if ( Amount <= 0 ) DepleteOrDestroy();
}
override void AbsorbDamage( int damage, Name damageType, out int newdamage, Actor inflictor, Actor source, int flags )
override void AbsorbDamage( int damage, Name damageType, int &newdamage, Actor inflictor, Actor source, int flags )
{
if ( Owner.ApplyDamageFactor(damageType,damage) <= 0 )
return; // this damage type is ignored by the player, so it does not affect us

View file

@ -31,7 +31,7 @@ Mixin Class SWWMAutoUseFix
}
return Super.HandlePickup(item);
}
override bool TryPickup( in out Actor toucher )
override bool TryPickup( Actor &toucher )
{
if ( !deathmatch ) return Super.TryPickup(toucher);
// pretend to have a max amount of 0 so we can only be picked up if we can be used

View file

@ -123,39 +123,37 @@ Class FroggyChair : Actor
override bool CanCollideWith( Actor other, bool passive )
{
if ( !other.bSHOOTABLE && !other.bSOLID ) return false;
if ( (other == tracer) && (vel.length() > 1) ) return false;
return true;
}
override void CollidedWith( Actor other, bool passive )
{
Vector3 dir = vel;
double vsize = dir.length();
// we need to compare Z height because wow thanks
Vector3 diff = level.Vec3Diff(pos,other.pos);
if ( (diff.z > height) || (diff.z < -other.height) ) return false;
if ( vsize > 1 )
if ( (diff.z > height) || (diff.z < -other.height) ) return;
if ( vsize <= 1 ) return;
if ( other == lasthit ) return;
dir /= vsize;
if ( !passive && other.bSHOOTABLE && (!tracer || !other.IsFriend(tracer)) )
{
if ( other == lasthit )
return false;
dir /= vsize;
if ( !passive && other.bSHOOTABLE && (!tracer || !other.IsFriend(tracer)) )
lasthit = other;
SWWMUtility.DoKnockback(other,dir,5000*vsize);
Vector3 dirto = level.Vec3Diff(other.Vec3Offset(0,0,other.height/2),Vec3Offset(0,0,height));
double lento = dirto.length();
if ( lento <= double.epsilon )
{
lasthit = other;
SWWMUtility.DoKnockback(other,dir,5000*vsize);
Vector3 dirto = level.Vec3Diff(other.Vec3Offset(0,0,other.height/2),Vec3Offset(0,0,height));
double lento = dirto.length();
if ( lento <= double.epsilon )
{
double ang = FRandom[DoBlast](0,360);
double pt = FRandom[DoBlast](-90,90);
dirto = SWWMUtility.Vec3FromAngles(ang,pt);
}
else dirto /= lento;
vel = (dirto+(0,0,.1))*vsize*.3;
Spawn("SWWMItemFog",pos);
other.DamageMobj(self,tracer,int(2.5*vsize),'Melee',DMG_THRUSTLESS);
A_StartSound("squeak",CHAN_WEAPON);
return false;
double ang = FRandom[DoBlast](0,360);
double pt = FRandom[DoBlast](-90,90);
dirto = SWWMUtility.Vec3FromAngles(ang,pt);
}
if ( other == tracer )
return false;
else dirto /= lento;
vel = (dirto+(0,0,.1))*vsize*.3;
Spawn("SWWMItemFog",pos);
other.DamageMobj(self,tracer,int(2.5*vsize),'Melee',DMG_THRUSTLESS);
A_StartSound("squeak",CHAN_WEAPON);
}
return true;
}
States
{
@ -696,9 +694,8 @@ Class ChanceboxSpawner : Actor
tbox[1] = pos.y-32;
tbox[2] = pos.x-32;
tbox[3] = pos.x+32;
while ( bl.Next() )
foreach ( l,p,f:bl )
{
Line l = bl.CurLine;
if ( !l ) continue;
if ( tbox[2] > l.bbox[3] ) continue;
if ( tbox[3] < l.bbox[2] ) continue;
@ -1065,9 +1062,8 @@ Class Chancebox : Actor
tbox[1] = testpos.y-32;
tbox[2] = testpos.x-32;
tbox[3] = testpos.x+32;
while ( bl.Next() )
foreach ( l,p,f:bl )
{
Line l = bl.CurLine;
if ( !l ) continue;
if ( tbox[2] > l.bbox[3] ) continue;
if ( tbox[3] < l.bbox[2] ) continue;
@ -1098,11 +1094,11 @@ Class Chancebox : Actor
if ( cz-fz < 60 ) continue; // too short
bool blockedff = false;
BlockThingsIterator bt = BlockThingsIterator.CreateFromPos(testpos.x,testpos.y,fz,60,256,false);
while ( bt.Next() )
foreach ( t,p,f:bt )
{
if ( !bt.Thing ) continue;
if ( abs(bt.Thing.pos.x-testpos.x) > 32+bt.Thing.Radius ) continue;
if ( abs(bt.Thing.pos.y-testpos.y) > 32+bt.Thing.Radius ) continue;
if ( !t ) continue;
if ( abs(t.pos.x-testpos.x) > 32+t.Radius ) continue;
if ( abs(t.pos.y-testpos.y) > 32+t.Radius ) continue;
blockedff = true;
break;
}
@ -1117,11 +1113,10 @@ Class Chancebox : Actor
// don't spawn on sky or hurtfloors if there are 3D floors
if ( (nffloor > 0) && ((s.GetTexture(0) == skyflatnum) || (s.damageamount > 0)) ) continue;
BlockThingsIterator bt = BlockThingsIterator.CreateFromPos(testpos.x,testpos.y,testpos.z,60,256,false);
while ( bt.Next() )
foreach ( t,p,f:bt )
{
if ( !bt.Thing ) continue;
if ( abs(bt.Thing.pos.x-testpos.x) > 32+bt.Thing.Radius ) continue;
if ( abs(bt.Thing.pos.y-testpos.y) > 32+bt.Thing.Radius ) continue;
if ( abs(t.pos.x-testpos.x) > 32+t.Radius ) continue;
if ( abs(t.pos.y-testpos.y) > 32+t.Radius ) continue;
blocked = true;
break;
}

View file

@ -7,9 +7,7 @@ Class SWWMKey : Key abstract
Mixin SWWMRotatingPickup;
Mixin SWWMUnrealStyleDrop;
bool propagated;
override bool TryPickup( in out Actor toucher )
override bool TryPickup( Actor &toucher )
{
// attach the vanilla key that we replace
let rt = toucher;
@ -21,8 +19,6 @@ Class SWWMKey : Key abstract
SWWMHandler.KeyTagFix(p);
p.AttachToOwner(rt);
}
// clean up the flag
propagated = false;
GoAwayAndDie();
return true;
}

View file

@ -8,7 +8,7 @@ Class Omnisight : Inventory
Mixin SWWMRotatingPickup;
Mixin SWWMUnrealStyleDrop;
override bool TryPickup( in out Actor toucher )
override bool TryPickup( Actor &toucher )
{
if ( !level.allmap )
{
@ -267,7 +267,7 @@ Class TheBall : Actor
override int SpecialMissileHit( Actor victim )
{
if ( (vel.length() <= 5) || ((victim == target) && !bHITOWNER) || (victim == lasthit) || (!victim.bSHOOTABLE && !victim.bSOLID) )
return 1;
return MHIT_PASS;
// check if we should rip or bounce
// girthitude
double girth = (victim.radius+victim.height)/2.*max(50,victim.mass)*(victim.health/double(victim.GetSpawnHealth()));
@ -337,14 +337,14 @@ Class TheBall : Actor
if ( (slamforce > girth) && is_schutt )
{
vel *= .7;
return 1;
return MHIT_PASS;
}
// force bounce
BlockingMobj = victim;
A_HandleBounce();
lasthit = victim;
// pretend to pass through
return 1;
return MHIT_PASS;
}
override void PostBeginPlay()
{

View file

@ -7,7 +7,7 @@ Class GrilledCheeseSafeguard : Powerup
Powerup.Duration -3;
}
override void ModifyDamage( int damage, Name damageType, out int newdamage, bool passive, Actor inflictor, Actor source, int flags )
override void ModifyDamage( int damage, Name damageType, int &newdamage, bool passive, Actor inflictor, Actor source, int flags )
{
if ( passive ) newdamage = 0;
}
@ -96,7 +96,7 @@ Class GrilledCheeseSandwich : Inventory
DoTheThing();
return true;
}
override void AbsorbDamage( int damage, Name damageType, out int newdamage, Actor inflictor, Actor source, int flags )
override void AbsorbDamage( int damage, Name damageType, int &newdamage, Actor inflictor, Actor source, int flags )
{
if ( Owner.FindInventory("GrilledCheeseSafeguard") )
return; // the safeguard absorbs all
@ -328,9 +328,8 @@ Class GhostTarget : Actor
if ( isFrozen() ) return;
if ( diedie ) A_FadeOut(.05);
let bt = BlockThingsIterator.Create(self,256);
while ( bt.Next() )
foreach ( t,p,f:bt )
{
let t = bt.Thing;
if ( !t || !t.bIsMonster || t.player || !t.IsHostile(master) || (t.target != self) ) continue;
if ( SWWMUtility.BoxIntersect(self,t,pad:16) || t.CheckMeleeRange() )
{
@ -1111,7 +1110,7 @@ Class RagekitPower : Powerup
Demolitionist(Owner).lastbump *= .9;
}
override void ModifyDamage( int damage, Name damageType, out int newdamage, bool passive, Actor inflictor, Actor source, int flags )
override void ModifyDamage( int damage, Name damageType, int &newdamage, bool passive, Actor inflictor, Actor source, int flags )
{
if ( passive ) return;
if ( (damageType == 'Melee') || (damageType == 'Jump') || (damageType == 'Dash') || (damageType == 'Buttslam') || (damageType == 'GroundPound') || (damageType == 'HammerShockwave') )

View file

@ -515,9 +515,8 @@ Class Mykradvo : Inventory
{
Vector2 disp = level.GetDisplacement(t.CurSector.PortalGroup,i);
bt = BlockThingsIterator.CreateFromPos(t.pos.x+disp.x,t.pos.y+disp.y,t.pos.z,3200,3200,false);
while ( bt.Next() )
foreach ( a,p,f:bt )
{
let a = bt.Thing;
// must be an active, shootable live monster
if ( !a || !a.bISMONSTER || !a.bSHOOTABLE || a.bDORMANT || (a.Health <= 0) ) continue;
// skip non-hostiles
@ -880,7 +879,7 @@ Class AngeryPower : Powerup
Demolitionist(Owner).lastbump *= .9;
}
override void ModifyDamage( int damage, Name damageType, out int newdamage, bool passive, Actor inflictor, Actor source, int flags )
override void ModifyDamage( int damage, Name damageType, int &newdamage, bool passive, Actor inflictor, Actor source, int flags )
{
if ( passive || (damage <= 0) ) return;
if ( damageType == 'CoAb44' ) // can only be in 4s

View file

@ -3,7 +3,7 @@
extend Class DemolitionistMenu
{
// initialize the crime clock
static void SetClock( out int c_year, out int c_month, out int c_day, out int c_hour, out int c_minute, out String c_tz )
static void SetClock( int &c_year, int &c_month, int &c_day, int &c_hour, int &c_minute, String &c_tz )
{
// use mission log clock if available
let mlog = SWWMMissionLog.Get();

View file

@ -576,7 +576,7 @@ Class DemolitionistMenuMapStatItem : DemolitionistMenuListItem
return width;
}
void GetLengths( bool selected, out int tlen, out int slen, out int ilen, out int klen )
void GetLengths( bool selected, int &tlen, int &slen, int &ilen, int &klen )
{
int time, par, suck, stotal, scount, itotal, icount, ktotal, kcount;
if ( selected )

View file

@ -95,6 +95,9 @@ Class SWWMTitleStuff : EventHandler
if ( swwm_nointroex && (titletimer >= -300) && (titletimer < 0) ) titletimer = 0;
if ( titletimer == -250 )
{
// this would be much simpler if we had a way to access the mapinfo variable
// (obviously, with this naive method, any custom music that doesn't use the
// vanilla filename won't be used)
if ( gameinfo.gametype&GAME_Hexen ) S_ChangeMusic("HEXEN");
else if ( gameinfo.gametype&GAME_Heretic ) S_ChangeMusic("MUS_TITL");
else

View file

@ -22,7 +22,6 @@ Class Demolitionist : PlayerPawn
int dashlockst;
bool fullfuel;
bool sendtoground;
bool key_reentrant;
bool bInDefaultInventory;
bool oldsinglefirst;
@ -329,9 +328,8 @@ Class Demolitionist : PlayerPawn
tbox[1] = pos.y-(radius+8);
tbox[2] = pos.x-(radius+8);
tbox[3] = pos.x+(radius+8);
while ( bl.Next() )
foreach( l,p,f:bl )
{
Line l = bl.CurLine;
if ( !l ) continue;
if ( tbox[2] > l.bbox[3] ) continue;
if ( tbox[3] < l.bbox[2] ) continue;

View file

@ -83,10 +83,7 @@ extend Class Demolitionist
continue;
let item = Inventory(Spawn(rep));
SWWMHandler.KeyTagFix(item);
if ( item is 'SWWMKey' ) SWWMKey(item).propagated = true; // no anim
key_reentrant = true;
if ( !item.CallTryPickup(self) ) item.Destroy();
key_reentrant = false;
}
}
void CheatGive_Weapons()

View file

@ -64,6 +64,14 @@ extend Class Demolitionist
Super.RemoveInventory(item);
}
// skull keys, random chance of "alas poor yorick" line
private clearscope bool IsSkullKey( Inventory item )
{
String cname = item.GetClassName();
cname.MakeLower();
return (cname.IndexOf("skull") != -1);
}
override void AddInventory( Inventory item )
{
Super.AddInventory(item);
@ -91,7 +99,7 @@ extend Class Demolitionist
facegrin = true;
}
}
if ( (item is 'Key') && !key_reentrant && !deathmatch && !bInDefaultInventory )
if ( (item is 'Key') && !ingivecheat && !deathmatch && !bInDefaultInventory )
{
// score
int score = 100;
@ -99,29 +107,13 @@ extend Class Demolitionist
else Console.Printf(StringTable.Localize("$SWWM_FINDKEYREM"),player.GetUserName(),item.GetTag(),score);
SWWMCredits.Give(player,score);
if ( player == players[consoleplayer] ) SWWMScoreObj.SpawnAtActorBunch(100,self);
if ( !ingivecheat )
if ( !Random[DemoLines](0,5) && IsSkullKey(item) )
{
if ( !Random[DemoLines](0,5) &&
((item.GetClass() == 'RedSkull') || (item.GetClass() == 'YellowSkull')
|| (item.GetClass() == 'BlueSkull') || (item.GetClassName() == "PurpleSkull")) )
{
if ( !SWWMHandler.AddOneliner("skullget",2) )
SWWMHandler.AddOneliner("keyget",2);
}
else SWWMHandler.AddOneliner("keyget",2);
facegrin = true;
}
// share all keys in mp
for ( int i=0; i<MAXPLAYERS; i++ )
{
if ( !playeringame[i] || !players[i].mo || (i == PlayerNumber()) )
continue;
if ( players[i].mo is 'Demolitionist' ) Demolitionist(players[i].mo).key_reentrant = true;
let tkey = Inventory(Spawn(item.GetClass()));
SWWMHandler.KeyTagFix(tkey);
if ( !tkey.CallTryPickup(players[i].mo) ) tkey.Destroy();
if ( players[i].mo is 'Demolitionist' ) Demolitionist(players[i].mo).key_reentrant = false;
if ( !SWWMHandler.AddOneliner("skullget",2) )
SWWMHandler.AddOneliner("keyget",2);
}
else SWWMHandler.AddOneliner("keyget",2);
facegrin = true;
}
// add collectible to stats
if ( item is 'SWWMCollectible' )

View file

@ -13,7 +13,7 @@ Class SayaCollar : SWWMArmor
+INVENTORY.UNCLEARABLE;
// SWWMArmor flags are not needed as this overrides AbsorbDamage directly
}
override void AbsorbDamage( int damage, Name damageType, out int newdamage, Actor inflictor, Actor source, int flags )
override void AbsorbDamage( int damage, Name damageType, int &newdamage, Actor inflictor, Actor source, int flags )
{
if ( (damage <= 0) || (flags&(DMG_FORCED|DMG_NO_ARMOR)) ) return;
newdamage = damage;
@ -30,7 +30,7 @@ Class SayaCollar : SWWMArmor
}
// for friendly fire handling, jammed into here
override void ModifyDamage( int damage, Name damageType, out int newdamage, bool passive, Actor inflictor, Actor source, int flags )
override void ModifyDamage( int damage, Name damageType, int &newdamage, bool passive, Actor inflictor, Actor source, int flags )
{
int ff = swwm_friendlyfire;
if ( !source || (source == Owner) || (source.player == Owner.player) || !source.IsFriend(Owner) || !ff ) return;

View file

@ -6,9 +6,8 @@ extend Class Demolitionist
if ( player.cmd.buttons&BT_USER3 )
{
let bt = BlockThingsIterator.Create(self,800);
while ( bt.Next() )
foreach ( i,p,f:bt )
{
let i = bt.Thing;
if ( !i ) continue;
if ( !(i is 'Inventory') && !(i is 'Chancebox') && !(i is 'SWWMRespawnTimer') ) continue;
if ( (i is 'Inventory') && (i.bINVISIBLE || !i.bSPECIAL || Inventory(i).Owner) ) continue;
@ -55,9 +54,8 @@ extend Class Demolitionist
if ( (magitem_cnt < 8) && !swwm_usetopickup )
{
let bt = BlockThingsIterator.Create(self,500);
while ( bt.Next() )
foreach ( t,p,f:bt )
{
let t = bt.Thing;
if ( !t ) continue;
if ( !(t is 'Inventory') || !t.bSPECIAL || !t.bDROPPED || t.bINVISIBLE || Inventory(t).Owner || !SWWMUtility.SphereIntersect(t,pos,500) || !CheckSight(t,SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY) )
continue;
@ -366,7 +364,7 @@ extend Class Demolitionist
if ( isdashing ) dashboost = 0.;
mystats.stompcount++;
}
if ( lastvelz < -10 )
if ( lastvelz < landingspeed )
A_StartSound("demolitionist/runstop",CHAN_FOOTSTEP,CHANF_OVERLAP);
if ( (lastvelz < -gruntspeed) && (swwm_mutevoice < 4) && (health > 0) )
{
@ -571,10 +569,9 @@ extend Class Demolitionist
double maxmass = max(mass*spd/40.,200);
if ( raging ) maxmass *= 2;
let bt = BlockThingsIterator.Create(self,spd+radius+1024);
while ( bt.Next() )
foreach( a,p,f:bt )
{
if ( spd <= 0 ) break; // if something stopped us, no more iteration
let a = bt.Thing;
if ( !a || (a == self) || (!a.bSOLID && !a.bSHOOTABLE) || a.bTHRUACTORS || a.bCORPSE || !CanCollideWith(a,false) || !a.CanCollideWith(self,true) ) continue;
if ( !SWWMUtility.ExtrudeIntersect(self,a,dir*(spd+radius),8) ) continue;
if ( (a.pos.z <= a.floorz) && (a.height <= MaxStepHeight) ) continue;

View file

@ -263,7 +263,7 @@ Class SWWMWhoPushedMe : Inventory
Destroy();
}
override void ModifyDamage( int damage, Name damageType, out int newdamage, bool passive, Actor inflictor, Actor source, int flags )
override void ModifyDamage( int damage, Name damageType, int &newdamage, bool passive, Actor inflictor, Actor source, int flags )
{
if ( !passive || (damageType != 'Falling') || (killtimer > 0) ) return;
killtimer = 5;

View file

@ -168,9 +168,9 @@ Class LoveHeart : Actor
override int SpecialMissileHit( Actor victim )
{
if ( !victim.bSHOOTABLE && (victim != tracer) ) return 1;
if ( tracer && (victim != tracer) ) return 1;
return -1;
if ( !victim.bSHOOTABLE && (victim != tracer) ) return MHIT_PASS;
if ( tracer && (victim != tracer) ) return MHIT_PASS;
return MHIT_DEFAULT;
}
void A_HeartTick()

View file

@ -3,7 +3,7 @@
Class SWWMUtility
{
// gets the names of all mod cvars
static void GetCVars( out Array<String> cvarlist )
static void GetCVars( Array<String> &cvarlist )
{
cvarlist.Clear();
let lmp = Wads.CheckNumForFullname("cvarinfo.base");

View file

@ -78,9 +78,8 @@ extend Class SWWMUtility
{
Vector2 disp = level.GetDisplacement(thisgroup,i);
bt = BlockThingsIterator.CreateFromPos(Source.pos.x+disp.x,Source.pos.y+disp.y,Source.pos.z,ExplosionRadius,ExplosionRadius,false);
while ( bt.Next() )
foreach ( a,p,f:bt )
{
let a = bt.Thing;
if ( !a ) continue; // this can happen, yes
// early checks for self and ignored actor (usually the instigator)
if ( (a == ignoreme) || (a == Source) )

View file

@ -145,8 +145,7 @@ extend Class SWWMUtility
static play void SpawnVanillaBossBrain( int tid )
{
let ai = Level.CreateActorIterator(tid);
Actor a;
while ( a = ai.Next() )
foreach ( a:ai )
{
let bb = a.Spawn("BossBrain",a.pos,NO_REPLACE);
bb.angle = a.angle;

View file

@ -10,7 +10,7 @@ enum EExitType
extend Class SWWMUtility
{
// Thanks to ZZYZX and Nash
static play void SetToSlopeSpecific( Actor a, double dang, SecPlane plane, bool flipnorm )
static play void SetToSlopeSpecific( Actor a, double dang, readonly<SecPlane> plane, bool flipnorm )
{
Vector3 fnormal;
if ( flipnorm ) fnormal = -plane.Normal;
@ -275,6 +275,7 @@ extend Class SWWMUtility
}
// the stupidest thing ever, it's called BlockingLine but it's not always blocking us
// note: MovementBlockingLine as an alternative seems prone to issues at the moment, needs further investigation
static bool BlockingLineIsBlocking( Actor a, int blockflags = Line.ML_BLOCKEVERYTHING, Line testline = null )
{
Line l = testline?testline:a.BlockingLine;
@ -408,6 +409,7 @@ extend Class SWWMUtility
}
if ( floorfound ) return (al+ah+bl+bh)*.25;
// check for midtex
// TODO: see if GetMidTexturePosition() is useful here to simplify code
if ( !l.sidedef[0].GetTexture(1).IsNull() )
{
double ofs = l.sidedef[0].GetTextureYOffset(1);
@ -624,7 +626,7 @@ extend Class SWWMUtility
}
// iterate through polyobjects and see if this line is part of one (returning which, if any)
static bool IsPolyLine( Line l, out swwm_PolyobjectHandle o )
static bool IsPolyLine( Line l, swwm_PolyobjectHandle &o )
{
let pi = swwm_PolyobjectIterator.Create();
swwm_PolyobjectHandle p;

View file

@ -9,7 +9,7 @@ Struct SWWMProjectionData
extend Class SWWMUtility
{
// gutamatics caching
static void PrepareProjData( out SWWMProjectionData d, Vector3 viewpos, double angle, double pitch, double roll, double fov )
static void PrepareProjData( SWWMProjectionData &d, Vector3 viewpos, double angle, double pitch, double roll, double fov )
{
double aspect = Screen.GetAspectRatio();
// vertical fov
@ -50,16 +50,16 @@ extend Class SWWMUtility
}
// less code duplication
static void AdjustClean_1( out double x, out double y )
static void AdjustClean_1( double &x, double &y )
{
x = (x-160)*CleanXFac_1+(Screen.GetWidth()*.5);
y = (y-100)*CleanYFac_1+(Screen.GetHeight()*.5);
}
static void AdjustClean_1x( out double x )
static void AdjustClean_1x( double &x )
{
x = (x-160)*CleanXFac_1+(Screen.GetWidth()*.5);
}
static void AdjustClean_1y( out double y )
static void AdjustClean_1y( double &y )
{
y = (y-100)*CleanYFac_1+(Screen.GetHeight()*.5);
}

View file

@ -2,7 +2,7 @@
extend Class SWWMUtility
{
// bit ugly, but it works
static void ThousandsStr( out String s, int col = Font.CR_UNDEFINED, String colstr = "" )
static void ThousandsStr( String &s, int col = Font.CR_UNDEFINED, String colstr = "" )
{
if ( (col < Font.CR_UNDEFINED) || (col >= Font.NUM_TEXT_COLORS) )
ThrowAbortException("col parameter out of range, use colstr for non-standard font colors.");
@ -34,7 +34,7 @@ extend Class SWWMUtility
return nstr;
}
static void StripColor( out String str )
static void StripColor( String &str )
{
int len = str.CodePointCount();
for ( int i=0, pos=0; i<len; i++ )
@ -83,7 +83,7 @@ extend Class SWWMUtility
return str;
}
static void ObscureText( out String str, int seed, bool alnum = false, bool minihud = false )
static void ObscureText( String &str, int seed, bool alnum = false, bool minihud = false )
{
int len = str.CodePointCount();
String newstr = "";
@ -114,7 +114,7 @@ extend Class SWWMUtility
str = newstr;
}
static void BeautifyClassName( out String str )
static void BeautifyClassName( String &str )
{
String workstr = str;
str.Truncate(0);

View file

@ -885,7 +885,7 @@ Class SWWMDualWeaponGiver : Inventory
return false;
}
override bool TryPickup( in out Actor toucher )
override bool TryPickup( Actor &toucher )
{
if ( giveme[0].HasSwapWeapon(toucher) )
return false;

View file

@ -42,7 +42,7 @@ Class ParriedBuff : Inventory
s.SetShade(Color(4,2,1)*Random[Ponch](32,63));
}
}
override void ModifyDamage( int damage, Name damageType, out int newdamage, bool passive, Actor inflictor, Actor source, int flags )
override void ModifyDamage( int damage, Name damageType, int &newdamage, bool passive, Actor inflictor, Actor source, int flags )
{
// increase blast damage (way too tiny normally for lost souls)
if ( Owner.bBLASTED && (damageType == 'Melee') && !inflictor && !source )
@ -66,7 +66,7 @@ Class ParryDamageChecker : Inventory
Inventory.MaxAmount 1;
}
override void ModifyDamage( int damage, Name damageType, out int newdamage, bool passive, Actor inflictor, Actor source, int flags )
override void ModifyDamage( int damage, Name damageType, int &newdamage, bool passive, Actor inflictor, Actor source, int flags )
{
Inventory buff;
if ( inflictor && (buff=inflictor.FindInventory("ParriedBuff")) )

View file

@ -16,8 +16,8 @@ extend Class SWWMWeapon
Super.DoEffect();
// force custom crosshair
if ( swwm_precisecrosshair && (players[consoleplayer].Camera == players[consoleplayer].mo) && !(players[consoleplayer].cheats&CF_CHASECAM) )
crosshair = 99;
else crosshair = ShouldDrawCrosshair()?0:99;
crosshair = -1;
else crosshair = ShouldDrawCrosshair()?0:-1;
}
// where the trace is coming from relative to eyes

View file

@ -267,9 +267,8 @@ Class HellblazerMissile : Actor
}
// proximity check
let bt = BlockThingsIterator.Create(self,256);
while ( bt.Next() )
foreach ( t,p,v:bt )
{
let t = bt.Thing;
if ( !t || !t.bSHOOTABLE || (!t.bISMONSTER && !(t is 'BossBrain') && !t.player) || (t.Health <= 0) || (target && t.IsFriend(target)) || !SWWMUtility.SphereIntersect(t,level.Vec3Offset(pos,vel),bNOGRAVITY?50:90) || !CheckSight(t,SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY) ) continue;
deto++;
tracer = t;

View file

@ -273,7 +273,7 @@ Class EvisceratorChunk : Actor
A_HandleBounce();
lasthit = victim;
}
return 1;
return MHIT_PASS;
}
// with this we can guarantee that the chunk won't just keep on dealing damage
// this is something I wish Unreal's boulders did
@ -306,7 +306,7 @@ Class EvisceratorChunk : Actor
vel *= FRandom[Eviscerator](.8,.9); // reduce velocity as it rips
A_Gravity();
gravity = clamp(.35-vel.length()/200.,.15,.35);
return 1;
return MHIT_PASS;
}
// HACK
if ( !victim.bNOBLOOD && !victim.bDORMANT && !victim.bINVULNERABLE )
@ -321,7 +321,7 @@ Class EvisceratorChunk : Actor
A_HandleBounce();
lasthit = victim;
}
return 1;
return MHIT_PASS;
}
States
{

View file

@ -473,9 +473,8 @@ Class YnykronImpact : SWWMNonInteractiveActor
{
Vector2 disp = level.GetDisplacement(CurSector.PortalGroup,i);
bt = BlockThingsIterator.CreateFromPos(pos.x+disp.x,pos.y+disp.y,pos.z,rad,rad,false);
while ( bt.Next() )
foreach ( t,p,f:bt )
{
let t = bt.Thing;
if ( !t || !t.bSHOOTABLE || !SWWMUtility.SphereIntersect(t,pos,rad) || (!SWWMUtility.SphereIntersect(t,pos,100) && !CheckSight(t,SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY)) ) continue;
if ( YnykronShot(master) && (YnykronShot(master).hitlist.Find(t) < YnykronShot(master).hitlist.Size()) )
continue;

View file

@ -193,9 +193,8 @@ Class BigBiospark : Actor
{
double closest = double.infinity;
let bt = BlockThingsIterator.Create(self,8000);
while ( bt.Next() )
foreach ( t,p,f:bt )
{
let t = bt.Thing;
double dist;
if ( !t || !t.bSHOOTABLE || (!t.bISMONSTER && !(t is 'BossBrain') && !t.player) || (t.Health <= 0) || (target && t.IsFriend(target)) || ((dist=Distance3DSquared(t)) > 64000000) || !CheckSight(t,SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY) ) continue;
Vector3 dirto = level.Vec3Diff(pos,t.Vec3Offset(0,0,t.height/2)).unit();
@ -231,9 +230,8 @@ Class BigBiospark : Actor
{
Vector2 disp = level.GetDisplacement(CurSector.PortalGroup,i);
bt = BlockThingsIterator.CreateFromPos(pos.x+disp.x,pos.y+disp.y,pos.z,120,120,false);
while ( bt.Next() )
foreach ( t,p,f:bt )
{
let t = bt.Thing;
if ( !t || !t.bSHOOTABLE || !SWWMUtility.SphereIntersect(t,pos,120) ) continue;
if ( hitlist.Find(t) >= hitlist.Size() )
hitlist.Push(t);
@ -479,9 +477,8 @@ Class BiosparkBall : Actor
{
double closest = double.infinity;
let bt = BlockThingsIterator.Create(self,8000);
while ( bt.Next() )
foreach ( t,p,f:bt )
{
let t = bt.Thing;
double dist;
if ( !t || !t.bSHOOTABLE || (!t.bISMONSTER && !(t is 'BossBrain') && !t.player) || (t.Health <= 0) || (target && t.IsFriend(target)) || ((dist=Distance3DSquared(t)) > 250000) || !CheckSight(t,SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY) ) continue;
Vector3 dirto = level.Vec3Diff(pos,t.Vec3Offset(0,0,t.height/2)).unit();
@ -512,9 +509,8 @@ Class BiosparkBall : Actor
}
// proximity check
let bt = BlockThingsIterator.Create(self,256);
while ( bt.Next() )
foreach ( t,p,f:bt )
{
let t = bt.Thing;
if ( !t || !t.bSHOOTABLE || (!t.bISMONSTER && !(t is 'BossBrain')) || (t.Health <= 0) || (target && t.IsFriend(target)) || !SWWMUtility.SphereIntersect(t,level.Vec3Offset(pos,vel),16) || !CheckSight(t,SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY) ) continue;
deto++;
break;
@ -1071,9 +1067,8 @@ Class BiosparkBeam : SWWMNonInteractiveActor
nextpos = t.Results.HitPos;
double closest = double.infinity;
let bt = BlockThingsIterator.Create(self,500);
while ( bt.Next() )
foreach ( t,p,f:bt )
{
let t = bt.Thing;
double dist;
if ( !t || (!(t is 'BiosparkHitbox') && (!t.bSHOOTABLE || (!t.bISMONSTER && !(t is 'BossBrain') && !t.player) || (t.Health <= 0) || (target && t.IsFriend(target)))) || ((dist=Distance3DSquared(t)) > 250000) || !CheckSight(t,SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY) ) continue;
Vector3 dirto = level.Vec3Diff(nextpos,t.Vec3Offset(0,0,t.height/2));
@ -1379,7 +1374,7 @@ Class BiosparkArc : SWWMNonInteractiveActor
{
double closest = double.infinity;
let bt = BlockThingsIterator.Create(self,1500);
while ( bt.Next() )
foreach ( t,p,f:bt )
{
let t = bt.Thing;
double dist;

View file

@ -246,9 +246,8 @@ Class ExplodiumMagHitbox : Actor
}
SetOrigin(target.Vec3Offset(0,0,-height*.5),false);
let bt = BlockThingsIterator.Create(self,256);
while ( bt.Next() )
foreach ( t,p,f:bt )
{
let t = bt.Thing;
if ( !t || (t == self) || !t.bSHOOTABLE || (t == target.target) || t.IsFriend(target.target) || !SWWMUtility.BoxIntersect(self,t) )
continue;
target.bKILLED = true;
@ -298,8 +297,8 @@ Class ExplodiumMagAttach : ExplodiumMagProj
override int SpecialMissileHit( Actor victim )
{
if ( victim is 'ExplodiumMagHitbox' ) return 1;
return -1;
if ( victim is 'ExplodiumMagHitbox' ) return MHIT_PASS;
return MHIT_DEFAULT;
}
override void Tick()
{