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

@ -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