Some cleanup.

This commit is contained in:
Mari the Deer 2021-11-23 22:18:41 +01:00
commit 95d92cb8a5
11 changed files with 27 additions and 56 deletions

View file

@ -2684,7 +2684,7 @@ Class SWWMStatusBar : BaseStatusBar
{
if ( sv_norespawn ) return (1.-dimalph);
alph = clamp((deadtimer-90)/60.,0.,1.);
str = String.Format(StringTable.Localize("$SWWM_URDEDMP"),CPlayer.GetUserName());
str = String.Format(StringTable.Localize("$SWWM_URDEDMP"));
fnt = LangFont(mTewiFont);
len = fnt.StringWidth(str);
xx = int((ss.x-len)/2.);
@ -2696,7 +2696,7 @@ Class SWWMStatusBar : BaseStatusBar
return (1.-dimalph);
}
alph = clamp((deadtimer-140)/60.,0.,1.);
str = String.Format(StringTable.Localize("$SWWM_URDED2"),CPlayer.GetUserName());
str = String.Format(StringTable.Localize("$SWWM_URDED2"));
fnt = LangFont(mTewiFont);
len = fnt.StringWidth(str);
xx = int((ss.x-len)/2.);
@ -2705,7 +2705,7 @@ Class SWWMStatusBar : BaseStatusBar
if ( goner || !swwm_revive )
return (1.-dimalph);
alph = clamp((deadtimer-160)/60.,0.,1.);
str = String.Format(StringTable.Localize("$SWWM_URDED3"),CPlayer.GetUserName());
str = String.Format(StringTable.Localize("$SWWM_URDED3"));
fnt = LangFont(mTewiFont);
len = fnt.StringWidth(str);
xx = int((ss.x-len)/2.);

View file

@ -380,6 +380,17 @@ Class MagAmmo : Inventory abstract
Inventory last;
while ( excess > 0 )
{
// drop full mag if possible
if ( excess >= ClipSize )
{
double ang = FRandom[Junk](0,360);
last = DoDrop(ParentAmmo);
last.SetOrigin(item.pos,false);
last.vel.xy = (cos(ang),sin(ang))*FRandom[Junk](2,5);
excess -= ClipSize;
continue;
}
// drop bullets otherwise
for ( int i=0; i<ammotypes.Size(); i++ )
{
let def = GetDefaultByType(ammotypes[i]);

View file

@ -1620,7 +1620,7 @@ Class LampMoth2 : LampMoth
}
}
Class LampMashiro : SWWMMonster abstract
Class LampMashiro : Actor abstract
{
//
// ~nothing here yet, but she will make an appearance someday~

View file

@ -1,48 +1,5 @@
// enemies 'n stuff
// Future planning, will be filled out with AI stuff and whatnot someday
Class SWWMMonster : Actor abstract
{
// integrated fun tags
virtual clearscope String GetFunTag( String defstr = "" )
{
return GetTag(defstr);
}
// the function that should be overriden in subclasses
virtual int HandleLocationalDamage( Actor inflictor, Actor source, int damage, Name mod, Vector3 HitLocation, int flags = 0, double angle = 0 )
{
return damage;
}
// locational damage support, akin to UE1, but hitlocation will be treated as a relative offset, to make things easier
// this one should be called directly by everything in this mod, when possible
int LocationalDamageMobj( Actor inflictor, Actor source, int damage, Name mod, Vector3 HitLocation, int flags = 0, double angle = 0 )
{
damage = HandleLocationalDamage(inflictor,source,damage,mod,HitLocation,flags,angle);
return Super.DamageMobj(inflictor,source,damage,mod,flags,angle);
}
// "estimated" locational damage for the vanilla DamageMobj
override int DamageMobj( Actor inflictor, Actor source, int damage, Name mod, int flags, double angle )
{
Vector3 guesspos = (0,0,Height/2.);
// use inflictor if available, as it may be a projectile or hitscan puff
// if damage comes from an item, use owner
// all of this could be done better (or implemented as an engine feature), but whatever
Actor whomst = inflictor?inflictor:source;
if ( whomst is 'Inventory' ) whomst = Inventory(whomst).Owner;
if ( whomst )
{
guesspos = level.Vec3Diff(pos,whomst.Vec3Offset(0,0,whomst.Height/2));
guesspos.x = clamp(guesspos.x,-radius,radius);
guesspos.y = clamp(guesspos.y,-radius,radius);
guesspos.z = clamp(guesspos.z,0,height);
}
return LocationalDamageMobj(inflictor,source,damage,mod,guesspos,flags,angle);
}
}
// Less mean-spirited Keen
Class SWWMHangingKeen : Actor
{

View file

@ -828,7 +828,6 @@ Class SWWMUtility
// because GetTag() returns the localized string, we need to do things the hard way
static play String GetFunTag( Actor a, String defstr = "" )
{
if ( a is 'SWWMMonster' ) return SWWMMonster(a).GetFunTag(defstr);
// look up any fun tag services
let si = ServiceIterator.Find("FunTagService");
Service sv;
@ -1159,9 +1158,12 @@ Class SWWMUtility
if ( (!(flags&DE_COUNTENEMIES) || hostile) && (!(flags&DE_COUNTSTEALTH) || inactive) ) nhit++;
int dmg = int(Damage*damagescale);
if ( dmg <= 0 ) continue; // no harm
int oldhp = a.Health;
int basehp = a.GetSpawnHealth();
int ndmg = a.DamageMobj(Source,Instigator,dmg,(DamageType=='')?Source.DamageType:DamageType,DMG_EXPLOSION,atan2(-dir.y,-dir.x));
if ( a && !(flags&DE_NOBLEED) ) a.TraceBleed((ndmg>0)?ndmg:dmg,Source);
if ( (flags&DE_HOWL) && a && (a.Health > 0) && a.bISMONSTER && !Random[DoBlast](0,3) ) a.Howl();
if ( (flags&DE_COUNTFHKILLS) && (oldhp < basehp) ) continue; // was not at full health
if ( (!a || (a.Health <= 0)) && (!(flags&DE_COUNTENEMIES) || hostile) && (!(flags&DE_COUNTSTEALTH) || inactive) ) nkill++;
}
// traverse portals (needed since BlockThingsIterator can't properly cross sector portals in both vertical directions)